fix: when disconnected, do not send a new ping event

This commit is contained in:
mathieui 2021-04-11 14:41:42 +02:00
parent b60a828661
commit 8cbe41eba8

View file

@ -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 \