config: ensure tabname is not a JID object

Tabnames should be treated as opaque strings.

This specific fix prevents tabname (JID) to be compared with invalid
stringly-typed JIDs. JID's __eq__ method used to (after
slixmpp@47968963) try and convert anything into JIDs. This has
been fixed and now properly returns NotImplemented.
Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <>
parent 463ad192
......@@ -20,6 +20,7 @@ from configparser import RawConfigParser, NoOptionError, NoSectionError
from pathlib import Path
from shutil import copy2
from typing import Callable, Dict, List, Optional, Union, Tuple
from slixmpp import JID
from poezio.args import parse_args
from poezio import xdg
......@@ -214,7 +215,7 @@ class Config(RawConfigParser):
def get_by_tabname(self,
tabname: str,
......@@ -224,6 +225,8 @@ class Config(RawConfigParser):
in the section, we search for the global option if fallback is
True. And we return `default` as a fallback as a last resort.
if isinstance(tabname, JID):
tabname = tabname.full
if self.default and (not default) and fallback:
default = self.default.get(DEFSECTION, {}).get(option, '')
if tabname in self.sections():
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment