Class: Blather::Stanza::Iq::S5b
- Inherits:
-
Query
- Object
- Niceogiri::XML::Node
- XMPPNode
- Blather::Stanza
- Blather::Stanza::Iq
- Query
- Blather::Stanza::Iq::S5b
- Defined in:
- lib/blather/stanza/iq/s5b.rb
Overview
# SOCKS5 Bytestreams Stanza
[XEP-0065: SOCKS5 Bytestreams](xmpp.org/extensions/xep-0065.html)
Defined Under Namespace
Classes: StreamHost, StreamHostUsed
Constant Summary collapse
- NS_S5B =
'http://jabber.org/protocol/bytestreams'
Constants inherited from Blather::Stanza::Iq
Constants inherited from XMPPNode
Instance Attribute Summary
Attributes inherited from Blather::Stanza
Instance Method Summary collapse
-
#reply ⇒ Object
Overrides the parent method to remove query node.
-
#sid ⇒ String
Get the sid of the file transfer.
-
#streamhost_used ⇒ S5b::StreamHostUsed
Get the used streamhost.
-
#streamhost_used=(jid) ⇒ Object
Set the used streamhost.
-
#streamhosts ⇒ Array<S5b::StreamHost>
Get the streamhosts.
-
#streamhosts=(streamhosts) ⇒ Object
Set the streamhosts.
Methods inherited from Query
Methods inherited from Blather::Stanza::Iq
#error?, #get?, import, new, #reply!, #result?, #set?, #type=
Methods inherited from Blather::Stanza
#as_error, #error?, #from, #from=, handler_list, #id, #id=, #initialize, next_id, register, #reply!, #to, #to=, #type, #type=
Methods inherited from XMPPNode
class_from_registration, #decorate, decorator_modules, import, new, parse, register, #to_stanza
Constructor Details
This class inherits a constructor from Blather::Stanza
Instance Method Details
#reply ⇒ Object
Overrides the parent method to remove query node
18 19 20 21 22 |
# File 'lib/blather/stanza/iq/s5b.rb', line 18 def reply reply = super reply.remove_children :query reply end |
#sid ⇒ String
Get the sid of the file transfer
27 28 29 |
# File 'lib/blather/stanza/iq/s5b.rb', line 27 def sid query['sid'] end |
#streamhost_used ⇒ S5b::StreamHostUsed
Get the used streamhost
34 35 36 |
# 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) ⇒ Object
Set the used streamhost
41 42 43 44 45 46 47 |
# 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 ⇒ Array<S5b::StreamHost>
Get the streamhosts
52 53 54 55 56 |
# 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) ⇒ Object
Set the streamhosts
61 62 63 64 65 66 |
# 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 |