From 876ec805980202c9785d3f6b9505c4f6696b9e97 Mon Sep 17 00:00:00 2001 From: Goffi Date: Thu, 12 Nov 2020 14:53:15 +0100 Subject: [PATCH] plugin XEP-0077: disconnect client when deleting self account: where profile's XMPP account is deleted, its client must be explicitely disconnected to avoid automatic reconnection, which would obviously fail. --- sat/plugins/plugin_xep_0077.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sat/plugins/plugin_xep_0077.py b/sat/plugins/plugin_xep_0077.py index 2a39a5f8..aa48aaba 100644 --- a/sat/plugins/plugin_xep_0077.py +++ b/sat/plugins/plugin_xep_0077.py @@ -303,4 +303,8 @@ class XEP_0077(object): iq_elt["to"] = to_jid.full() query_elt = iq_elt.addElement((NS_REG, "query")) query_elt.addElement("remove") - return iq_elt.send() + d = iq_elt.send() + if not to_jid or to_jid == jid.JID(client.jid.host): + d.addCallback(lambda __: client.entityDisconnect()) + return d +