Mercurial > libervia-pubsub
comparison sat_pubsub/mam.py @ 431:5e8b8ef5c862
implentation of XEP-0346 (Form Discovery and Publishing):
The former non standard node schema has been replaced by XEP-0346 which uses 2 nodes (one
from schema/template and one for submitted values).
The implementation is an adapation of the former one, and data validation is still done
even if this is not currently specified in any XEP.
When the template node is modified, the change is reflected in the node schema.
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 11 Dec 2020 17:19:00 +0100 |
parents | ccb2a22ea0fc |
children | 91da42d44ea2 |
comparison
equal
deleted
inserted
replaced
430:5a0ada3b61ca | 431:5e8b8ef5c862 |
---|---|
27 | 27 |
28 from zope.interface import implementer | 28 from zope.interface import implementer |
29 | 29 |
30 from twisted.words.xish import domish | 30 from twisted.words.xish import domish |
31 from twisted.python import log | 31 from twisted.python import log |
32 from twisted.internet import defer | |
32 from twisted.words.protocols.jabber import error | 33 from twisted.words.protocols.jabber import error |
33 | 34 |
34 from sat_pubsub import const | 35 from sat_pubsub import const |
35 from sat_pubsub import backend | 36 from sat_pubsub import backend |
36 from wokkel import pubsub | 37 from wokkel import pubsub |
86 ext_data['rsm'] = mam_request.rsm | 87 ext_data['rsm'] = mam_request.rsm |
87 | 88 |
88 if mam_request.orderBy: | 89 if mam_request.orderBy: |
89 ext_data['order_by'] = mam_request.orderBy | 90 ext_data['order_by'] = mam_request.orderBy |
90 | 91 |
91 d = self.backend.getItemsData(mam_request.node, mam_request.sender, | 92 d = defer.ensureDeferred( |
93 self.backend.getItemsData(mam_request.node, mam_request.sender, | |
92 mam_request.recipient, None, None, ext_data) | 94 mam_request.recipient, None, None, ext_data) |
95 ) | |
93 | 96 |
94 def make_message(elt): | 97 def make_message(elt): |
95 # XXX: http://xmpp.org/extensions/xep-0297.html#sect-idp629952 (rule 3) | 98 # XXX: http://xmpp.org/extensions/xep-0297.html#sect-idp629952 (rule 3) |
96 message = domish.Element((const.NS_CLIENT, "message")) | 99 message = domish.Element((const.NS_CLIENT, "message")) |
97 event = message.addElement((pubsub.NS_PUBSUB_EVENT, "event")) | 100 event = message.addElement((pubsub.NS_PUBSUB_EVENT, "event")) |