comparison sat/plugins/plugin_comp_ap_gateway/__init__.py @ 3850:4479f6074bc8

component AP gateway: use the new `priority` argument of `addManagedNode`: priority is needed because we'll need to inspect former items on retract to check the Acitivy to use (it may be an `Undo` activity is some cases), and this must be done before the cache is updated by pubsub cache plugin. rel 370
author Goffi <goffi@goffi.org>
date Thu, 14 Jul 2022 12:55:30 +0200
parents aaa4e7815ba8
children ef824b1091f3
comparison
equal deleted inserted replaced
3849:bc24ce903835 3850:4479f6074bc8
130 self._pps = host.plugins["XEP-0465"] 130 self._pps = host.plugins["XEP-0465"]
131 self._c = host.plugins["PUBSUB_CACHE"] 131 self._c = host.plugins["PUBSUB_CACHE"]
132 self._t = host.plugins["TEXT_SYNTAXES"] 132 self._t = host.plugins["TEXT_SYNTAXES"]
133 self._i = host.plugins["IDENTITY"] 133 self._i = host.plugins["IDENTITY"]
134 self._p.addManagedNode( 134 self._p.addManagedNode(
135 "", items_cb=self._itemsReceived 135 "",
136 items_cb=self._itemsReceived,
137 # we want to be sure that the callbacks are launched before pubsub cache's
138 # one, as we need to inspect items before they are actually removed from cache
139 # or updated
140 priority=1000
136 ) 141 )
137 self.pubsub_service = APPubsubService(self) 142 self.pubsub_service = APPubsubService(self)
138 host.trigger.add("messageReceived", self._messageReceivedTrigger, priority=-1000) 143 host.trigger.add("messageReceived", self._messageReceivedTrigger, priority=-1000)
139 host.trigger.add("XEP-0424_retractReceived", self._onMessageRetract) 144 host.trigger.add("XEP-0424_retractReceived", self._onMessageRetract)
140 host.trigger.add("XEP-0372_ref_received", self._onReferenceReceived) 145 host.trigger.add("XEP-0372_ref_received", self._onReferenceReceived)