diff twisted/plugins/pubsub.py @ 491:4e8e8788bc86

Bookmark compatibility layer: The new `bookmark_compat` module add a compatibility layer between XEP-0048 (with XEP-0049 private XML storage) and XEP-0402, i.e. it implements the `urn:xmpp:bookmarks:1#compat` feature.
author Goffi <goffi@goffi.org>
date Thu, 21 Nov 2024 11:03:51 +0100
parents b544109ab4c4
children
line wrap: on
line diff
--- a/twisted/plugins/pubsub.py	Thu Nov 21 11:02:09 2024 +0100
+++ b/twisted/plugins/pubsub.py	Thu Nov 21 11:03:51 2024 +0100
@@ -49,17 +49,19 @@
 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 
-import sys
+import configparser
 import csv
 import os
 from os.path import expanduser, realpath
-import configparser
-from zope.interface import implementer
-from twisted.application.service import IServiceMaker
+import sys
+
 from twisted.application import service
-from twisted.python import usage, log
+from twisted.application.service import IServiceMaker
 from twisted.plugin import IPlugin
+from twisted.python import log, usage
 from twisted.words.protocols.jabber.jid import JID
+from zope.interface import implementer
+
 import sat_pubsub
 from sat_pubsub import const
 
@@ -233,6 +235,7 @@
         from sat_pubsub.privilege import PrivilegesHandler
         from sat_pubsub.delegation import DelegationsHandler
         from sat_pubsub.pam import PAMHandler
+        from sat_pubsub.bookmark_compat import BookmarkCompatHandler
 
         if not config['jid'] or not config['xmpp_pwd']:
             raise usage.UsageError("You must specify jid and xmpp_pwd")
@@ -295,6 +298,9 @@
         pam.setHandlerParent(cs)
         bs.pam = pam
 
+        bookmark_compat = BookmarkCompatHandler(config["jid"])
+        bookmark_compat.setHandlerParent(cs)
+
         resource = IPubSubResource(bs)
         resource.hideNodes = config["hide-nodes"]
         resource.serviceJID = config["jid"]