comparison 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
comparison
equal deleted inserted replaced
374:40e5edd7ea11 375:9a787881b824
75 from wokkel import disco 75 from wokkel import disco
76 from wokkel import data_form 76 from wokkel import data_form
77 from wokkel import rsm 77 from wokkel import rsm
78 from wokkel import iwokkel 78 from wokkel import iwokkel
79 from wokkel import pubsub 79 from wokkel import pubsub
80 from wokkel.subprotocols import XMPPHandler
80 81
81 from sat_pubsub import error 82 from sat_pubsub import error
82 from sat_pubsub import iidavoll 83 from sat_pubsub import iidavoll
83 from sat_pubsub import const 84 from sat_pubsub import const
84 from sat_pubsub import container 85 from sat_pubsub import container
1661 ext_data['rsm'] = request.rsm 1662 ext_data['rsm'] = request.rsm
1662 try: 1663 try:
1663 ext_data['pep'] = request.delegated 1664 ext_data['pep'] = request.delegated
1664 except AttributeError: 1665 except AttributeError:
1665 pass 1666 pass
1667 ext_data['order_by'] = request.orderBy or []
1666 d = self.backend.getItems(request.nodeIdentifier, 1668 d = self.backend.getItems(request.nodeIdentifier,
1667 request.sender, 1669 request.sender,
1668 request.recipient, 1670 request.recipient,
1669 request.maxItems, 1671 request.maxItems,
1670 request.itemIdentifiers, 1672 request.itemIdentifiers,
1695 return d.addErrback(self._mapErrors) 1697 return d.addErrback(self._mapErrors)
1696 1698
1697 components.registerAdapter(PubSubResourceFromBackend, 1699 components.registerAdapter(PubSubResourceFromBackend,
1698 iidavoll.IBackendService, 1700 iidavoll.IBackendService,
1699 iwokkel.IPubSubResource) 1701 iwokkel.IPubSubResource)
1702
1703
1704
1705 class ExtraDiscoHandler(XMPPHandler):
1706 implements(iwokkel.IDisco)
1707 # see comment in twisted/plugins/pubsub.py
1708 # FIXME: upstream must be fixed so we can use custom (non pubsub#) disco features
1709
1710 def getDiscoInfo(self, requestor, service, nodeIdentifier=''):
1711 return [disco.DiscoFeature(pubsub.NS_ORDER_BY)]
1712
1713 def getDiscoItems(self, requestor, service, nodeIdentifier=''):
1714 return []