summaryrefslogtreecommitdiff
path: root/src/tabs
diff options
context:
space:
mode:
authorGeorg Lukas <georg@op-co.de>2015-06-01 12:56:42 +0200
committermathieui <mathieui@mathieui.net>2015-07-21 19:43:17 +0200
commit4e8cef2a77ca558c725a2a29537d0047450a547f (patch)
tree0342c6ab6489f9c40a2a15305f78230393437811 /src/tabs
parent68b40354cf6610f00248a2b912df5026b69bf722 (diff)
downloadpoezio-4e8cef2a77ca558c725a2a29537d0047450a547f.tar.gz
poezio-4e8cef2a77ca558c725a2a29537d0047450a547f.tar.bz2
poezio-4e8cef2a77ca558c725a2a29537d0047450a547f.tar.xz
poezio-4e8cef2a77ca558c725a2a29537d0047450a547f.zip
reset self-ping timer on every MUC message
Diffstat (limited to 'src/tabs')
-rw-r--r--src/tabs/muctab.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py
index 486c9078..bb731d20 100644
--- a/src/tabs/muctab.py
+++ b/src/tabs/muctab.py
@@ -1554,9 +1554,7 @@ class MucTab(ChatTab):
if self is not self.core.current_tab():
self.state = 'disconnected'
self.joined = False
- if self.self_ping_event is not None:
- self.core.remove_timed_event(self.self_ping_event)
- self.self_ping_event = None
+ self.disable_self_ping_event()
def get_single_line_topic(self):
"""
@@ -1618,6 +1616,10 @@ class MucTab(ChatTab):
in the room anymore
Return True if the message highlighted us. False otherwise.
"""
+
+ # reset self-ping interval
+ self.enable_self_ping_event()
+
self.log_message(txt, nickname, time=time, typ=kwargs.get('typ', 1))
args = dict()
for key, value in kwargs.items():
@@ -1674,9 +1676,15 @@ class MucTab(ChatTab):
delay = config.get_by_tabname("self_ping_delay", self.general_jid, default=0)
if delay <= 0: # use 0 or some negative value to disable it
return
+ self.disable_self_ping_event()
self.self_ping_event = timed_events.DelayedEvent(delay, self.send_self_ping)
self.core.add_timed_event(self.self_ping_event)
+ def disable_self_ping_event(self):
+ if self.self_ping_event is not None:
+ self.core.remove_timed_event(self.self_ping_event)
+ self.self_ping_event = None
+
def send_self_ping(self):
to = self.name + "/" + self.own_nick
self.core.xmpp.plugin['xep_0199'].send_ping(jid=to,