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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c42b291bd9f0f5a60b3e31398f2a9b396c247b1c
4
- data.tar.gz: 732a4875ef0aeb2405fe98ec96b06be4434831e9
3
+ metadata.gz: 7d8fadaf3983b7a15537ee5b4c8d2196908888c2
4
+ data.tar.gz: c2a53f6488c725aaaec29572949a8fd2a509d295
5
5
  SHA512:
6
- metadata.gz: f95b530fc7c66f77d65b3c711a24e3f781e9fd3f42a9036cf793d4d16f799646716ff739acfca021cb58e43d9ae595986663d48d1c9201d32574889a434e0b8e
7
- data.tar.gz: 49bdd9fb6e499368502a661fb815c45c735bd9fe5692d54bc622b3e4460bb93ccb3b9a95a96eafe44bc1a3609c7e9fe0ae005c5c03e5b2dc3b9fb01e05a4e6a4
6
+ metadata.gz: ab8191923f69f3f68e70dbd81d4a88f62edd3c240e8600cf046c7900da0250b7545c15fce83041597a3c7c716a657608adff9ecd3a87e459d341e952e5f3a2f1
7
+ data.tar.gz: 05f14ce478980a37e9e652df59b0a4802e88a09e0a7361c97a9d55e22152cd964d5bd38a57098924ea893e8f914e43c9e75ae83a19c1ec78ee1eee3a3aa1e84f
@@ -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
@@ -1,4 +1,4 @@
1
1
  module Robut # :nodoc:
2
2
  # Robut's version number.
3
- VERSION = "0.6.1"
3
+ VERSION = "0.6.2"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sclemmer-robut
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Weiss