Class: Jabber::Bytestreams::IqQueryBytestreams
- Inherits:
-
IqQuery
- Object
- REXML::Element
- XMPPElement
- IqQuery
- Jabber::Bytestreams::IqQueryBytestreams
- Defined in:
- lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb
Overview
Class for accessing <query/> elements with xmlns=‘jabber.org/protocol/bytestreams’ in <iq/> stanzas.
Instance Method Summary collapse
-
#activate ⇒ Object
- Get the text of the <activate/> child result
- JID
-
or [nil].
-
#activate=(s) ⇒ Object
- Set the text of the <activate/> child s
-
[JID].
-
#initialize(sid = nil, mode = nil) ⇒ IqQueryBytestreams
constructor
- Initialize such a <query/> sid
- String
- Session-ID mode
- Symbol
-
:tcp or :udp.
-
#mode ⇒ Object
- Transfer mode result
-
:tcp or :udp.
-
#mode=(m) ⇒ Object
- Set the transfer mode m
-
:tcp or :udp.
-
#sid ⇒ Object
Session-ID.
-
#sid=(s) ⇒ Object
Set Session-ID.
-
#streamhost_used ⇒ Object
- Get the <streamhost-used/> child result
-
[StreamHostUsed].
Methods inherited from XMPPElement
class_for_name_xmlns, #clone, force_xmlns, force_xmlns?, import, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=
Methods inherited from REXML::Element
#==, #delete_elements, #first_element, #first_element_text, #import, import, #replace_element_text, #typed_add
Constructor Details
#initialize(sid = nil, mode = nil) ⇒ IqQueryBytestreams
Initialize such a <query/>
- sid
- String
-
Session-ID
- mode
- Symbol
-
:tcp or :udp
20 21 22 23 24 |
# File 'lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 20 def initialize(sid=nil, mode=nil) super() self.sid = sid self.mode = mode end |
Instance Method Details
#activate ⇒ Object
Get the text of the <activate/> child
- result
- JID
-
or [nil]
68 69 70 71 |
# File 'lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 68 def activate j = first_element_text('activate') j ? JID.new(j) : nil end |
#activate=(s) ⇒ Object
Set the text of the <activate/> child
- s
- JID
76 77 78 |
# File 'lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 76 def activate=(s) replace_element_text('activate', s ? s.to_s : nil) end |
#mode ⇒ Object
Transfer mode
- result
-
:tcp or :udp
41 42 43 44 45 46 |
# File 'lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 41 def mode case attributes['mode'] when 'udp' then :udp else :tcp end end |
#mode=(m) ⇒ Object
Set the transfer mode
- m
-
:tcp or :udp
51 52 53 54 55 56 |
# File 'lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 51 def mode=(m) case m when :udp then attributes['mode'] = 'udp' else attributes['mode'] = 'tcp' end end |
#sid ⇒ Object
Session-ID
28 29 30 |
# File 'lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 28 def sid attributes['sid'] end |
#sid=(s) ⇒ Object
Set Session-ID
34 35 36 |
# File 'lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 34 def sid=(s) attributes['sid'] = s end |
#streamhost_used ⇒ Object
Get the <streamhost-used/> child
- result
- StreamHostUsed
61 62 63 |
# File 'lib/vendor/xmpp4r/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 61 def streamhost_used first_element('streamhost-used') end |