diff idavoll/pubsub.py @ 134:46453af6b0c3

Add a number of discovery features.
author Ralph Meijer <ralphm@ik.nu>
date Sun, 24 Apr 2005 17:46:18 +0000
parents 3d77f3808bfa
children d2c18d88f618
line wrap: on
line diff
--- a/idavoll/pubsub.py	Sun Apr 24 17:45:45 2005 +0000
+++ b/idavoll/pubsub.py	Sun Apr 24 17:46:18 2005 +0000
@@ -140,8 +140,7 @@
             info.append(disco.Identity('pubsub', 'generic',
                                        'Generic Pubsub Service'))
 
-            if self.backend.supports_publisher_affiliation():
-                info.append(disco.Feature(NS_PUBSUB + "#publisher-affiliation"))
+            info.append(disco.Feature(NS_PUBSUB + "#meta-data"))
 
             if self.backend.supports_outcast_affiliation():
                 info.append(disco.Feature(NS_PUBSUB + "#outcast-affiliation"))
@@ -149,6 +148,9 @@
             if self.backend.supports_persistent_items():
                 info.append(disco.Feature(NS_PUBSUB + "#persistent-items"))
 
+            if self.backend.supports_publisher_affiliation():
+                info.append(disco.Feature(NS_PUBSUB + "#publisher-affiliation"))
+
             return defer.succeed(info)
         else:
             try:
@@ -431,6 +433,14 @@
     def componentConnected(self, xmlstream):
         xmlstream.addObserver(PUBSUB_AFFILIATIONS, self.onAffiliations)
 
+    def get_disco_info(self, node):
+        info = []
+
+        if not node:
+            info.append(disco.Feature(NS_PUBSUB + "#retrieve-affiliations"))
+
+        return defer.succeed(info)
+
     def onAffiliations(self, iq):
         self.handler_wrapper(self._onAffiliations, iq)
 
@@ -517,6 +527,8 @@
 
         if not node:
             info.append(disco.Feature(NS_PUBSUB + "#delete-any"))
+            info.append(disco.Feature(NS_PUBSUB + "#retract-items"))
+            info.append(disco.Feature(NS_PUBSUB + "#purge-nodes"))
 
         return defer.succeed(info)
 
@@ -563,6 +575,14 @@
         self.backend.register_pre_delete(self._pre_delete)
         xmlstream.addObserver(PUBSUB_DELETE, self.onDelete)
 
+    def get_disco_info(self, node):
+        info = []
+
+        if not node:
+            info.append(disco.Feature(NS_PUBSUB + "#delete-nodes"))
+
+        return defer.succeed(info)
+
     def _pre_delete(self, node_id):
         d = self.backend.get_subscribers(node_id)
         d.addCallback(self._return_deferreds, node_id)