Method: Jabber::MUC::MUCClient#exit

Defined in:
lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucclient.rb

#exit(reason = nil) ⇒ Object

Exit the room

  • Sends presence with type=‘unavailable’ with an optional reason in <status/>,

  • then waits for a reply from the MUC component (will be processed by leave-callbacks),

  • then deletes callbacks from the stream.

reason
String

Optional custom exit message



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/vendor/xmpp4r/lib/xmpp4r/muc/helper/mucclient.rb', line 130

def exit(reason=nil)
  unless active?
    raise "MUCClient hasn't yet joined"
  end

  pres = Presence.new
  pres.type = :unavailable
  pres.to = jid
  pres.from = @my_jid
  pres.status = reason if reason
  @stream.send(pres) { |r|
    Jabber::debuglog "exit: #{r.to_s.inspect}"
    if r.kind_of?(Presence) and r.type == :unavailable and r.from == jid
      @leave_cbs.process(r)
      true
    else
      false
    end
  }

  deactivate

  self
end