Class: Vines::Stanza::PubSub::Unsubscribe
- Inherits:
-
Vines::Stanza::PubSub
- Object
- Vines::Stanza
- Iq
- Vines::Stanza::PubSub
- Vines::Stanza::PubSub::Unsubscribe
- Defined in:
- lib/vines/stanza/pubsub/unsubscribe.rb
Constant Summary collapse
- NS =
NAMESPACES[:pubsub]
Constants inherited from Iq
Constants inherited from Vines::Stanza
Instance Attribute Summary
Attributes inherited from Vines::Stanza
Instance Method Summary collapse
Methods inherited from Iq
Methods inherited from Vines::Stanza
#broadcast, from_node, #initialize, #local?, #local_jid?, #method_missing, register, #route, #router, #send_unavailable, #storage, #to_pubsub_domain?, #unavailable, #validate_from, #validate_to
Constructor Details
This class inherits a constructor from Vines::Stanza
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Vines::Stanza
Instance Method Details
#process ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vines/stanza/pubsub/unsubscribe.rb', line 11 def process return if route_iq || !allowed? validate_to_address node = self.xpath('ns:pubsub/ns:unsubscribe', 'ns' => NS) raise StanzaErrors::BadRequest.new(self, 'modify') if node.size != 1 node = node.first id, jid = node['node'], JID.new(node['jid']) raise StanzaErrors::Forbidden.new(self, 'auth') unless stream.user.jid. == jid. raise StanzaErrors::ItemNotFound.new(self, 'cancel') unless pubsub.node?(id) raise StanzaErrors::UnexpectedRequest.new(self, 'cancel') unless pubsub.subscribed?(id, jid) pubsub.unsubscribe(id, jid) stream.write(to_result) end |