Mercurial > libervia-pubsub
comparison idavoll/pubsub.py @ 47:31eb00734cc5
Check for malformed unsubscribe request.
author | Ralph Meijer <ralphm@ik.nu> |
---|---|
date | Wed, 03 Nov 2004 15:55:13 +0000 |
parents | c9ddca3cce20 |
children | 671ead538758 |
comparison
equal
deleted
inserted
replaced
46:979e53b54267 | 47:31eb00734cc5 |
---|---|
31 msg = '' | 31 msg = '' |
32 | 32 |
33 class NotImplemented(Error): | 33 class NotImplemented(Error): |
34 stanza_error = 'feature-not-implemented' | 34 stanza_error = 'feature-not-implemented' |
35 | 35 |
36 class BadRequest(Error): | |
37 stanza_error = 'bad-request' | |
38 | |
36 class OptionsUnavailable(Error): | 39 class OptionsUnavailable(Error): |
37 stanza_error = 'feature-not-implemented' | 40 stanza_error = 'feature-not-implemented' |
38 pubsub_error = 'subscription-options-unavailable' | 41 pubsub_error = 'subscription-options-unavailable' |
39 | 42 |
40 class SubscriptionOptionsUnavailable(Error): | 43 class SubscriptionOptionsUnavailable(Error): |
46 pubsub_error = 'node-not-configurable' | 49 pubsub_error = 'node-not-configurable' |
47 | 50 |
48 class CreateNodeNotConfigurable(Error): | 51 class CreateNodeNotConfigurable(Error): |
49 stanza_error = 'not-acceptable' | 52 stanza_error = 'not-acceptable' |
50 pubsub_error = 'node-not-configurable' | 53 pubsub_error = 'node-not-configurable' |
54 | |
55 | |
51 | 56 |
52 error_map = { | 57 error_map = { |
53 backend.NotAuthorized: ('not-authorized', None), | 58 backend.NotAuthorized: ('not-authorized', None), |
54 backend.NodeNotFound: ('item-not-found', None), | 59 backend.NodeNotFound: ('item-not-found', None), |
55 backend.NoPayloadAllowed: ('bad-request', None), | 60 backend.NoPayloadAllowed: ('bad-request', None), |
217 | 222 |
218 def onUnsubscribe(self, iq): | 223 def onUnsubscribe(self, iq): |
219 self.handler_wrapper(self._onUnsubscribe, iq) | 224 self.handler_wrapper(self._onUnsubscribe, iq) |
220 | 225 |
221 def _onUnsubscribe(self, iq): | 226 def _onUnsubscribe(self, iq): |
222 node_id = iq.pubsub.unsubscribe["node"] | 227 try: |
223 subscriber = jid.JID(iq.pubsub.unsubscribe["jid"]) | 228 node_id = iq.pubsub.unsubscribe["node"] |
229 jid = iq.pubsub.unsubscribe["jid"] | |
230 except KeyError: | |
231 raise BadRequest | |
232 | |
233 subscriber = jid.JID(jid) | |
224 requestor = jid.JID(iq["from"]).userhostJID() | 234 requestor = jid.JID(iq["from"]).userhostJID() |
225 return self.backend.unsubscribe(node_id, subscriber, requestor) | 235 return self.backend.unsubscribe(node_id, subscriber, requestor) |
226 | 236 |
227 def onOptionsGet(self, iq): | 237 def onOptionsGet(self, iq): |
228 self.handler_wrapper(self._onOptionsGet, iq) | 238 self.handler_wrapper(self._onOptionsGet, iq) |