diff idavoll/tap.py @ 222:698af5d720ad

Reshape Idavoll as a PubSubResource. PubSubResource is Wokkel's newer interface for building (parts of) XMPP publish-subscribe services and replaces the old interface of PubSubService. It is more flexible for adding new protocol, allows for node-as-code (providing a specific backend per node), and permits accepting requests for different entities (virtual hosts or PEP-like settings). This moves over the current backend to use the new interface, so new code for previously unsupported protocol can be added down the line.
author Ralph Meijer <ralphm@ik.nu>
date Sat, 16 Oct 2010 21:03:38 +0200
parents 479fc959af0e
children 0eafdced5f24
line wrap: on
line diff
--- a/idavoll/tap.py	Sat Oct 16 20:56:51 2010 +0200
+++ b/idavoll/tap.py	Sat Oct 16 21:03:38 2010 +0200
@@ -8,7 +8,8 @@
 from wokkel.component import Component
 from wokkel.disco import DiscoHandler
 from wokkel.generic import FallbackHandler, VersionHandler
-from wokkel.iwokkel import IPubSubService
+from wokkel.iwokkel import IPubSubResource
+from wokkel.pubsub import PubSubService
 
 from idavoll import __version__
 from idavoll.backend import BackendService
@@ -38,6 +39,8 @@
 
         self['jid'] = JID(self['jid'])
 
+
+
 def makeService(config):
     s = service.MultiService()
 
@@ -80,9 +83,12 @@
     VersionHandler('Idavoll', __version__).setHandlerParent(cs)
     DiscoHandler().setHandlerParent(cs)
 
-    ps = IPubSubService(bs)
+    resource = IPubSubResource(bs)
+    resource.hideNodes = config["hide-nodes"]
+    resource.serviceJID = config["jid"]
+
+    ps = PubSubService(resource)
     ps.setHandlerParent(cs)
-    ps.hideNodes = config["hide-nodes"]
-    ps.serviceJID = config["jid"]
+    resource.pubsubService = ps
 
     return s