Sha256: 3364e7d1d6dde5c6cebccf6f2a9c279d969688ad9089c94710eaaf6cf274bb81
Contents?: true
Size: 866 Bytes
Versions: 3
Compression:
Stored size: 866 Bytes
Contents
module Blather # :nodoc: module Stream # :nodoc: class Session # :nodoc: def initialize(stream, to) @stream = stream @to = to @callbacks = {} end def success(&callback) @callbacks[:success] = callback end def failure(&callback) @callbacks[:failure] = callback end def receive(node) @node = node __send__(@node.element_name == 'iq' ? @node['type'] : @node.element_name) end def session response = Stanza::Iq.new :set response.to = @to sess = XMPPNode.new 'session' sess['xmlns'] = 'urn:ietf:params:xml:ns:xmpp-session' response << sess @stream.send response end def result @callbacks[:success].call(@jid) if @callbacks[:success] end def error @callbacks[:failure].call if @callbacks[:failure] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
blather-0.1 | lib/blather/core/stream/session.rb |
blather-0.2.1 | lib/blather/stream/session.rb |
blather-0.2 | lib/blather/stream/session.rb |