# HG changeset patch # User Goffi # Date 1627566894 -7200 # Node ID 2715da5b2aa71481bc0827041ae51343313c9d99 # Parent 5f65f4e9f8cbb082ca978be667c5ac770826ed10 plugin XEP-0060: handle purge notifications diff -r 5f65f4e9f8cb -r 2715da5b2aa7 sat/core/constants.py --- a/sat/core/constants.py Wed Jul 28 23:01:15 2021 +0200 +++ b/sat/core/constants.py Thu Jul 29 15:54:54 2021 +0200 @@ -237,9 +237,10 @@ PS_PUBLISH = "publish" PS_RETRACT = "retract" # used for items PS_DELETE = "delete" # used for nodes + PS_PURGE = "purge" # used for nodes PS_ITEM = "item" PS_ITEMS = "items" # Can contain publish and retract items - PS_EVENTS = (PS_ITEMS, PS_DELETE) + PS_EVENTS = (PS_ITEMS, PS_DELETE, PS_PURGE) ## MESSAGE/NOTIFICATION LEVELS ## diff -r 5f65f4e9f8cb -r 2715da5b2aa7 sat/plugins/plugin_xep_0060.py --- a/sat/plugins/plugin_xep_0060.py Wed Jul 28 23:01:15 2021 +0200 +++ b/sat/plugins/plugin_xep_0060.py Thu Jul 29 15:54:54 2021 +0200 @@ -1529,6 +1529,19 @@ event.sender.full(), event.nodeIdentifier, C.PS_DELETE, [], client.profile ) + def purgeReceived(self, event): + log.debug(("Publish node purged")) + for callback in self._getNodeCallbacks(event.nodeIdentifier, C.PS_PURGE): + d = utils.asDeferred(callback, self.parent, event) + d.addErrback(lambda f: log.error( + f"Error while running purge event callback {callback}: {f}" + )) + client = self.parent + if (event.sender, event.nodeIdentifier) in client.pubsub_watching: + self.host.bridge.psEventRaw( + event.sender.full(), event.nodeIdentifier, C.PS_PURGE, [], client.profile + ) + def subscriptions(self, service, nodeIdentifier, sender=None): """Return the list of subscriptions to the given service and node.