sclemmer-robut 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/robut/connection.rb +18 -14
- data/lib/robut/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d8fadaf3983b7a15537ee5b4c8d2196908888c2
|
4
|
+
data.tar.gz: c2a53f6488c725aaaec29572949a8fd2a509d295
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ab8191923f69f3f68e70dbd81d4a88f62edd3c240e8600cf046c7900da0250b7545c15fce83041597a3c7c716a657608adff9ecd3a87e459d341e952e5f3a2f1
|
7
|
+
data.tar.gz: 05f14ce478980a37e9e652df59b0a4802e88a09e0a7361c97a9d55e22152cd964d5bd38a57098924ea893e8f914e43c9e75ae83a19c1ec78ee1eee3a3aa1e84f
|
data/lib/robut/connection.rb
CHANGED
@@ -80,6 +80,24 @@ class Robut::Connection
|
|
80
80
|
# enters an infinite loop. Any messages sent to the room will pass
|
81
81
|
# through all the included plugins.
|
82
82
|
def connect
|
83
|
+
reconnect
|
84
|
+
client.on_exception { sleep 5; reconnect }
|
85
|
+
trap_signals
|
86
|
+
self
|
87
|
+
end
|
88
|
+
|
89
|
+
# Send a message to all rooms.
|
90
|
+
def reply(*args, &block)
|
91
|
+
self.rooms.each do |room|
|
92
|
+
room.reply(*args, &block)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
# Does all the setup needed to connect to the jabber chat.
|
99
|
+
def reconnect
|
100
|
+
config.logger.info 'reconnect'
|
83
101
|
client.connect(config.host, config.port)
|
84
102
|
client.auth(config.password)
|
85
103
|
client.send(Jabber::Presence.new.set_type(:available))
|
@@ -94,22 +112,8 @@ class Robut::Connection
|
|
94
112
|
if self.config.enable_private_messaging
|
95
113
|
Robut::PM.new(self, rooms)
|
96
114
|
end
|
97
|
-
|
98
|
-
client.on_exception do
|
99
|
-
config.logger.error 'client.on_exception'
|
100
|
-
end
|
101
|
-
trap_signals
|
102
|
-
self
|
103
|
-
end
|
104
|
-
|
105
|
-
# Send a message to all rooms.
|
106
|
-
def reply(*args, &block)
|
107
|
-
self.rooms.each do |room|
|
108
|
-
room.reply(*args, &block)
|
109
|
-
end
|
110
115
|
end
|
111
116
|
|
112
|
-
private
|
113
117
|
# Since we're entering an infinite loop, we have to trap TERM and
|
114
118
|
# INT. If something like the Rdio plugin has started a server that
|
115
119
|
# has already trapped those signals, we want to run those signal
|
data/lib/robut/version.rb
CHANGED