diff src/backend.py @ 375:9a787881b824

implemented Order-By ProtoXEP (MAM + PubSub)
author Goffi <goffi@goffi.org>
date Sun, 06 Jan 2019 17:29:50 +0100
parents dabee42494ac
children ded7657b03fa
line wrap: on
line diff
--- a/src/backend.py	Thu Jan 03 20:31:03 2019 +0100
+++ b/src/backend.py	Sun Jan 06 17:29:50 2019 +0100
@@ -77,6 +77,7 @@
 from wokkel import rsm
 from wokkel import iwokkel
 from wokkel import pubsub
+from wokkel.subprotocols import XMPPHandler
 
 from sat_pubsub import error
 from sat_pubsub import iidavoll
@@ -1663,6 +1664,7 @@
             ext_data['pep'] = request.delegated
         except AttributeError:
             pass
+        ext_data['order_by'] = request.orderBy or []
         d = self.backend.getItems(request.nodeIdentifier,
                                   request.sender,
                                   request.recipient,
@@ -1697,3 +1699,16 @@
 components.registerAdapter(PubSubResourceFromBackend,
                            iidavoll.IBackendService,
                            iwokkel.IPubSubResource)
+
+
+
+class ExtraDiscoHandler(XMPPHandler):
+    implements(iwokkel.IDisco)
+    # see comment in twisted/plugins/pubsub.py
+    # FIXME: upstream must be fixed so we can use custom (non pubsub#) disco features
+
+    def getDiscoInfo(self, requestor, service, nodeIdentifier=''):
+        return [disco.DiscoFeature(pubsub.NS_ORDER_BY)]
+
+    def getDiscoItems(self, requestor, service, nodeIdentifier=''):
+        return []