Commit a7826b7b authored by Maxime Buquet's avatar Maxime Buquet

ChatTab: Change meaning

`` is now its own property. It only mirrors `ChatTab.jid`
when it is None for compat reasons.

If code tries to set `` and it is a valid JID, `ChatTab.jid`
is set instead for compat reasons and `` stays with its
previous value.

To have `` mirror `ChatTab.jid` again, set it to None.
Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <>
parent 0a478113
......@@ -470,7 +470,7 @@ class ChatTab(Tab):
assert jid.domain
self._jid = jid
self._name = jid.full
self._name = jid.full # type: Optional[str]
self.text_win = None
self.directed_presence = None
self._text_buffer = TextBuffer()
......@@ -517,24 +517,23 @@ class ChatTab(Tab):
def name(self) -> str:
if self._jid is not None:
return self._jid.full
if self._name is not None:
return self._name
return self._jid.full
def name(self, value: Union[JID, str]) -> None:
if isinstance(value, JID):
self._jid = value
self.jid = value
elif isinstance(value, str):
value = JID(value)
if value.domain:
self._jid = value
self._name = value.full
except InvalidJID:
self._name = value
raise TypeError("Name must be of type JID or str.")
raise TypeError("Name %r must be of type JID or str." % value)
def jid(self) -> JID:
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