class Blather::Stanza::Iq::S5b

# SOCKS5 Bytestreams Stanza

[XEP-0065: SOCKS5 Bytestreams](xmpp.org/extensions/xep-0065.html)

@handler :s5b_open

Constants

NS_S5B

@private

Public Instance Methods

reply() click to toggle source

Overrides the parent method to remove query node

@see Blather::Stanza#reply

Calls superclass method Blather::Stanza#reply
# File lib/blather/stanza/iq/s5b.rb, line 18
def reply
  reply = super
  reply.remove_children :query
  reply
end
sid() click to toggle source

Get the sid of the file transfer

@return [String]

# File lib/blather/stanza/iq/s5b.rb, line 27
def sid
  query['sid']
end
streamhost_used() click to toggle source

Get the used streamhost

@return [S5b::StreamHostUsed]

# File lib/blather/stanza/iq/s5b.rb, line 34
def streamhost_used
  StreamHostUsed.new query.find_first('.//ns:streamhost-used', :ns => self.class.registered_ns)
end
streamhost_used=(jid) click to toggle source

Set the used streamhost

@param [Blather::JID, String, nil] jid the jid of the used streamhost

# File lib/blather/stanza/iq/s5b.rb, line 41
def streamhost_used=(jid)
  query.find('.//ns:streamhost-used', :ns => self.class.registered_ns).remove

  if jid
    query << StreamHostUsed.new(jid)
  end
end
streamhosts() click to toggle source

Get the streamhosts

@return [Array<S5b::StreamHost>]

# File lib/blather/stanza/iq/s5b.rb, line 52
def streamhosts
  query.find('.//ns:streamhost', :ns => self.class.registered_ns).map do |s|
    StreamHost.new s
  end
end
streamhosts=(streamhosts) click to toggle source

Set the streamhosts

@param streamhosts the array of streamhosts, passed directly to StreamHost.new

# File lib/blather/stanza/iq/s5b.rb, line 61
def streamhosts=(streamhosts)
  query.find('.//ns:streamhost', :ns => self.class.registered_ns).remove
  if streamhosts
    [streamhosts].flatten.each { |s| self.query << StreamHost.new(s) }
  end
end