Mercurial > sat_tmp
changeset 85:ba3f695fff34
wokkel(rsm): add RSM and Pubsub RSM features to disco
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 25 Jan 2022 18:53:37 +0100 |
parents | 896e76caa204 |
children | 636d48c2b77a |
files | sat_tmp/wokkel/rsm.py |
diffstat | 1 files changed, 13 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/sat_tmp/wokkel/rsm.py Tue Jan 25 18:53:06 2022 +0100 +++ b/sat_tmp/wokkel/rsm.py Tue Jan 25 18:53:37 2022 +0100 @@ -27,12 +27,14 @@ from twisted.words.xish import domish from twisted.words.protocols.jabber import error +from wokkel import disco from . import pubsub import copy NS_RSM = 'http://jabber.org/protocol/rsm' +NS_PUBSUB_RSM = "http://jabber.org/protocol/pubsub#rsm" class RSMError(error.StanzaError): @@ -424,5 +426,16 @@ return response + def getDiscoInfo(self, requestor, target, nodeIdentifier=''): + def appendRSMFeatures(info): + for ns in (NS_RSM, NS_PUBSUB_RSM): + feature = disco.DiscoFeature(ns) + if feature not in info: + info.append(feature) + return info + d = super().getDiscoInfo(requestor, target, nodeIdentifier) + d.addCallback(appendRSMFeatures) + return d + PubSubService._legacyHandlers["items"][1].append("rsm")