Method: AgentXmpp::Xmpp::IqPubSub.unsubscribe

Defined in:
lib/agent_xmpp/xmpp/iq_pubsub.rb

.unsubscribe(pipe, to, node) ⇒ Object

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



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/agent_xmpp/xmpp/iq_pubsub.rb', line 73

def unsubscribe(pipe, to, node)
  iq = Xmpp::Iq.new(:set, to)
  unsubscribe = REXML::Element.new('unsubscribe')
  unsubscribe.add_attribute('node', node) 
  unsubscribe.add_attribute('jid', AgentXmpp.jid.bare.to_s) 
  iq.pubsub = IqPubSub.new << unsubscribe
  Send(iq) do |r|
    if r.type == :result and r.kind_of?(Xmpp::Iq)
      pipe.broadcast_to_delegates(:on_pubsub_unsubscribe_result, pipe, r, node)
    elsif r.type.eql?(:error)
      pipe.broadcast_to_delegates(:on_pubsub_unsubscribe_error, pipe, r, node)
    end
  end     
end