fix: when disconnected, do not send a new ping event
This commit is contained in:
parent
b60a828661
commit
8cbe41eba8
1 changed files with 11 additions and 8 deletions
|
@ -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 \
|
||||
|
|
Loading…
Reference in a new issue