xmpp4r-robot 0.2.3 → 0.3.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/.travis.yml +1 -1
- data/CHANGES.md +5 -0
- data/README.md +1 -2
- data/Rakefile +1 -1
- data/lib/xmpp4r/robot.rb +28 -17
- data/xmpp4r-robot.gemspec +3 -3
- 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: 69eac4120f6899a7ab40501a1d063896d19226e2
|
4
|
+
data.tar.gz: 4b01c17230863ee3bb9e9055f6976ed09a3319f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a3ec3c5ca0ebb09f75cd10a2e49f687175f6e6dd7cd985c05610f0d9abe67be5d1032545798c94ad38ce7dea38e8823afc4e4ec98bdd2bdcb55e5afaa1aa8509
|
7
|
+
data.tar.gz: aabd4acc8b4fa67b4a45906209731379bdd7a45e15def5d6b79d61d62905864bbaf7aa1b7b58c0141ff49b72c16520daf30d8e8dd2ac166d9d692dd36b3ea089
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -20,7 +20,7 @@ This is an attempt to make it easy for such use cases.
|
|
20
20
|
|
21
21
|
## REQUIREMENTS:
|
22
22
|
|
23
|
-
* Tested with MRI (official CRuby)
|
23
|
+
* Tested with MRI (official CRuby), Rubinius and JRuby.
|
24
24
|
|
25
25
|
## INSTALLATION:
|
26
26
|
|
@@ -32,7 +32,6 @@ This is an attempt to make it easy for such use cases.
|
|
32
32
|
require 'xmpp4r/robot'
|
33
33
|
|
34
34
|
robot = Jabber::Robot.new('someone@gmail.com', 'awesome password',
|
35
|
-
:retry_time => 10,
|
36
35
|
:auto_accept_subscription => true)
|
37
36
|
|
38
37
|
robot.notify_presence do |from, status|
|
data/Rakefile
CHANGED
data/lib/xmpp4r/robot.rb
CHANGED
@@ -17,12 +17,14 @@ class Jabber::Robot
|
|
17
17
|
:away => Set.new,
|
18
18
|
:unavailable => Set.new}
|
19
19
|
|
20
|
-
@retry_time =
|
20
|
+
@retry_time = 1
|
21
21
|
@auto_accept_subscription = opts[:auto_accept_subscription]
|
22
22
|
|
23
23
|
@roster_mutex = Mutex.new
|
24
24
|
@helper_mutex = Mutex.new
|
25
|
-
@
|
25
|
+
@client_mutex = Mutex.new
|
26
|
+
@client = nil # eliminate warning
|
27
|
+
@sleeping = false
|
26
28
|
end
|
27
29
|
|
28
30
|
def inspect
|
@@ -41,16 +43,20 @@ class Jabber::Robot
|
|
41
43
|
#
|
42
44
|
# @api public
|
43
45
|
def start
|
44
|
-
|
45
|
-
|
46
|
-
@client
|
46
|
+
@client_mutex.synchronize do
|
47
|
+
@sleeping = false
|
48
|
+
if @client # restart
|
49
|
+
stop
|
50
|
+
@client = nil
|
51
|
+
end
|
52
|
+
initialize_callbacks
|
53
|
+
connect
|
54
|
+
login
|
55
|
+
available
|
56
|
+
roster
|
57
|
+
@retry_time = 1 # reset retry time after successfully connected
|
58
|
+
self
|
47
59
|
end
|
48
|
-
initialize_callbacks
|
49
|
-
connect
|
50
|
-
login
|
51
|
-
available
|
52
|
-
roster
|
53
|
-
self
|
54
60
|
end
|
55
61
|
|
56
62
|
def stop
|
@@ -134,14 +140,19 @@ class Jabber::Robot
|
|
134
140
|
next unless exp # why exp might be nil?
|
135
141
|
errback.call(exp) if errback
|
136
142
|
|
137
|
-
|
143
|
+
@client_mutex.synchronize do
|
144
|
+
@sleeping = true
|
145
|
+
@retry_time *= 2
|
138
146
|
|
139
|
-
|
140
|
-
|
147
|
+
$stderr.puts "ERROR: #{exp}: #{exp.backtrace}" +
|
148
|
+
" We'll sleep for #{retry_time} seconds and retry."
|
141
149
|
|
142
|
-
|
143
|
-
|
144
|
-
|
150
|
+
clear_roster_semaphore
|
151
|
+
Thread.new do
|
152
|
+
sleep(retry_time)
|
153
|
+
start
|
154
|
+
end
|
155
|
+
end unless @sleeping
|
145
156
|
end
|
146
157
|
|
147
158
|
client.add_presence_callback do |presence|
|
data/xmpp4r-robot.gemspec
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: xmpp4r-robot 0.
|
2
|
+
# stub: xmpp4r-robot 0.3.0 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "xmpp4r-robot"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.3.0"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib"]
|
10
10
|
s.authors = ["Lin Jen-Shin (godfat)"]
|
11
|
-
s.date = "2014-
|
11
|
+
s.date = "2014-04-08"
|
12
12
|
s.description = "Simple XMPP client built upon xmpp4r. Intended for building simple robots."
|
13
13
|
s.email = ["godfat (XD) godfat.org"]
|
14
14
|
s.files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xmpp4r-robot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lin Jen-Shin (godfat)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: xmpp4r
|