lita-hipchat 2.1.2 → 2.1.3

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: c9866f280df3e2a042e8aa5db9502e4d05c78c68
4
- data.tar.gz: caae1fc32e071fc461ec73e83b5a2c22756239d8
3
+ metadata.gz: 3caf3e5aa475e362c0df849d97d9fb9aa6e357e9
4
+ data.tar.gz: ed234aaa8462ea9ef2879be9a107df398d5a90f0
5
5
  SHA512:
6
- metadata.gz: f51f92dbbd5a544442897173f039b6dc8ef6f60e0f746f507cf45f2a960c6df488673a4d10f477622f4ea5a3cbc7f780d89d30cdfe5d7579369ee37b1f368ccb
7
- data.tar.gz: 5f49d027252f71564514f37811872c84304e827e17d2ea243c9974ee9d9f5dfbe517606e8351a2d1ed03358a599b200e919c734c61ae73a2803bebf3e8d98b7e
6
+ metadata.gz: a31c0c64b0d43365ad850eb21e7b2a98b9a65ad333495c3147259e2e27742dade106900a91a4b33fcf44c5a119a9bd9d31c38c9cf564daf53aebe2fd30bfe370
7
+ data.tar.gz: 04616bc35f867a8116d81f27c36920493cac185b011fee812343c1cd0cf63c5c1766da88fffac25c9eb7f7f0bdf20aa8ff32119e2a1f3a8938942dfb1688a23b
@@ -43,9 +43,6 @@ module Lita
43
43
  robot.trigger(:connected)
44
44
  rooms.each { |r| join(r) }
45
45
  sleep
46
- rescue Errno::ECONNRESET => e
47
- Lita.logger.error(e)
48
- shut_down
49
46
  rescue Interrupt
50
47
  shut_down
51
48
  end
@@ -28,6 +28,7 @@ module Lita
28
28
  end
29
29
 
30
30
  def connect
31
+ register_exception_handler
31
32
  client_connect
32
33
  load_roster
33
34
  register_message_callback
@@ -114,6 +115,12 @@ module Lita
114
115
  client.auth(@password)
115
116
  end
116
117
 
118
+ def register_exception_handler
119
+ client.on_exception do |error, connection, error_source|
120
+ robot.shut_down
121
+ end
122
+ end
123
+
117
124
  def register_message_callback
118
125
  Callback.new(robot, roster).private_message(client)
119
126
  end
data/lita-hipchat.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "lita-hipchat"
3
- spec.version = "2.1.2"
3
+ spec.version = "2.1.3"
4
4
  spec.authors = ["Jimmy Cuadra"]
5
5
  spec.email = ["jimmy@jimmycuadra.com"]
6
6
  spec.description = %q{A HipChat adapter for Lita.}
@@ -9,6 +9,7 @@ describe Lita::Adapters::HipChat::Connector, lita: true do
9
9
  allow(client).to receive(:auth)
10
10
  allow(client).to receive(:connect)
11
11
  allow(client).to receive(:send)
12
+ allow(client).to receive(:on_exception)
12
13
  client
13
14
  end
14
15
 
@@ -97,6 +98,11 @@ describe Lita::Adapters::HipChat::Connector, lita: true do
97
98
  expect(robot).to receive(:mention_name=).with("LitaBot")
98
99
  subject.connect
99
100
  end
101
+
102
+ it "registers an error handler with the XMPP client" do
103
+ expect(client).to receive(:on_exception)
104
+ subject.connect
105
+ end
100
106
  end
101
107
 
102
108
  describe "#join" do
@@ -104,12 +104,6 @@ describe Lita::Adapters::HipChat, lita: true do
104
104
  allow(subject).to receive(:sleep).and_raise(Interrupt)
105
105
  subject.run
106
106
  end
107
-
108
- it "disconnects gracefully on connection reset" do
109
- expect(subject).to receive(:shut_down)
110
- allow(subject).to receive(:sleep).and_raise(Errno::ECONNRESET)
111
- subject.run
112
- end
113
107
  end
114
108
 
115
109
  describe "#send_messages" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-hipchat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Cuadra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-23 00:00:00.000000000 Z
11
+ date: 2015-05-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita