class Jabber::MUC::HipChat::Message

Public Class Methods

new(my_jid) click to toggle source
Calls superclass method
# File lib/xmpp4r/muc/hipchat/message.rb, line 5
def initialize my_jid
  super()
  @my_jid    = my_jid
  self.from  = my_jid
  @semaphore = Mutex.new
end

Public Instance Methods

add_recipient(jid) click to toggle source
# File lib/xmpp4r/muc/hipchat/message.rb, line 34
def add_recipient jid
  xmuc_user.add(XMUCUserInvite.new(jid))
end
get_invite(room_jid, recipient_jids) click to toggle source
# File lib/xmpp4r/muc/hipchat/message.rb, line 24
def get_invite room_jid, recipient_jids
  self.dup.tap do |d|
    d.to = JID.new(room_jid)

    recipient_jids.each do |recipient_jid|
      d.add_recipient(recipient_jid)
    end
  end
end
get_text(type, jid, text, subject = nil) click to toggle source
# File lib/xmpp4r/muc/hipchat/message.rb, line 12
def get_text type, jid, text, subject = nil
  self.dup.tap do |d|
    recipient = JID.new(jid)
    recipient.resource ||= recipient.node

    d.body    = text.to_s
    d.to      = recipient
    d.type    = type
    d.subject = subject if subject
  end
end
send_to(stream, &block) click to toggle source
# File lib/xmpp4r/muc/hipchat/message.rb, line 38
def send_to stream, &block
  Thread.new do
    @semaphore.synchronize {
      stream.send(self, &block)
      sleep(0.2)
    }
  end
end

Private Instance Methods

xmuc_user() click to toggle source
# File lib/xmpp4r/muc/hipchat/message.rb, line 49
def xmuc_user
  @xmuc_user ||= add(XMUCUser.new)
end