summaryrefslogtreecommitdiff
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
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
-rw-r--r--plugins/ping.py2
-rw-r--r--src/tabs/muctab.py12
-rw-r--r--src/timed_events.py1
3 files changed, 12 insertions, 3 deletions
diff --git a/plugins/ping.py b/plugins/ping.py
index 4ec706b3..a28406d1 100644
--- a/plugins/ping.py
+++ b/plugins/ping.py
@@ -31,8 +31,6 @@ import time
class Plugin(BasePlugin):
def init(self):
- self.core.xmpp.register_plugin('xep_0199')
- self.core.xmpp.plugin['xep_0115'].update_caps()
self.api.add_command('ping', self.command_ping,
usage='<jid>',
help='Send an XMPP ping to jid (see XEP-0199).',
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()
diff --git a/src/timed_events.py b/src/timed_events.py
index 6160645b..7f43d05f 100644
--- a/src/timed_events.py
+++ b/src/timed_events.py
@@ -35,7 +35,6 @@ class DelayedEvent(object):
"""
self.callback = callback
self.args = args
- self.repetive = False
self.delay = delay
# An asyncio handler, as returned by call_later() or call_at()
self.handler = None