summaryrefslogtreecommitdiff
path: root/plugins/reorder.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/reorder.py')
-rw-r--r--plugins/reorder.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/plugins/reorder.py b/plugins/reorder.py
index 7be0b350..158b89bb 100644
--- a/plugins/reorder.py
+++ b/plugins/reorder.py
@@ -92,7 +92,11 @@ def parse_config(tab_config):
if pos in result or pos <= 0:
return None
- typ, name = tab_config.get(option, default=':').split(':', maxsplit=1)
+ spec = tab_config.get(option, default=':').split(':', maxsplit=1)
+ # Gap tabs are recreated automatically if there's a gap in indices.
+ if spec == 'empty':
+ return None
+ typ, name = spec
if typ not in TEXT_TO_TAB:
return None
result[pos] = (TEXT_TO_TAB[typ], name)
@@ -113,7 +117,8 @@ def parse_runtime_tablist(tablist):
for tab in tablist[1:]:
i += 1
result = check_tab(tab)
- if result:
+ # Don't serialize gap tabs as they're recreated automatically
+ if result != 'empty' and isinstance(tab, tuple(TEXT_TO_TAB.values())):
props.append((i, '%s:%s' % (result, tab.jid.full)))
return props
@@ -162,7 +167,7 @@ class Plugin(BasePlugin):
for pos in sorted(tabs_spec):
if create_gaps and pos > last + 1:
new_tabs += [
- tabs.GapTab(self.core) for i in range(pos - last - 1)
+ tabs.GapTab() for i in range(pos - last - 1)
]
cls, jid = tabs_spec[pos]
try:
@@ -172,15 +177,17 @@ class Plugin(BasePlugin):
new_tabs.append(tab)
old_tabs.remove(tab)
else:
- self.api.information('Tab %s not found. Creating it' % jid, 'Warning')
# TODO: Add support for MucTab. Requires nickname.
if cls in (tabs.DynamicConversationTab, tabs.StaticConversationTab):
+ self.api.information('Tab %s not found. Creating it' % jid, 'Warning')
new_tab = cls(self.core, jid)
new_tabs.append(new_tab)
+ else:
+ new_tabs.append(tabs.GapTab())
except:
self.api.information('Failed to create tab \'%s\'.' % jid, 'Error')
if create_gaps:
- new_tabs.append(tabs.GapTab(self.core))
+ new_tabs.append(tabs.GapTab())
finally:
last = pos