Commit 93fadbe0f36226d8c7e33bbde280a49c707e43e2
1 parent
55fcdbe2
Exists in
master
and in
1 other branch
added support for multiple xmpp rooms/users
Showing
1 changed file
with
8 additions
and
6 deletions
Show diff stats
app/models/notification_services/gtalk_service.rb
... | ... | @@ -10,14 +10,14 @@ class NotificationServices::GtalkService < NotificationService |
10 | 10 | :label => "Password" |
11 | 11 | }], |
12 | 12 | [:room_id, { |
13 | - :placeholder => "touser@example.com", | |
14 | - :label => "Send To User" | |
13 | + :placeholder => "touser@example.com, anotheruser@example.com", | |
14 | + :label => "Send To User(s)" | |
15 | 15 | }], |
16 | 16 | ] |
17 | 17 | |
18 | 18 | def check_params |
19 | 19 | if Fields.detect {|f| self[f[0]].blank? } |
20 | - errors.add :base, 'You must specify your Username, Password and To User' | |
20 | + errors.add :base, 'You must specify your Username, Password and To User(s)' | |
21 | 21 | end |
22 | 22 | end |
23 | 23 | |
... | ... | @@ -31,7 +31,9 @@ class NotificationServices::GtalkService < NotificationService |
31 | 31 | client.connect("talk.google.com") |
32 | 32 | client.auth(api_token) |
33 | 33 | |
34 | - # post the issue to the xmpp room | |
35 | - client.send(Jabber::Message.new(room_id, "[errbit] http://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{notification_description problem}")) | |
34 | + # post the issue to the xmpp room(s) | |
35 | + room_id.gsub(/ /i, ",").gsub(/;/i, ",").split(",").map(&:strip).reject(&:empty?).each do |room| | |
36 | + client.send(Jabber::Message.new(room, "[errbit] http://#{Errbit::Config.host}/apps/#{problem.app.id.to_s} #{notification_description problem}")) | |
37 | + end | |
36 | 38 | end |
37 | -end | |
38 | 39 | \ No newline at end of file |
40 | +end | ... | ... |