summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMaxime “pep” Buquet <pep@bouah.net>2020-04-01 01:16:11 +0200
committerMaxime “pep” Buquet <pep@bouah.net>2020-04-01 01:16:11 +0200
commit00b91fe46218be23e040813aacbc73987b9015a0 (patch)
treeb59aae435f31df591a8b607f5882dc8f123fa466 /plugins
parentf82e83067e6a61815a60ea8c56f944aa49d79e76 (diff)
downloadpoezio-00b91fe46218be23e040813aacbc73987b9015a0.tar.gz
poezio-00b91fe46218be23e040813aacbc73987b9015a0.tar.bz2
poezio-00b91fe46218be23e040813aacbc73987b9015a0.tar.xz
poezio-00b91fe46218be23e040813aacbc73987b9015a0.zip
reorder: Ensure valid JID
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/reorder.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugins/reorder.py b/plugins/reorder.py
index ca3bda08..eebc810a 100644
--- a/plugins/reorder.py
+++ b/plugins/reorder.py
@@ -59,6 +59,8 @@ And finally, the ``[tab name]`` must be:
- For a type ``static``, the full JID of the contact
"""
+from slixmpp import InvalidJID, JID
+
from poezio import tabs
from poezio.decorators import command_args_parser
from poezio.plugin import BasePlugin
@@ -162,13 +164,18 @@ class Plugin(BasePlugin):
new_tabs += [
tabs.GapTab(self.core) for i in range(pos - last - 1)
]
- cls, name = tabs_spec[pos]
- tab = self.core.tabs.by_name_and_class(name, cls=cls)
+ cls, jid = tabs_spec[pos]
+ try:
+ jid = JID(jid)
+ except InvalidJID:
+ self.api.information('Reorder: Invalid JID \'%s\'.' % jid, 'Warning')
+ continue
+ tab = self.core.tabs.by_name_and_class(str(jid), cls=cls)
if tab and tab in old_tabs:
new_tabs.append(tab)
old_tabs.remove(tab)
else:
- self.api.information('Tab %s not found' % name, 'Warning')
+ self.api.information('Tab %s not found' % jid, 'Warning')
if create_gaps:
new_tabs.append(tabs.GapTab(self.core))
last = pos