Class: AgentXmpp::Xmpp::IqDiscoInfo

Inherits:
IqQuery show all
Defined in:
lib/agent_xmpp/xmpp/iq_disco.rb

Overview


Class Method Summary collapse

Instance Method Summary collapse

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

.….….….….….….….….….….….….….….….….….….….….….….….….….….



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/agent_xmpp/xmpp/iq_disco.rb', line 78

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::IqDiscoInfo)
      pipe.broadcast_to_delegates(:on_discoinfo_result, pipe, r)
    elsif r.type.eql?(:error)
      pipe.broadcast_to_delegates(:on_discoinfo_error, pipe, r)
    end
  end
end

.result(pipe, request) ⇒ Object

.….….….….….….….….….….….….….….….….….….….….….….….….….….



92
93
94
95
96
97
98
99
# File 'lib/agent_xmpp/xmpp/iq_disco.rb', line 92

def result(pipe, request)
  iq = Xmpp::Iq.new(:result, request.from.to_s)
  iq.id = request.id unless request.id.nil?
  iq.query = IqDiscoInfo.new
  iq.query << DiscoIdentity.new(AgentXmpp::IDENTITY[:category], AgentXmpp::IDENTITY[:name], AgentXmpp::IDENTITY[:type])
  iq.query.features = AgentXmpp::FEATURES
  Send(iq)
end

Instance Method Details

#featuresObject

.….….….….….….….….….….….….….….….….….….….….….….….….….….



110
111
112
# File 'lib/agent_xmpp/xmpp/iq_disco.rb', line 110

def features
  elements.to_a('feature')
end

#features=(feats) ⇒ Object

.….….….….….….….….….….….….….….….….….….….….….….….….….….



115
116
117
# File 'lib/agent_xmpp/xmpp/iq_disco.rb', line 115

def features=(feats)
  feats.each{|f| self << DiscoFeature.new(f)}
end

#identitiesObject

.….….….….….….….….….….….….….….….….….….….….….….….….….….



105
106
107
# File 'lib/agent_xmpp/xmpp/iq_disco.rb', line 105

def identities
  elements.to_a('identity')
end