module Jabber
module PubSub
#
class ServiceHelper
def get_subscriptions_from_new(node)
iq = basic_pubsub_query(:get, true)
entities = iq.pubsub.add(REXML::Element.new('subscriptions'))
entities.attributes['node'] = node
res = nil
@stream.send_with_id(iq) do |reply|
if reply.pubsub.first_element('subscriptions')
res = []
if reply.pubsub.first_element('subscriptions').attributes['node'] == node
reply.pubsub.first_element('subscriptions').each_element('subscription') do |subscription|
res << PubSub::Subscription.import(subscription)
end
end
end
true
end
res
end
end
end
end
service = 'pubsub.idlecampus.com'
@client = Jabber::Client.new("a@idlecampus.com")
Jabber::PubSub::ServiceHelper.new(@client, service)
doesnt seem to work.
ArgumentError: wrong number of arguments (2 for 0)
from (irb):8:in `initialize'
from (irb):8:in `new'
Below is how the class is defined in the library.
I am trying to add a new method get_subscriptions_from_new method in the class ServiceHelper.
module Jabber
module PubSub
class ServiceHelper
def initialize(stream, pubsubjid)
@stream = stream
@pubsubjid = pubsubjid
@event_cbs = CallbackList.new
@stream.add_message_callback(200,self) { |message|
handle_message(message)
}
end
end
end
I have ignored rest of the class here.