lita-hipchat 1.4.0 → 1.5.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/README.md +1 -0
- data/lib/lita/adapters/hipchat/callback.rb +3 -2
- data/lita-hipchat.gemspec +1 -1
- data/spec/lita/adapters/hipchat/callback_spec.rb +7 -0
- 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: 3afeeed54c6b3093fd68a764bdda47a6d925ce4e
|
4
|
+
data.tar.gz: 4bc84ba99ea9bf19751559e8532e8d2d2816da21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af847c34127057fe05a209e1f3131887f18b7b04da82472f15af56dbb4c893106fc77abc10650fd72530a8cb0cf680795de6a9b3dfd8dfea07458488e31389dd
|
7
|
+
data.tar.gz: 80c197bae7c7b5d1740b82b16e45bacd9115481892dd498acff094a3214e25a14468331f533b131da0a8b8554c1105c7a7dc42fae3e52dfb31ba333193630af8
|
data/README.md
CHANGED
@@ -28,6 +28,7 @@ Values for all of the following attributes can be found on the "XMPP/Jabber info
|
|
28
28
|
* `debug` (Boolean) - If `true`, turns on the underlying Jabber library's (xmpp4r) logger, which is fairly verbose. Default: `false`.
|
29
29
|
* `rooms` (Symbol, Array<String>) - An array of room JIDs that Lita should join upon connection. Can also be the symbol `:all`, which will cause Lita to discover and join all rooms. Default: `nil` (no rooms).
|
30
30
|
* `muc_domain` (String) - The XMPP Multi-User Chat domain to use. Default: `"conf.hipchat.com"`.
|
31
|
+
* `ignore_unknown_users` (Boolean) - Messages generated through HipChat's API which don't come from a real user account will be ignored by the robot. With the default setting of false, Lita will emit a warning but the message will be dispatched to any registered handlers as usual. Default: `false`.
|
31
32
|
|
32
33
|
**Note: You must set the robot's name to the value shown as "Room nickname" on the XMPP settings page.**
|
33
34
|
|
@@ -24,6 +24,7 @@ module Lita
|
|
24
24
|
def muc_message(muc)
|
25
25
|
muc.on_message do |time, nick, text|
|
26
26
|
user = user_by_name(nick)
|
27
|
+
return unless user
|
27
28
|
source = Source.new(user: user, room: muc.jid.bare.to_s)
|
28
29
|
message = Message.new(robot, text, source)
|
29
30
|
Lita.logger.debug(
|
@@ -62,8 +63,8 @@ module Lita
|
|
62
63
|
items = roster.items.detect { |jid, item| item.iname == name }
|
63
64
|
if items
|
64
65
|
user_by_jid(items.first)
|
65
|
-
|
66
|
-
Lita.logger.warn <<-MSG
|
66
|
+
elsif !Lita.config.adapter.ignore_unknown_users
|
67
|
+
Lita.logger.warn <<-MSG.chomp
|
67
68
|
No user with the name #{name.inspect} was found in the roster. The message may
|
68
69
|
have been generated from the HipChat API. A temporary user has been created for
|
69
70
|
this message, but Lita will not be able to reply.
|
data/lita-hipchat.gemspec
CHANGED
@@ -92,6 +92,13 @@ describe Lita::Adapters::HipChat::Callback, lita: true do
|
|
92
92
|
expect(robot).to receive(:receive).with(message)
|
93
93
|
subject.muc_message(muc)
|
94
94
|
end
|
95
|
+
|
96
|
+
it "ignores messages from unknown users if the config for it is set" do
|
97
|
+
Lita.config.adapter.ignore_unknown_users = true
|
98
|
+
allow(muc).to receive(:on_message).and_yield(nil, "Unknown", "foo")
|
99
|
+
expect(robot).not_to receive(:receive)
|
100
|
+
subject.muc_message(muc)
|
101
|
+
end
|
95
102
|
end
|
96
103
|
|
97
104
|
describe "#roster_update" 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: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jimmy Cuadra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|