summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2021-04-11 14:41:42 +0200
committermathieui <mathieui@mathieui.net>2021-04-11 14:41:42 +0200
commit8cbe41eba8426ff402cd0132bd6e69253018ab20 (patch)
tree43f1fdf973963c2b3e0af0e31b201bc58e1e36f8
parentb60a828661f9c42ded23081092a46331c1df611d (diff)
downloadpoezio-8cbe41eba8426ff402cd0132bd6e69253018ab20.tar.gz
poezio-8cbe41eba8426ff402cd0132bd6e69253018ab20.tar.bz2
poezio-8cbe41eba8426ff402cd0132bd6e69253018ab20.tar.xz
poezio-8cbe41eba8426ff402cd0132bd6e69253018ab20.zip
fix: when disconnected, do not send a new ping event
-rw-r--r--poezio/tabs/muctab.py19
1 files 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 \