From 12a55845ffce83f321bc05b0499e11b86f09271a Mon Sep 17 00:00:00 2001 From: Maxime Buquet Date: Sat, 15 Oct 2016 09:47:27 +0900 Subject: Make reorder plugin read create_gaps config --- plugins/reorder.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'plugins') 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: -- cgit v1.2.3