diff options
author | mathieui <mathieui@mathieui.net> | 2021-04-12 20:43:42 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2021-04-12 20:43:51 +0200 |
commit | fc1eca7ac39bfc0dc82b2809b19b3d1c7b64a2c7 (patch) | |
tree | 43c1e991617df5d981f2c9a704ae0732818c0a16 /poezio/windows/bookmark_forms.py | |
parent | e6510792b4d4dcb0d9e7746fff0dd891cba33e3a (diff) | |
download | poezio-fc1eca7ac39bfc0dc82b2809b19b3d1c7b64a2c7.tar.gz poezio-fc1eca7ac39bfc0dc82b2809b19b3d1c7b64a2c7.tar.bz2 poezio-fc1eca7ac39bfc0dc82b2809b19b3d1c7b64a2c7.tar.xz poezio-fc1eca7ac39bfc0dc82b2809b19b3d1c7b64a2c7.zip |
fix: remove all remaining safejids (fix #3457)
Diffstat (limited to 'poezio/windows/bookmark_forms.py')
-rw-r--r-- | poezio/windows/bookmark_forms.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/poezio/windows/bookmark_forms.py b/poezio/windows/bookmark_forms.py index b8a60763..fb8ad589 100644 --- a/poezio/windows/bookmark_forms.py +++ b/poezio/windows/bookmark_forms.py @@ -4,13 +4,13 @@ Windows used inthe bookmarkstab import curses from typing import List, Tuple, Optional -from poezio.windows import base_wins +from slixmpp import JID, InvalidJID + from poezio.windows.base_wins import Win from poezio.windows.inputs import Input from poezio.windows.data_forms import FieldInput, FieldInputMixin from poezio.theming import to_curses_attr, get_theme -from poezio.common import safeJID from poezio.bookmarks import Bookmark, BookmarkList @@ -33,14 +33,20 @@ class BookmarkJIDInput(FieldInput, Input): def __init__(self, field: Bookmark) -> None: FieldInput.__init__(self, field) Input.__init__(self) - jid = safeJID(field.jid) + try: + jid = JID(field.jid) + except InvalidJID: + jid = JID('') jid.resource = field.nick or None self.text = jid.full self.pos = len(self.text) self.color = get_theme().COLOR_NORMAL_TEXT def save(self) -> None: - jid = safeJID(self.get_text()) + try: + jid = JID(self.get_text()) + except InvalidJID: + jid = JID('') self._field.jid = jid.bare self._field.nick = jid.resource |