From 88d32a7bc4f8f97a488c313952103567038b1c32 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 30 Jul 2012 19:05:20 +0200 Subject: Add an autorejoin_delay option - document it - works in per-tab config too --- src/common.py | 2 +- src/tabs.py | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/common.py b/src/common.py index 23912411..647454cb 100644 --- a/src/common.py +++ b/src/common.py @@ -210,7 +210,7 @@ def parse_str_to_secs(duration=''): result += tmp_i * values[char] tmp = '0' else: - result += int(tmp) + return 0 if tmp != '0': result += int(tmp) return result diff --git a/src/tabs.py b/src/tabs.py index 74475779..d6369a9d 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1350,7 +1350,17 @@ class MucTab(ChatTab): self.core.doupdate() # try to auto-rejoin if config.get_by_tabname('autorejoin', 'false', self.general_jid, True) == 'true': - muc.join_groupchat(self.core.xmpp, self.name, self.own_nick) + delay = config.get_by_tabname('autorejoin_delay', "5", self.general_jid, True) + delay = common.parse_str_to_secs(delay) + if delay <= 0: + muc.join_groupchat(self.core.xmpp, self.name, self.own_nick) + else: + self.core.add_timed_event(timed_events.DelayedEvent( + delay, + muc.join_groupchat, + self.core.xmpp, + self.name, + self.own_nick)) else: color = user.color[0] if config.get_by_tabname('display_user_color_in_join_part', '', self.general_jid, True) == 'true' else 3 if by: -- cgit v1.2.3