Sha256: 2acbeb726da28239eec3cad0d5ebfeaadbc48a0bba3adcc27839d1137153f230
Contents?: true
Size: 947 Bytes
Versions: 24
Compression:
Stored size: 947 Bytes
Contents
module Blather # :nodoc: class Stream # :nodoc: class Session < Features # :nodoc: SESSION_NS = 'urn:ietf:params:xml:ns:xmpp-session'.freeze register SESSION_NS def initialize(stream, succeed, fail) super @to = @stream.jid.domain end def receive_data(stanza) @node = stanza case stanza.element_name when 'session' then session when 'iq' then check_response else fail!(UnknownResponse.new(stanza)) end end private def check_response if @node[:type] == 'result' succeed! else fail!(StanzaError.import(@node)) end end ## # Send a start session command def session response = Stanza::Iq.new :set response.to = @to response << (sess = XMPPNode.new('session', response.document)) sess.namespace = SESSION_NS @stream.send response end end end end
Version data entries
24 entries across 24 versions & 3 rubygems