comparison sat/plugins/plugin_xep_0060.py @ 3587:2715da5b2aa7

plugin XEP-0060: handle purge notifications
author Goffi <goffi@goffi.org>
date Thu, 29 Jul 2021 15:54:54 +0200
parents 5f65f4e9f8cb
children 2c7a52a62be3
comparison
equal deleted inserted replaced
3586:5f65f4e9f8cb 3587:2715da5b2aa7
1527 if (event.sender, event.nodeIdentifier) in client.pubsub_watching: 1527 if (event.sender, event.nodeIdentifier) in client.pubsub_watching:
1528 self.host.bridge.psEventRaw( 1528 self.host.bridge.psEventRaw(
1529 event.sender.full(), event.nodeIdentifier, C.PS_DELETE, [], client.profile 1529 event.sender.full(), event.nodeIdentifier, C.PS_DELETE, [], client.profile
1530 ) 1530 )
1531 1531
1532 def purgeReceived(self, event):
1533 log.debug(("Publish node purged"))
1534 for callback in self._getNodeCallbacks(event.nodeIdentifier, C.PS_PURGE):
1535 d = utils.asDeferred(callback, self.parent, event)
1536 d.addErrback(lambda f: log.error(
1537 f"Error while running purge event callback {callback}: {f}"
1538 ))
1539 client = self.parent
1540 if (event.sender, event.nodeIdentifier) in client.pubsub_watching:
1541 self.host.bridge.psEventRaw(
1542 event.sender.full(), event.nodeIdentifier, C.PS_PURGE, [], client.profile
1543 )
1544
1532 def subscriptions(self, service, nodeIdentifier, sender=None): 1545 def subscriptions(self, service, nodeIdentifier, sender=None):
1533 """Return the list of subscriptions to the given service and node. 1546 """Return the list of subscriptions to the given service and node.
1534 1547
1535 @param service: The publish subscribe service to retrieve the subscriptions from. 1548 @param service: The publish subscribe service to retrieve the subscriptions from.
1536 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>} 1549 @type service: L{JID<twisted.words.protocols.jabber.jid.JID>}