# HG changeset patch # User Ralph Meijer # Date 1088348904 0 # Node ID a8cfb31dc50cdf203948daa0c0e62548a3eb87b1 # Parent 76efc9114469c4e06d37725f639c0e37611dcb9e Implemented fallback for feature-not-implemented. Implemented custom response for subscription options and node configuration not implemented. diff -r 76efc9114469 -r a8cfb31dc50c idavoll/pubsub.py --- a/idavoll/pubsub.py Sun Jun 27 15:07:11 2004 +0000 +++ b/idavoll/pubsub.py Sun Jun 27 15:08:24 2004 +0000 @@ -15,12 +15,13 @@ PUBSUB_SET = IQ_SET + PUBSUB_ELEMENT PUBSUB_CREATE = PUBSUB_SET + '/create' PUBSUB_PUBLISH = PUBSUB_SET + '/publish' +PUBSUB_OPTIONS_GET = PUBSUB_GET + '/options' +PUBSUB_CONFIGURE_GET = PUBSUB_GET + '/configure' error_map = { backend.NotAuthorized: 'not-authorized', backend.NodeNotFound: 'item-not-found', backend.NoPayloadAllowed: 'bad-request', - backend.EmptyPayloadExpected: 'bad-request', backend.PayloadExpected: 'bad-request', } @@ -31,6 +32,10 @@ self.backend = backend self.backend.pubsub_service = self self.addObserver(PUBSUB_PUBLISH, self.onPublish) + self.addObserver(PUBSUB_OPTIONS_GET, self.onOptionsGet) + self.addObserver(PUBSUB_CONFIGURE_GET, self.onConfigureGet) + self.addObserver(PUBSUB_GET, self.notImplemented, -1) + self.addObserver(PUBSUB_SET, self.notImplemented, -1) def componentConnected(self, xmlstream): xmlstream.addObserver(PUBSUB_SET, self.onPubSub) @@ -49,6 +54,9 @@ iq.children = [] return iq + def notImplemented(self, iq): + self.send(xmpp_error.error_from_iq(iq, 'feature-not-implemented')) + def onPubSub(self, iq): self.dispatch(iq) iq.handled = True @@ -68,6 +76,12 @@ d.addErrback(self.error, iq) d.addCallback(self.send) + def onOptionsGet(self, iq): + self.send(xmpp_error.error_from_iq(iq, 'feature-not-implemented', 'No subscriber options available')) + + def onConfigureGet(self, iq): + self.send(xmpp_error.error_from_iq(iq, 'feature-not-implemented', 'Node can not be configured')) + def do_notification(self, list, node): for recipient, items in list.items():