diff --git a/sat/plugins/plugin_xep_0060.py b/sat/plugins/plugin_xep_0060.py index 54679cee..7127c0ca 100644 --- a/sat/plugins/plugin_xep_0060.py +++ b/sat/plugins/plugin_xep_0060.py @@ -1196,13 +1196,24 @@ class XEP_0060(object): subscriptionIdentifier, sender ): return - await client.pubsub_client.unsubscribe( + try: + await client.pubsub_client.unsubscribe( service, nodeIdentifier, sub_jid or client.jid.userhostJID(), subscriptionIdentifier, sender, ) + except error.StanzaError as e: + try: + next(e.getElement().elements(pubsub.NS_PUBSUB_ERRORS, "not-subscribed")) + except StopIteration: + raise e + else: + log.info( + f"{sender.full() if sender else client.jid.full()} was not " + f"subscribed to node {nodeIdentifier!s} at {service.full()}" + ) @utils.ensure_deferred async def _subscriptions(