From 8cbe41eba8426ff402cd0132bd6e69253018ab20 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sun, 11 Apr 2021 14:41:42 +0200 Subject: fix: when disconnected, do not send a new ping event --- poezio/tabs/muctab.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py index a2682a65..a39a0234 100644 --- a/poezio/tabs/muctab.py +++ b/poezio/tabs/muctab.py @@ -1146,14 +1146,17 @@ class MucTab(ChatTab): self.self_ping_event = None def send_self_ping(self) -> None: - timeout = config.get_by_tabname( - "self_ping_timeout", self.general_jid, default=60) - to = self.jid.bare + "/" + self.own_nick - self.core.xmpp.plugin['xep_0199'].send_ping( - jid=to, - callback=self.on_self_ping_result, - timeout_callback=self.on_self_ping_failed, - timeout=timeout) + if self.core.xmpp.is_connected(): + timeout = config.get_by_tabname( + "self_ping_timeout", self.general_jid, default=60) + to = self.jid.bare + "/" + self.own_nick + self.core.xmpp.plugin['xep_0199'].send_ping( + jid=to, + callback=self.on_self_ping_result, + timeout_callback=self.on_self_ping_failed, + timeout=timeout) + else: + self.enable_self_ping_event() def on_self_ping_result(self, iq: Iq) -> None: if iq["type"] == "error" and iq["error"]["condition"] not in \ -- cgit v1.2.3