xrc 0.0.6 → 0.1.0
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/README.md +1 -1
- data/lib/xrc/client.rb +11 -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: 7bdf50fc7db1a293a2ea1a4e4ff89843060339bf
|
4
|
+
data.tar.gz: 19b039f6249db2c307ab1be441f00267e9c63145
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e27ee54faf8f8bbc91547f58cb6b50208660fbc82256e69ef8a40822174c482847d2d55da79f180d334996a6b968d41b75094a76f0e004c0ddd5620464c55c8a
|
7
|
+
data.tar.gz: a6135d4d3862f9dfd1a6cef147fba0c2de3de13dc5d8c9aabdba832c231d12e1d8bcf9be8d2275eee059ecd253da402ad6adbd6c37317d3d381791602de804ef
|
data/CHANGELOG.md
CHANGED
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
|
-
|
172
|
-
|
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
|
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
|
-
|
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
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
|
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-
|
11
|
+
date: 2014-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|