Class: AgentXmpp::Xmpp::IqDiscoItems
- Defined in:
- lib/agent_xmpp/xmpp/iq_disco.rb
Overview
Class Method Summary collapse
-
.get(pipe, to = nil, node = nil) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.result(pipe, request) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.result_command_nodes(pipe, request) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
Instance Method Summary collapse
-
#items ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
#items=(its) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
Methods inherited from Element
#<<, class_for_name_xmlns, #clone, import, #initialize, name_xmlns, name_xmlns_for_class, #parent=, #set_xml_lang, #typed_add, #xml_lang, #xml_lang=, xmpp_attribute, xmpp_child
Methods inherited from REXML::Element
#delete_elements, #first_element, #first_element_text, #import, import, #replace_element_text, #typed_add
Constructor Details
This class inherits a constructor from AgentXmpp::Xmpp::Element
Class Method Details
.get(pipe, to = nil, node = nil) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/agent_xmpp/xmpp/iq_disco.rb', line 19 def get(pipe, to=nil, node=nil) iq = Iq.new(:get, to) iq.query = new iq.query.node = node if node Send(iq) do |r| if (r.type == :result) && r.query.kind_of?(Xmpp::IqDiscoItems) pipe.broadcast_to_delegates(:on_discoitems_result, pipe, r) elsif r.type.eql?(:error) pipe.broadcast_to_delegates(:on_discoitems_error, pipe, r) end end end |
.result(pipe, request) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
33 34 35 36 37 38 |
# File 'lib/agent_xmpp/xmpp/iq_disco.rb', line 33 def result(pipe, request) iq = Xmpp::Iq.new(:result, request.from.to_s) iq.id = request.id unless request.id.nil? iq.query = new Send(iq) end |
.result_command_nodes(pipe, request) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
41 42 43 44 45 46 47 48 49 |
# File 'lib/agent_xmpp/xmpp/iq_disco.rb', line 41 def result_command_nodes(pipe, request) from_jid = request.from.to_s iq = Xmpp::Iq.new(:result, from_jid) iq.id = request.id unless request.id.nil? iq.query = new iq.query.node = 'http://jabber.org/protocol/commands' iq.query.items = BaseController.command_nodes(from_jid).map{|n| {:node => n, :name => n.humanize, :jid => AgentXmpp.jid.to_s}} Send(iq) end |
Instance Method Details
#items ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
55 56 57 |
# File 'lib/agent_xmpp/xmpp/iq_disco.rb', line 55 def items elements.to_a('item') end |