xrc 0.1.3 → 0.1.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/xrc/client.rb +16 -4
- data/lib/xrc/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f2c63cc74bafc1ffc668b140d15530675880580
|
4
|
+
data.tar.gz: d01f056f6639aa6b59323382386bc2a0e9ebfb92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24f786047c33186937c1c2082d4e37a56311e72132a7ef2c2e327265aef61b32d38c41a61fbea80eed0e0b549b99e7da66e57839401568173d2a02d7c7e660d1
|
7
|
+
data.tar.gz: 7132b012ec6ae47f5bcc7d5ac54fed8b674a9e743bcd14e35c3649dc89b1ab04265940de2ba21b5560e083a556e66fb376dcacd4b13aad97470721f76b5ad780
|
data/CHANGELOG.md
CHANGED
data/lib/xrc/client.rb
CHANGED
@@ -25,6 +25,18 @@ module Xrc
|
|
25
25
|
nil
|
26
26
|
end
|
27
27
|
|
28
|
+
# Registers a callback called when a client connected to server
|
29
|
+
# @yield Executes a given callback in the Client's context
|
30
|
+
# @return [Proc] Returns given block
|
31
|
+
# @example
|
32
|
+
# client.on_connection_established do
|
33
|
+
# puts "connection established!"
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
def on_connection_established(&block)
|
37
|
+
@on_connection_established_block = block
|
38
|
+
end
|
39
|
+
|
28
40
|
# Registers a callback called when client received a new private message (a.k.a. 1vs1 message)
|
29
41
|
# @yield Executes a given callback in the Client's context
|
30
42
|
# @yieldparam element [Xrc::Message] Represents a given message
|
@@ -129,6 +141,9 @@ module Xrc
|
|
129
141
|
end
|
130
142
|
|
131
143
|
private
|
144
|
+
def on_connection_established_block
|
145
|
+
@on_connection_established_block ||= ->() {}
|
146
|
+
end
|
132
147
|
|
133
148
|
def on_event_block
|
134
149
|
@on_event_block ||= ->(element) {}
|
@@ -266,12 +281,9 @@ module Xrc
|
|
266
281
|
def on_roster_received(element)
|
267
282
|
@users = Roster.new(element)
|
268
283
|
attend
|
269
|
-
on_connection_established
|
270
|
-
end
|
271
|
-
|
272
|
-
def on_connection_established
|
273
284
|
join(room_jids)
|
274
285
|
start_ping_thread
|
286
|
+
on_connection_established_block.call()
|
275
287
|
end
|
276
288
|
|
277
289
|
def features
|
data/lib/xrc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xrc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|