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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9b53ee8e6f3b2c30f1f3d56972af60d64bab4b06
4
- data.tar.gz: f78c5786f129d2a8cafe2d8ca9cec08cabfcb4df
3
+ metadata.gz: 1f2c63cc74bafc1ffc668b140d15530675880580
4
+ data.tar.gz: d01f056f6639aa6b59323382386bc2a0e9ebfb92
5
5
  SHA512:
6
- metadata.gz: c9e1984194accae86de235939eb6b94e1a90b44b91a177c5d4b74229fe373146feb705d460ce384c86429b4ed451420c8ff5cd5171d749595dbd742dc7d387c8
7
- data.tar.gz: 2bcda5a0f6461a18ca3030191fca0dc09606c3040908f06906ab44d9c88be9bb5c61f49532499298b19289ad2f51850c63bc9299d7c0d4f0a74fa472ac6c74e1
6
+ metadata.gz: 24f786047c33186937c1c2082d4e37a56311e72132a7ef2c2e327265aef61b32d38c41a61fbea80eed0e0b549b99e7da66e57839401568173d2a02d7c7e660d1
7
+ data.tar.gz: 7132b012ec6ae47f5bcc7d5ac54fed8b674a9e743bcd14e35c3649dc89b1ab04265940de2ba21b5560e083a556e66fb376dcacd4b13aad97470721f76b5ad780
@@ -1,3 +1,6 @@
1
+ ## 0.1.4
2
+ * Add `on_connection_established` callback
3
+
1
4
  ## 0.1.3
2
5
  * Fix `room_name` method for invitation message
3
6
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Xrc
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
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.3
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-05 00:00:00.000000000 Z
11
+ date: 2014-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport