Make the autorejoin option work with bans, too, and fix the documentation

This commit is contained in:
mathieui 2012-07-31 13:37:40 +02:00
parent 906c74f0be
commit ee97ba6b6c
3 changed files with 20 additions and 7 deletions

View file

@ -144,11 +144,11 @@ popup_time = 4
# Set to 'true' if you want to automatically rejoin the # Set to 'true' if you want to automatically rejoin the
# rooms when you're kicked # rooms when you're kicked or banned
autorejoin = false autorejoin = false
# Set to the delay you want to reconnect when you are kicked # Set to the number of seconds before reconnecting when you are kicked
# no value, 0, or a negative value means you will be reconnected # or banned. No value, 0, or a negative value means you will be reconnected
# instantly. Only effective if autorejoin is set to true. # instantly. Only effective if autorejoin is set to true.
autorejoin_delay = 5 autorejoin_delay = 5

View file

@ -478,12 +478,12 @@ foo = true
*autorejoin*:: false *autorejoin*:: false
set to 'true' if you want to automatically rejoin the Set to 'true' if you want to automatically rejoin the
room when you're kicked. room when you're kicked or banned.
*autorejoin_delay*:: 5 *autorejoin_delay*:: 5
Set to the number of seconds before reconnecting after getting kicked. Set to the number of seconds before reconnecting after getting kicked or
0, a negative value, or no value means you instant reconnection. banned. 0, a negative value, or no value means instant reconnection.
This option only works if autorejoin is enabled. This option only works if autorejoin is enabled.

View file

@ -1320,6 +1320,19 @@ class MucTab(ChatTab):
self.refresh_tab_win() self.refresh_tab_win()
self.core.current_tab().input.refresh() self.core.current_tab().input.refresh()
self.core.doupdate() 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: else:
color = user.color[0] if config.get_by_tabname('display_user_color_in_join_part', '', self.general_jid, True) == 'true' else 3 color = user.color[0] if config.get_by_tabname('display_user_color_in_join_part', '', self.general_jid, True) == 'true' else 3
if by: if by: