Class: Jabber::Bytestreams::IqQueryBytestreams

Inherits:
IqQuery show all
Defined in:
lib/gems/xmpp4r-0.4/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

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/gems/xmpp4r-0.4/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

#activateObject

Get the text of the <activate/> child

result
JID

or [nil]



68
69
70
71
# File 'lib/gems/xmpp4r-0.4/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/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 76

def activate=(s)
  replace_element_text('activate', s ? s.to_s : nil)
end

#modeObject

Transfer mode

result

:tcp or :udp



41
42
43
44
45
46
# File 'lib/gems/xmpp4r-0.4/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/gems/xmpp4r-0.4/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

#sidObject

Session-ID



28
29
30
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 28

def sid
  attributes['sid']
end

#sid=(s) ⇒ Object

Set Session-ID



34
35
36
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 34

def sid=(s)
  attributes['sid'] = s
end

#streamhost_usedObject

Get the <streamhost-used/> child

result
StreamHostUsed


61
62
63
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 61

def streamhost_used
  first_element('streamhost-used')
end