From ee97ba6b6cf96d2f6f0dd67928da4f370bab9f12 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 31 Jul 2012 13:37:40 +0200 Subject: Make the autorejoin option work with bans, too, and fix the documentation --- data/default_config.cfg | 6 +++--- doc/en/configure.txt | 8 ++++---- src/tabs.py | 13 +++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/data/default_config.cfg b/data/default_config.cfg index 677da719..d674e098 100644 --- a/data/default_config.cfg +++ b/data/default_config.cfg @@ -144,11 +144,11 @@ popup_time = 4 # Set to 'true' if you want to automatically rejoin the -# rooms when you're kicked +# rooms when you're kicked or banned autorejoin = false -# Set to the delay you want to reconnect when you are kicked -# no value, 0, or a negative value means you will be reconnected +# Set to the number of seconds before reconnecting when you are kicked +# or banned. No value, 0, or a negative value means you will be reconnected # instantly. Only effective if autorejoin is set to true. autorejoin_delay = 5 diff --git a/doc/en/configure.txt b/doc/en/configure.txt index 5e2f1053..f72d1627 100644 --- a/doc/en/configure.txt +++ b/doc/en/configure.txt @@ -478,12 +478,12 @@ foo = true *autorejoin*:: false - set to 'true' if you want to automatically rejoin the - room when you're kicked. + Set to 'true' if you want to automatically rejoin the + room when you're kicked or banned. *autorejoin_delay*:: 5 - Set to the number of seconds before reconnecting after getting kicked. - 0, a negative value, or no value means you instant reconnection. + Set to the number of seconds before reconnecting after getting kicked or + banned. 0, a negative value, or no value means instant reconnection. This option only works if autorejoin is enabled. diff --git a/src/tabs.py b/src/tabs.py index d6369a9d..4d52a285 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1320,6 +1320,19 @@ class MucTab(ChatTab): self.refresh_tab_win() self.core.current_tab().input.refresh() self.core.doupdate() + if config.get_by_tabname('autorejoin', 'false', self.general_jid, True) == 'true': + 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