diff options
-rw-r--r-- | plugins/ping.py | 2 | ||||
-rw-r--r-- | src/tabs/muctab.py | 12 | ||||
-rw-r--r-- | src/timed_events.py | 1 |
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 |