summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/core/core.py10
1 files changed, 3 insertions, 7 deletions
diff --git a/poezio/core/core.py b/poezio/core/core.py
index 6bb19d16..ed977b6d 100644
--- a/poezio/core/core.py
+++ b/poezio/core/core.py
@@ -834,14 +834,10 @@ class Core:
self.legitimate_disconnect = True
for tab in self.get_tabs(tabs.MucTab):
tab.command_part(msg)
- self.xmpp.disconnect()
if reconnect:
- # Add a one-time event to reconnect as soon as we are
- # effectively disconnected
- self.xmpp.add_event_handler(
- 'disconnected',
- lambda event: self.xmpp.connect(),
- disposable=True)
+ self.xmpp.reconnect(wait=0.0, reason=msg)
+ else:
+ self.xmpp.disconnect(reason=msg)
def send_message(self, msg: str) -> bool:
"""