summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxime Buquet <pep+code@bouah.net>2016-10-15 09:47:27 +0900
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2016-10-15 01:50:41 +0100
commit12a55845ffce83f321bc05b0499e11b86f09271a (patch)
treef07adcb51195f1bb121f939b389b499cc7c54821
parentabb41d5750c3a85f3f9c4baca73b1b145a8aa83c (diff)
downloadpoezio-12a55845ffce83f321bc05b0499e11b86f09271a.tar.gz
poezio-12a55845ffce83f321bc05b0499e11b86f09271a.tar.bz2
poezio-12a55845ffce83f321bc05b0499e11b86f09271a.tar.xz
poezio-12a55845ffce83f321bc05b0499e11b86f09271a.zip
Make reorder plugin read create_gaps config
-rw-r--r--plugins/reorder.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/reorder.py b/plugins/reorder.py
index ecab457e..87e87ee6 100644
--- a/plugins/reorder.py
+++ b/plugins/reorder.py
@@ -62,6 +62,7 @@ And finally, the ``[tab name]`` must be:
from poezio import tabs
from poezio.decorators import command_args_parser
from poezio.plugin import BasePlugin
+from poezio.config import config
TEXT_TO_TAB = {
'muc': tabs.MucTab,
@@ -141,10 +142,12 @@ class Plugin(BasePlugin):
old_tabs = self.core.tabs[1:]
roster = self.core.tabs[0]
+ create_gaps = config.get('create_gaps')
+
new_tabs = []
last = 0
for pos in sorted(tabs_spec):
- if pos > last + 1:
+ if create_gaps and pos > last + 1:
new_tabs += [tabs.GapTab(self.core) for i in range(pos - last)]
cls, name = tabs_spec[pos]
tab = self.core.get_tab_by_name(name, typ=cls)
@@ -153,7 +156,8 @@ class Plugin(BasePlugin):
old_tabs.remove(tab)
else:
self.api.information('Tab %s not found' % name, 'Warning')
- new_tabs.append(tabs.GapTab(self.core))
+ if create_gaps:
+ new_tabs.append(tabs.GapTab(self.core))
last = pos
for tab in old_tabs: