Class: Jabber::Bytestreams::StreamHost

Inherits:
REXML::Element show all
Defined in:
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 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


101
102
103
104
105
106
# File 'lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 101

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

Instance Method Details

#hostObject

Get the host address of the streamhost


122
123
124
# File 'lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 122

def host
  attributes['host']
end

#host=(h) ⇒ Object

Set the host address of the streamhost


128
129
130
# File 'lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 128

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

#jidObject

Get the JID of the streamhost


110
111
112
# File 'lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 110

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

#jid=(j) ⇒ Object

Set the JID of the streamhost


116
117
118
# File 'lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 116

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

#portObject

Get the port number of the streamhost


146
147
148
149
# File 'lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 146

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

#port=(p) ⇒ Object

Set the port number of the streamhost


153
154
155
# File 'lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 153

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

#zeroconfObject

Get the zeroconf attribute of the streamhost


134
135
136
# File 'lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 134

def zeroconf
  attributes['zeroconf']
end

#zeroconf=(s) ⇒ Object

Set the zeroconf attribute of the streamhost


140
141
142
# File 'lib/xmpp4r/bytestreams/iq/bytestreams.rb', line 140

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