Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2022-10-05 23:57:31 +0300
committerPhilipp Hörist <philipp@hoerist.com>2022-10-05 23:59:05 +0300
commitc71ca59b067ed3f76b93ee2f09c32969ab0c7cfe (patch)
treeb0cca44a04d0f6324f598e4cb4dfc7ef2b0e1f05
parent7a98a1f2e9c62452316f06bb7c477d4e89f29973 (diff)
refactor: Client: Remove workaround when disabling account
We only call disable account when we are disconnected now.
-rw-r--r--gajim/common/client.py17
1 files changed, 1 insertions, 16 deletions
diff --git a/gajim/common/client.py b/gajim/common/client.py
index dac5e0505..3a96a06ef 100644
--- a/gajim/common/client.py
+++ b/gajim/common/client.py
@@ -160,16 +160,6 @@ class Client(Observable):
self._remove_account = value
def _create_client(self) -> None:
- if self._destroyed:
- # If we disable an account cleanup() is called and all
- # modules are unregistered. Because disable_account() does not wait
- # for the client to properly disconnect, handlers of the
- # nbxmpp.Client() are emitted after we called cleanup().
- # After nbxmpp.Client() disconnects and is destroyed we create a
- # new instance with this method but modules.get_handlers() fails
- # because modules are already unregistered.
- # TODO: Make this nicer
- return
log.info('Create new nbxmpp client')
self._client = NBXMPPClient(log_context=self._account)
self.connection = self._client
@@ -648,12 +638,7 @@ class Client(Observable):
Monitor.disconnect(self._idle_handler_id)
app.app.disconnect(self._screensaver_handler_id)
if self._client is not None:
- # cleanup() is called before nbmxpp.Client has disconnected,
- # when we disable the account. So we need to unregister
- # handlers here.
- # TODO: cleanup() should not be called before disconnect is finished
- for handler in modules.get_handlers(self):
- self._client.unregister_handler(handler)
+ self._client.destroy()
modules.unregister_modules(self)
def quit(self, kill_core: bool) -> None: