Class: AgentXmpp::Service
Overview
Class Method Summary collapse
-
.has_disco_info?(jid) ⇒ Boolean
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.has_disco_items?(jid) ⇒ Boolean
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.has_jid?(jid) ⇒ Boolean
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.service_features ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.service_items ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.services(renew = false) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.update(disco_iq) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.update_with_disco_info(disco_iq) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
-
.update_with_disco_items(disco_iq) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
Class Method Details
.has_disco_info?(jid) ⇒ Boolean
.….….….….….….….….….….….….….….….….….….….….….….….….….….
40 41 42 |
# File 'lib/agent_xmpp/models/service.rb', line 40 def has_disco_info?(jid) services.filter(:jid => jid.to_s).count > 0 end |
.has_disco_items?(jid) ⇒ Boolean
.….….….….….….….….….….….….….….….….….….….….….….….….….….
45 46 47 |
# File 'lib/agent_xmpp/models/service.rb', line 45 def has_disco_items?(jid) service_items.filter(:service => jid.to_s).count > 0 end |
.has_jid?(jid) ⇒ Boolean
.….….….….….….….….….….….….….….….….….….….….….….….….….….
35 36 37 |
# File 'lib/agent_xmpp/models/service.rb', line 35 def has_jid?(jid) services.filter(:jid => jid.to_s).count > 0 end |
.service_features ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
21 22 23 |
# File 'lib/agent_xmpp/models/service.rb', line 21 def service_features @service_features ||= AgentXmpp.in_memory_db[:service_features] end |
.service_items ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
16 17 18 |
# File 'lib/agent_xmpp/models/service.rb', line 16 def service_items @service_items ||= AgentXmpp.in_memory_db[:service_items] end |
.services(renew = false) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
11 12 13 |
# File 'lib/agent_xmpp/models/service.rb', line 11 def services(renew=false) @services ||= AgentXmpp.in_memory_db[:services] end |
.update(disco_iq) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
26 27 28 29 30 31 32 |
# File 'lib/agent_xmpp/models/service.rb', line 26 def update(disco_iq) disco = disco_iq.query case disco when AgentXmpp::Xmpp::IqDiscoInfo then update_with_disco_info(disco_iq) when AgentXmpp::Xmpp::IqDiscoItems then update_with_disco_items(disco_iq) end end |
.update_with_disco_info(disco_iq) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….…. private .….….….….….….….….….….….….….….….….….….….….….….….….….….
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/agent_xmpp/models/service.rb', line 52 def update_with_disco_info(disco_iq) disco, service = disco_iq.query, disco_iq.from.to_s node = disco.node disco.identities.each do |i| begin services << {:node => node, :jid => service, :category => i.category, :type => i.type, :name => i.iname} rescue end end disco.features.each do |f| begin service_features << {:node => node, :service => service, :var => f.var} rescue end end end |
.update_with_disco_items(disco_iq) ⇒ Object
.….….….….….….….….….….….….….….….….….….….….….….….….….….
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/agent_xmpp/models/service.rb', line 70 def update_with_disco_items(disco_iq) disco, service = disco_iq.query, disco_iq.from.to_s parent_node = disco.node disco.items.each do |i| begin service_items << {:parent_node => parent_node, :service => service, :node => i.node, :jid => i.jid.to_s, :name => i.iname} rescue end end end |