From fc1eca7ac39bfc0dc82b2809b19b3d1c7b64a2c7 Mon Sep 17 00:00:00 2001 From: mathieui Date: Mon, 12 Apr 2021 20:43:42 +0200 Subject: fix: remove all remaining safejids (fix #3457) --- poezio/windows/info_wins.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'poezio/windows/info_wins.py') diff --git a/poezio/windows/info_wins.py b/poezio/windows/info_wins.py index 5278e3b8..23d28cc1 100644 --- a/poezio/windows/info_wins.py +++ b/poezio/windows/info_wins.py @@ -8,9 +8,9 @@ from __future__ import annotations from typing import Optional, Dict, TYPE_CHECKING, Any import logging -log = logging.getLogger(__name__) -from poezio.common import safeJID +from slixmpp import JID, InvalidJID + from poezio.config import config from poezio.windows.base_wins import Win @@ -22,6 +22,8 @@ if TYPE_CHECKING: from poezio.tabs import MucTab from poezio.windows import TextWin +log = logging.getLogger(__name__) + class InfoWin(Win): """ @@ -101,7 +103,10 @@ class PrivateInfoWin(InfoWin): to_curses_attr(get_theme().COLOR_INFORMATION_BAR)) def write_room_name(self, name): - jid = safeJID(name) + try: + jid = JID(name) + except InvalidJID: + jid = JID('') room_name, nick = jid.bare, jid.resource theme = get_theme() self.addstr(nick, to_curses_attr(theme.COLOR_PRIVATE_NAME)) @@ -158,7 +163,10 @@ class ConversationInfoWin(InfoWin): # from someone not in our roster. In this case, we display # only the maximum information from the message we can get. log.debug('Refresh: %s', self.__class__.__name__) - jid = safeJID(jid) + try: + jid = JID(jid) + except InvalidJID: + jid = JID('') if contact: if jid.resource: resource = contact[jid.full] @@ -363,7 +371,10 @@ class ConversationStatusMessageWin(InfoWin): def refresh(self, jid, contact): log.debug('Refresh: %s', self.__class__.__name__) - jid = safeJID(jid) + try: + jid = JID(jid) + except InvalidJID: + jid = JID('') if contact: if jid.resource: resource = contact[jid.full] -- cgit v1.2.3