Method: Jabber::Caps::Helper#initialize

Defined in:
lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/helper.rb

#initialize(client, i = [], f = [], n = "http://home.gna.org/xmpp4r/##{Jabber::XMPP4R_VERSION}") ⇒ Helper

Construct a new Caps Helper.

This will send a <presence> message containing a <c/> (Jabber::Caps::C) stanza to your server.

client
Jabber::Stream
i
Array

of [Jabber::Discovery::Identity] objects that this entity will advertise

f
Array

of [Jabber::Discovery::Feature] objects that this entity will advertise

n
String

an identifier representing the software underlying this entity



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/vendor/xmpp4r/lib/xmpp4r/caps/helper/helper.rb', line 35

def initialize(client,i=[],f=[],n="http://home.gna.org/xmpp4r/##{Jabber::XMPP4R_VERSION}")
  @stream = client
  @identities = i
  @features = f
  @node = n

  @stream.add_iq_callback(250) do |iq|
    if iq.type == :get and iq.query.kind_of? Jabber::Discovery::IqQueryDiscoInfo
      Thread.new do
        Thread.abort_on_exception = true
        handle_discoinfo_query(iq)
      end
      true
    else
      false
    end
  end

  p = Jabber::Presence.new()
  p.add(c)
  @stream.send(p)
end