Class Jabber::Bytestreams::IqQueryBytestreams
In: lib/xmpp4r/bytestreams/iq/bytestreams.rb
Parent: IqQuery

Class for accessing <query/> elements with xmlns=‘jabber.org/protocol/bytestreams’ in <iq/> stanzas.

Methods

activate   activate=   mode   mode=   new   sid   sid=   streamhost_used   typed_add  

Constants

NS_BYTESTREAMS = 'http://jabber.org/protocol/bytestreams'

Public Class methods

Initialize such a <query/>

sid:[String] Session-ID
mode:[Symbol] :tcp or :udp

[Source]

    # File lib/xmpp4r/bytestreams/iq/bytestreams.rb, line 18
18:       def initialize(sid=nil, mode=nil)
19:         super()
20:         add_namespace(IqQueryBytestreams::NS_BYTESTREAMS)
21:         self.sid = sid
22:         self.mode = mode
23:       end

Public Instance methods

Get the text of the <activate/> child

result:[JID] or [nil]

[Source]

    # File lib/xmpp4r/bytestreams/iq/bytestreams.rb, line 77
77:       def activate
78:         j = first_element_text('activate')
79:         j ? JID.new(j) : nil
80:       end

Set the text of the <activate/> child

s:[JID]

[Source]

    # File lib/xmpp4r/bytestreams/iq/bytestreams.rb, line 85
85:       def activate=(s)
86:         replace_element_text('activate', s ? s.to_s : nil)
87:       end

Transfer mode

result::tcp or :udp

[Source]

    # File lib/xmpp4r/bytestreams/iq/bytestreams.rb, line 50
50:       def mode
51:         case attributes['mode']
52:           when 'udp' then :udp
53:           else :tcp
54:         end
55:       end

Set the transfer mode

m::tcp or :udp

[Source]

    # File lib/xmpp4r/bytestreams/iq/bytestreams.rb, line 60
60:       def mode=(m)
61:         case m
62:           when :udp then attributes['mode'] = 'udp'
63:           else attributes['mode'] = 'tcp'
64:         end
65:       end

Session-ID

[Source]

    # File lib/xmpp4r/bytestreams/iq/bytestreams.rb, line 37
37:       def sid
38:         attributes['sid']
39:       end

Set Session-ID

[Source]

    # File lib/xmpp4r/bytestreams/iq/bytestreams.rb, line 43
43:       def sid=(s)
44:         attributes['sid'] = s
45:       end

Get the <streamhost-used/> child

result:[StreamHostUsed]

[Source]

    # File lib/xmpp4r/bytestreams/iq/bytestreams.rb, line 70
70:       def streamhost_used
71:         first_element('streamhost-used')
72:       end

[Source]

    # File lib/xmpp4r/bytestreams/iq/bytestreams.rb, line 25
25:       def typed_add(xe)
26:         if xe.kind_of?(REXML::Element) and xe.name == 'streamhost'
27:           super StreamHost.new.import(xe)
28:         elsif xe.kind_of?(REXML::Element) and xe.name == 'streamhost-used'
29:           super StreamHostUsed.new.import(xe)
30:         else
31:           super xe
32:         end
33:       end

[Validate]