Class Jabber::Discovery::Helper
In: lib/xmpp4r/discovery/helper/helper.rb
Parent: Object

A Helper to manage service and item discovery.

Methods

Public Class methods

[Source]

    # File lib/xmpp4r/discovery/helper/helper.rb, line 13
13:       def initialize(client)
14:         @stream = client
15:       end

Public Instance methods

Service discovery on a JID.

jid:[JID]
return:[Jabber::Discovery::IqQueryDiscoInfo]

[Source]

    # File lib/xmpp4r/discovery/helper/helper.rb, line 21
21:       def get_info_for(jid, node = nil)
22:         iq = Jabber::Iq.new(:get, jid)
23:         iq.from = @stream.jid
24:         disco = Jabber::Discovery::IqQueryDiscoInfo.new
25:         disco.node = node
26:         iq.add(disco)
27: 
28:         res = nil
29: 
30:         @stream.send_with_id(iq) { |reply|
31:           res = reply.query
32:         }
33: 
34:         res
35:       end

Item discovery on a JID.

jid:[JID]
return:[Jabber::Discovery::IqQueryDiscoItems]

[Source]

    # File lib/xmpp4r/discovery/helper/helper.rb, line 41
41:       def get_items_for(jid, node = nil)
42:         iq = Jabber::Iq.new(:get, jid)
43:         iq.from = @stream.jid
44:         disco = Jabber::Discovery::IqQueryDiscoItems.new
45:         disco.node = node
46:         iq.add(disco)
47: 
48:         res = nil
49: 
50:         @stream.send_with_id(iq) { |reply|
51:           res = reply.query
52:         }
53: 
54:         res
55:       end

[Validate]