xrc 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2de0e6fa75cd6ef92723ae5e7afea87c23346914
4
- data.tar.gz: fd1d3a03131848e896522e27334f4ec6fd797dd7
3
+ metadata.gz: 7bdf50fc7db1a293a2ea1a4e4ff89843060339bf
4
+ data.tar.gz: 19b039f6249db2c307ab1be441f00267e9c63145
5
5
  SHA512:
6
- metadata.gz: ef49feca2de3f5f528412aa5db31c88cb3b01abf097fb2581b59644ed7805adc659d178b07b5211aa3fb0bce2aa3a36f7d0928dcd7268804a502c6c22d264ed7
7
- data.tar.gz: 90c77a1dc133024811f7fac90b6202ed0478b7a5ef830a51706ef8d45516defe1cb51060a7407d005884cb7bcffdf0c32e1907f127e6b310ca58bc68006a6742
6
+ metadata.gz: e27ee54faf8f8bbc91547f58cb6b50208660fbc82256e69ef8a40822174c482847d2d55da79f180d334996a6b968d41b75094a76f0e004c0ddd5620464c55c8a
7
+ data.tar.gz: a6135d4d3862f9dfd1a6cef147fba0c2de3de13dc5d8c9aabdba832c231d12e1d8bcf9be8d2275eee059ecd253da402ad6adbd6c37317d3d381791602de804ef
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.1.0
2
+ * Support comma-separated multi room JIDs
3
+
1
4
  ## 0.0.6
2
5
  * Add `Xrc::Messages::Base#delayed?` method
3
6
 
data/README.md CHANGED
@@ -12,7 +12,7 @@ client = Xrc::Client.new(
12
12
  nickname: "bot" # optional
13
13
  password: "xxx", # optional
14
14
  port: 5222, # optional, default: 5222
15
- room_jid: "bar@example.com", # optional
15
+ room_jid: "bar@example.com", # optional, you can pass comma-separated multi room JIDs
16
16
  )
17
17
 
18
18
  # Responds to "ping" and returns "pong".
data/lib/xrc/client.rb CHANGED
@@ -168,8 +168,13 @@ module Xrc
168
168
  @options[:port] || DEFAULT_PORT
169
169
  end
170
170
 
171
- def room_jid
172
- Jid.new("#{@options[:room_jid]}") if @options[:room_jid]
171
+ # @return [Array<Xrc::Jid>] An array of Room JIDs a client will log in
172
+ def room_jids
173
+ @room_jids ||= raw_room_jids.map {|raw| Jid.new(raw) }
174
+ end
175
+
176
+ def raw_room_jids
177
+ @options[:room_jid].try(:split, ",") || []
173
178
  end
174
179
 
175
180
  def connection
@@ -243,7 +248,7 @@ module Xrc
243
248
  end
244
249
 
245
250
  def on_connection_established
246
- join if room_jid
251
+ join
247
252
  start_ping_thread
248
253
  end
249
254
 
@@ -295,7 +300,9 @@ module Xrc
295
300
  end
296
301
 
297
302
  def join
298
- post(Elements::Join.new(from: jid.strip, to: "#{room_jid}/#{nickname}"))
303
+ room_jids.each do |room_jid|
304
+ post(Elements::Join.new(from: jid.strip, to: "#{room_jid}/#{nickname}"))
305
+ end
299
306
  end
300
307
 
301
308
  def ping
data/lib/xrc/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Xrc
2
- VERSION = "0.0.6"
2
+ VERSION = "0.1.0"
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.0.6
4
+ version: 0.1.0
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-06-07 00:00:00.000000000 Z
11
+ date: 2014-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport