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.
This commit is contained in:
parent
5ecca19b71
commit
83a6d475a9
1 changed files with 12 additions and 1 deletions
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue