# HG changeset patch # User Goffi # Date 1655468123 -7200 # Node ID c61233f51b86c58ce725317050be428acfc6165f # Parent 24f70a29e3822ce0d327a37282c2d9a45f20fedc plugin XEP-0060: do not raise an error when not subscribed on unsubscribe: when an error is received on unsubscribe because user was not subscribed, a warning is logged, but no exception is raised anymore, as the expected result is reached. diff -r 24f70a29e382 -r c61233f51b86 sat/plugins/plugin_xep_0060.py --- a/sat/plugins/plugin_xep_0060.py Fri Jun 17 14:15:23 2022 +0200 +++ b/sat/plugins/plugin_xep_0060.py Fri Jun 17 14:15:23 2022 +0200 @@ -1196,13 +1196,24 @@ 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(