warchat 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -4,9 +4,6 @@ This project aims to create a simple ruby interface for connecting to Blizzard's
4
4
 
5
5
  = Features
6
6
 
7
- At the moment there is only a very basic set of features, but the main hurdle of
8
- authenticating with the mobile armory server is mostly solved.
9
-
10
7
  * SRP authentication
11
8
  * Guild Chat
12
9
  * Officer Chat
@@ -28,13 +28,14 @@ module Warchat
28
28
  end
29
29
 
30
30
  def session_receive response
31
- send(response.target.gsub('/','').underscore.to_sym,response)
31
+ m = response.target.gsub('/','').underscore.to_sym
32
+ send(m,response) if respond_to? m
32
33
  end
33
34
 
34
35
  def login
35
36
  request = Warchat::Network::Request.new("/chat-login",:options=>{:mature_filter=>'false'},:n=>character_name,:r=>character_realm)
36
37
  session.send_request(request)
37
- @timer = Warchat::Timer.new(120,&method(:keep_alive))
38
+ @timer = Warchat::Timer.new(30,&method(:keep_alive))
38
39
  end
39
40
 
40
41
  def logout
@@ -79,9 +80,7 @@ module Warchat
79
80
  end
80
81
 
81
82
  def keep_alive
82
- request = Warchat::Network::Request("/ah-mail")
83
- request["r"] = realm
84
- request["cn"] = name
83
+ request = Warchat::Network::Request.new("/ah-mail",:n=>character_name,:r=>character_realm)
85
84
  session.send_request(request)
86
85
  end
87
86
 
data/lib/warchat/timer.rb CHANGED
@@ -9,7 +9,14 @@ module Warchat class Timer
9
9
  @run = true
10
10
  @th = Thread.new do
11
11
  while run?
12
- do_sleep and handler.call rescue nil
12
+ if do_sleep
13
+ begin
14
+ handler.call
15
+ rescue Exception => e
16
+ puts e.message
17
+ puts e.backtrace
18
+ end
19
+ end
13
20
  end
14
21
  end
15
22
  @th['name'] = 'Timer'
@@ -31,9 +38,10 @@ module Warchat class Timer
31
38
  def do_sleep
32
39
  synchronize do @sleeping = true end
33
40
  sleep(@interval)
34
- synchronize do @sleeping = false end
35
41
  rescue
36
42
  nil
43
+ ensure
44
+ synchronize do @sleeping = false end
37
45
  end
38
46
 
39
47
  def run?
@@ -1,3 +1,3 @@
1
1
  module Warchat
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warchat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Zachary Gavin