From f52e8d889c957b35c4a4c50fe0a736fa081c2e80 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Wed, 28 Mar 2018 11:36:14 +0200 Subject: [PATCH] don't traceback on account deletion. Fixes #8960 --- gajim/common/connection.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gajim/common/connection.py b/gajim/common/connection.py index 16e7a8fcf..f74494120 100644 --- a/gajim/common/connection.py +++ b/gajim/common/connection.py @@ -695,6 +695,7 @@ class Connection(CommonConnection, ConnectionHandlers): self.privacy_rules_requested = False self.streamError = '' self.secret_hmac = str(random.random())[2:].encode('utf-8') + self.removing_account = False self.sm = Smacks(self) # Stream Management @@ -869,6 +870,8 @@ class Connection(CommonConnection, ConnectionHandlers): def _connection_lost(self): log.debug('_connection_lost') self.disconnect(on_purpose = False) + if self.removing_account: + return app.nec.push_incoming_event(ConnectionLostEvent(None, conn=self, title=_('Connection with account "%s" has been lost') % self.name, msg=_('Reconnect manually.'))) @@ -2890,6 +2893,7 @@ class Connection(CommonConnection, ConnectionHandlers): # on_remove_success as a class property as pass it as an argument def _on_unregister_account_connect(con): self.on_connect_auth = None + self.removing_account = True if app.account_is_connected(self.name): hostname = app.config.get_per('accounts', self.name, 'hostname') iq = nbxmpp.Iq(typ='set', to=hostname) @@ -2908,6 +2912,7 @@ class Connection(CommonConnection, ConnectionHandlers): con.SendAndWaitForResponse(iq) return on_remove_success(False) + self.removing_account = False if self.connected == 0: self.on_connect_auth = _on_unregister_account_connect self.connect_and_auth()