Sha256: a2f4dc934cfb5a145b5b92f16a578c59974bd2bad95be69e598e3f841fdd2c3a
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
module Blather # :nodoc: class Stream # :nodoc: class Resource < StreamHandler # :nodoc: def initialize(stream, jid) super stream @jid = jid end private ## # Respond to the bind request # If @jid has a resource set already request it from the server def bind response = Stanza::Iq.new :set @id = response.id binder = XMPPNode.new('bind') binder.namespace = 'urn:ietf:params:xml:ns:xmpp-bind' binder << XMPPNode.new('resource', @jid.resource) if @jid.resource response << binder @stream.send response end ## # Process the result from the server # Sets the sends the JID (now bound to a resource) # back to the stream def result LOG.debug "RESOURE NODE #{@node}" # ensure this is a response to our original request if @id == @node['id'] @jid = JID.new @node.find_first('bind/jid').content success @jid end end ## # Server returned an error def error failure StanzaError.import(@node) end end #Resource end #Stream end #Blather
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
sprsquish-blather-0.2.3 | lib/blather/stream/resource.rb |
blather-0.2.2 | lib/blather/stream/resource.rb |
blather-0.2.3 | lib/blather/stream/resource.rb |