summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/default_config.cfg9
-rw-r--r--doc/en/configure.txt23
-rw-r--r--src/common.py2
-rw-r--r--src/tabs.py12
4 files changed, 39 insertions, 7 deletions
diff --git a/data/default_config.cfg b/data/default_config.cfg
index 252ea063..677da719 100644
--- a/data/default_config.cfg
+++ b/data/default_config.cfg
@@ -143,10 +143,15 @@ information_buffer_popup_on = error roster warning help info
popup_time = 4
-# 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
+# rooms when you're kicked
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
+# instantly. Only effective if autorejoin is set to true.
+autorejoin_delay = 5
+
# If you want poezio to join
# the room with an alternative nickname when
# your nickname is already in use in the room you
diff --git a/doc/en/configure.txt b/doc/en/configure.txt
index 0fdaeb30..5e2f1053 100644
--- a/doc/en/configure.txt
+++ b/doc/en/configure.txt
@@ -198,7 +198,13 @@ section of this documentation.
*autorejoin*:: false
set to 'true' if you want to automatically rejoin the
- room when you're kicked
+ room when you're kicked.
+
+*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.
+ This option only works if autorejoin is enabled.
*alternative_nickname*:: [empty]
@@ -464,9 +470,20 @@ foo = true
*ignore_private*:: false
- Ignore private messages sent from this room.
+ Ignore private messages sent from this room.
*private_auto_response*:: "Not in private, please."
- The message you want to be sent when someone tries to message you.
+ The message you want to be sent when someone tries to message you.
+
+*autorejoin*:: false
+
+ set to 'true' if you want to automatically rejoin the
+ room when you're kicked.
+
+*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.
+ This option only works if autorejoin is enabled.
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: