summaryrefslogtreecommitdiff
path: root/src/tabs
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2015-05-16 20:42:30 +0200
committerFlorent Le Coz <louiz@louiz.org>2015-05-16 20:42:30 +0200
commit0d1ea0d8c33714d874a7f74e8be2ba2a0612ebb3 (patch)
tree7b0aa030c8e67055802ecd8ce7dbfdd95e96a8ad /src/tabs
parent1914cfe00365e67e8d82554cd10d2e35f68ad60d (diff)
parent1faf8576e22948e51c8493f05d6f576588ad847a (diff)
downloadpoezio-0d1ea0d8c33714d874a7f74e8be2ba2a0612ebb3.tar.gz
poezio-0d1ea0d8c33714d874a7f74e8be2ba2a0612ebb3.tar.bz2
poezio-0d1ea0d8c33714d874a7f74e8be2ba2a0612ebb3.tar.xz
poezio-0d1ea0d8c33714d874a7f74e8be2ba2a0612ebb3.zip
Merge branch 'self-ping' into HEAD
Conflicts: src/tabs/muctab.py
Diffstat (limited to 'src/tabs')
-rw-r--r--src/tabs/muctab.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py
index 1d82ec3a..d4b13258 100644
--- a/src/tabs/muctab.py
+++ b/src/tabs/muctab.py
@@ -66,6 +66,8 @@ class MucTab(ChatTab):
self.topic = ''
self.topic_from = ''
self.remote_wants_chatstates = True
+ # Self ping event, so we can cancel it when we leave the room
+ self.self_ping_event = None
# We send active, composing and paused states to the MUC because
# the chatstate may or may not be filtered by the MUC,
# that’s not our problem.
@@ -1152,6 +1154,9 @@ class MucTab(ChatTab):
self.core.current_tab().input.refresh()
self.core.doupdate()
self.core.enable_private_tabs(self.name)
+ # Enable the self ping event, to regularly check if we
+ # are still in the room.
+ self.enable_self_ping_event()
else:
change_nick = '303' in status_codes
kick = '307' in status_codes and typ == 'unavailable'
@@ -1545,6 +1550,9 @@ 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
def get_single_line_topic(self):
"""
@@ -1694,3 +1702,7 @@ class MucTab(ChatTab):
nick_alias = re.sub('_*$', '', nick_alias)
color = config.get_by_tabname(nick_alias, 'muc_colors')
return color
+
+ def on_self_ping_failed(self, iq):
+ self.command_part("the MUC server is not responding")
+ self.core.refresh_window()