comparison sat/plugins/plugin_xep_0060.py @ 3597:5d108ce026d7

plugin pubsub cache: Pubsub Caching implementation
author Goffi <goffi@goffi.org>
date Thu, 29 Jul 2021 22:51:01 +0200
parents d830c11eeef3
children 1cdb9d9fad6b
comparison
equal deleted inserted replaced
3596:2d97c695af05 3597:5d108ce026d7
89 OWPOL_ORIGINAL = "original_publisher" 89 OWPOL_ORIGINAL = "original_publisher"
90 OWPOL_ANY_PUB = "any_publisher" 90 OWPOL_ANY_PUB = "any_publisher"
91 ID_SINGLETON = "current" 91 ID_SINGLETON = "current"
92 EXTRA_PUBLISH_OPTIONS = "publish_options" 92 EXTRA_PUBLISH_OPTIONS = "publish_options"
93 EXTRA_ON_PRECOND_NOT_MET = "on_precondition_not_met" 93 EXTRA_ON_PRECOND_NOT_MET = "on_precondition_not_met"
94 # extra disco needed for RSM, cf. XEP-0060 ยง 6.5.4
95 DISCO_RSM = "http://jabber.org/protocol/pubsub#rsm"
94 96
95 def __init__(self, host): 97 def __init__(self, host):
96 log.info(_("PubSub plugin initialization")) 98 log.info(_("PubSub plugin initialization"))
97 self.host = host 99 self.host = host
98 self._rsm = host.plugins.get("XEP-0059") 100 self._rsm = host.plugins.get("XEP-0059")
390 all node *prefixed* with this one will be triggered 392 all node *prefixed* with this one will be triggered
391 @param **kwargs: method(s) to call when the node is found 393 @param **kwargs: method(s) to call when the node is found
392 the method must be named after PubSub constants in lower case 394 the method must be named after PubSub constants in lower case
393 and suffixed with "_cb" 395 and suffixed with "_cb"
394 e.g.: "items_cb" for C.PS_ITEMS, "delete_cb" for C.PS_DELETE 396 e.g.: "items_cb" for C.PS_ITEMS, "delete_cb" for C.PS_DELETE
397 note: only C.PS_ITEMS and C.PS_DELETE are implemented so far
395 """ 398 """
396 assert node is not None 399 assert node is not None
397 assert kwargs 400 assert kwargs
398 callbacks = self._node_cb.setdefault(node, {}) 401 callbacks = self._node_cb.setdefault(node, {})
399 for event, cb in kwargs.items(): 402 for event, cb in kwargs.items():