Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Commit

Permalink
temporarily disable jabber muc hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Jun 29, 2011
1 parent e777929 commit fbc51c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
12 changes: 11 additions & 1 deletion services/jabber.rb
Expand Up @@ -28,7 +28,7 @@ def join(jid, password=nil)
end

class Service::Jabber < Service
string :user, :muc
string :user

def receive_push
# Accept any friend request
Expand All @@ -42,9 +42,19 @@ def receive_push
messages += commit_messages
message = messages.join("\n")

deliver_messages(message, recipients)

# temporarily disabled
#deliver_muc(message, conferences) if !conferences.empty?
end

def deliver_messages(message, recipients)
recipients.each do |recipient|
im.deliver_deferred recipient, message, :chat
end
end

def deliver_muc(message, conferences)
conferences.each do |conference|
muc = mucs[conference]
muc ||= mucs[conference] = ::Jabber::MUC::MUCClient.new(im.client)
Expand Down
18 changes: 9 additions & 9 deletions test/jabber_test.rb
Expand Up @@ -45,17 +45,17 @@ def test_push
assert_equal 'c', msg[0]
assert_equal :chat, msg[2]

assert msg = svc.im.delivered.shift
assert_equal 'e', msg[0]
assert_equal :groupchat, msg[2]
#assert msg = svc.im.delivered.shift
#assert_equal 'e', msg[0]
#assert_equal :groupchat, msg[2]

assert msg = svc.im.delivered.shift
assert_equal 'f', msg[0]
assert_equal :groupchat, msg[2]
#assert msg = svc.im.delivered.shift
#assert_equal 'f', msg[0]
#assert_equal :groupchat, msg[2]

assert msg = svc.im.delivered.shift
assert_equal 'g', msg[0]
assert_equal :groupchat, msg[2]
#assert msg = svc.im.delivered.shift
#assert_equal 'g', msg[0]
#assert_equal :groupchat, msg[2]

assert_nil svc.im.delivered.shift
end
Expand Down

3 comments on commit fbc51c6

@bbhoss
Copy link
Contributor

@bbhoss bbhoss commented on fbc51c6 Apr 17, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this disabled? I would like to be able to send to MUCs.

@technoweenie
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It keeps muc references in a global @@mucs class var. I'd like to have something that wasn't a memory leak.

@bbhoss
Copy link
Contributor

@bbhoss bbhoss commented on fbc51c6 Apr 18, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if there is a reason it stays active? It seems like it could just hop in, post the messages, and leave. Do you see any problems with that?

Please sign in to comment.