Class: Jabber::Bytestreams::StreamHost

Inherits:
XMPPElement show all
Defined in:
lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb

Overview

<streamhost/> element, normally appear as children of IqQueryBytestreams

Direct Known Subclasses

SOCKS5BytestreamsServerStreamHost

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(jid = nil, host = nil, port = nil) ⇒ StreamHost

Initialize a <streamhost/> element

jid
JID
host
String

Hostname or IP address

port
Fixnum

Port number



93
94
95
96
97
98
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 93

def initialize(jid=nil, host=nil, port=nil)
  super()
  self.jid = jid
  self.host = host
  self.port = port
end

Instance Method Details

#hostObject

Get the host address of the streamhost



114
115
116
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 114

def host
  attributes['host']
end

#host=(h) ⇒ Object

Set the host address of the streamhost



120
121
122
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 120

def host=(h)
  attributes['host'] = h
end

#jidObject

Get the JID of the streamhost



102
103
104
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 102

def jid
  (a = attributes['jid']) ? JID.new(a) : nil
end

#jid=(j) ⇒ Object

Set the JID of the streamhost



108
109
110
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 108

def jid=(j)
  attributes['jid'] = (j ? j.to_s : nil)
end

#portObject

Get the port number of the streamhost



138
139
140
141
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 138

def port
  p = attributes['port'].to_i
  (p == 0 ? nil : p)
end

#port=(p) ⇒ Object

Set the port number of the streamhost



145
146
147
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 145

def port=(p)
  attributes['port'] = p.to_s
end

#zeroconfObject

Get the zeroconf attribute of the streamhost



126
127
128
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 126

def zeroconf
  attributes['zeroconf']
end

#zeroconf=(s) ⇒ Object

Set the zeroconf attribute of the streamhost



132
133
134
# File 'lib/gems/xmpp4r-0.4/lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 132

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