comparison 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
comparison
equal deleted inserted replaced
490:cab491b1b563 491:4e8e8788bc86
47 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 47 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
48 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 48 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
49 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 49 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
50 50
51 51
52 import sys 52 import configparser
53 import csv 53 import csv
54 import os 54 import os
55 from os.path import expanduser, realpath 55 from os.path import expanduser, realpath
56 import configparser 56 import sys
57
58 from twisted.application import service
59 from twisted.application.service import IServiceMaker
60 from twisted.plugin import IPlugin
61 from twisted.python import log, usage
62 from twisted.words.protocols.jabber.jid import JID
57 from zope.interface import implementer 63 from zope.interface import implementer
58 from twisted.application.service import IServiceMaker 64
59 from twisted.application import service
60 from twisted.python import usage, log
61 from twisted.plugin import IPlugin
62 from twisted.words.protocols.jabber.jid import JID
63 import sat_pubsub 65 import sat_pubsub
64 from sat_pubsub import const 66 from sat_pubsub import const
65 67
66 68
67 def coerceListType(value): 69 def coerceListType(value):
231 from sat_pubsub import pubsub_admin 233 from sat_pubsub import pubsub_admin
232 from sat_pubsub.backend import BackendService, ExtraDiscoHandler 234 from sat_pubsub.backend import BackendService, ExtraDiscoHandler
233 from sat_pubsub.privilege import PrivilegesHandler 235 from sat_pubsub.privilege import PrivilegesHandler
234 from sat_pubsub.delegation import DelegationsHandler 236 from sat_pubsub.delegation import DelegationsHandler
235 from sat_pubsub.pam import PAMHandler 237 from sat_pubsub.pam import PAMHandler
238 from sat_pubsub.bookmark_compat import BookmarkCompatHandler
236 239
237 if not config['jid'] or not config['xmpp_pwd']: 240 if not config['jid'] or not config['xmpp_pwd']:
238 raise usage.UsageError("You must specify jid and xmpp_pwd") 241 raise usage.UsageError("You must specify jid and xmpp_pwd")
239 s = service.MultiService() 242 s = service.MultiService()
240 243
293 296
294 pam = PAMHandler(config["jid"]) 297 pam = PAMHandler(config["jid"])
295 pam.setHandlerParent(cs) 298 pam.setHandlerParent(cs)
296 bs.pam = pam 299 bs.pam = pam
297 300
301 bookmark_compat = BookmarkCompatHandler(config["jid"])
302 bookmark_compat.setHandlerParent(cs)
303
298 resource = IPubSubResource(bs) 304 resource = IPubSubResource(bs)
299 resource.hideNodes = config["hide-nodes"] 305 resource.hideNodes = config["hide-nodes"]
300 resource.serviceJID = config["jid"] 306 resource.serviceJID = config["jid"]
301 307
302 ps = (rsm if const.FLAG_ENABLE_RSM else pubsub).PubSubService(resource) 308 ps = (rsm if const.FLAG_ENABLE_RSM else pubsub).PubSubService(resource)