warchat 0.0.1 → 0.0.2
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/lib/warchat/chat/client.rb
CHANGED
@@ -24,7 +24,6 @@ module Warchat
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def session_establish response
|
27
|
-
puts 'Session Established'
|
28
27
|
on_establish.andand.call(response)
|
29
28
|
end
|
30
29
|
|
@@ -57,7 +56,7 @@ module Warchat
|
|
57
56
|
def chat response
|
58
57
|
response.extend(ChatResponse)
|
59
58
|
if response.ack?
|
60
|
-
|
59
|
+
|
61
60
|
elsif response.message?
|
62
61
|
message = Message.new(response)
|
63
62
|
on_message.andand.call(message)
|
@@ -76,8 +75,6 @@ module Warchat
|
|
76
75
|
end
|
77
76
|
|
78
77
|
def keep_alive
|
79
|
-
puts "Sending 'keep-alive'"
|
80
|
-
|
81
78
|
request = Warchat::Network::Request("/ah-mail")
|
82
79
|
request["r"] = realm
|
83
80
|
request["cn"] = name
|
data/lib/warchat/chat/message.rb
CHANGED
@@ -12,15 +12,17 @@ module Warchat
|
|
12
12
|
CHAT_MSG_TYPE_OFFICER_CHAT = "officer_chat"
|
13
13
|
CHAT_MSG_TYPE_WHISPER = "whisper"
|
14
14
|
|
15
|
-
attr_reader :type,:body,:from_type,:character_id
|
16
|
-
|
15
|
+
attr_reader :type,:body,:from_type,:character_id
|
16
|
+
|
17
17
|
def initialize response
|
18
18
|
@type = response["messageType"]
|
19
19
|
@body = response['body']
|
20
20
|
@from = response["from"]
|
21
|
-
@
|
22
|
-
|
23
|
-
|
21
|
+
if @from
|
22
|
+
@from_type = from["chatIdType"]
|
23
|
+
@character_id = from["characterId"]
|
24
|
+
@character_name = from['characterName']
|
25
|
+
end
|
24
26
|
end
|
25
27
|
|
26
28
|
def character_name
|
@@ -51,12 +51,10 @@ module Warchat
|
|
51
51
|
|
52
52
|
def stage_1 response
|
53
53
|
proof = @srp.auth1_proof(response["user"], @password[0..15].upcase, response["salt"], response["B"])
|
54
|
-
puts("sending client proof: 0x#{@srp.unpack_int(proof).to_s(16)} length: #{proof.length}")
|
55
54
|
send_request(Request.new("/authenticate2",:clientProof=>proof))
|
56
55
|
end
|
57
56
|
|
58
57
|
def stage_2 response
|
59
|
-
puts("sending client proof2")
|
60
58
|
send_request(Request.new("/authenticate2",:clientProof=>Warchat::ByteString.new("\000")))
|
61
59
|
end
|
62
60
|
|
@@ -66,7 +64,6 @@ module Warchat
|
|
66
64
|
end
|
67
65
|
|
68
66
|
def connection_receive response
|
69
|
-
puts response.inspect
|
70
67
|
m = "stage_#{response['stage']}".to_sym
|
71
68
|
if response.ok?
|
72
69
|
respond_to? m and send(m,response) or on_receive.andand.call(response)
|
data/lib/warchat/version.rb
CHANGED
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:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Zachary Gavin
|