changeset 7:a8cfb31dc50c

Implemented fallback for feature-not-implemented. Implemented custom response for subscription options and node configuration not implemented.
author Ralph Meijer <ralphm@ik.nu>
date Sun, 27 Jun 2004 15:08:24 +0000
parents 76efc9114469
children 688992a789e4
files idavoll/pubsub.py
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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():