diff options
-rw-r--r-- | poezio/bookmarks.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/poezio/bookmarks.py b/poezio/bookmarks.py index ced6fde6..a812ef03 100644 --- a/poezio/bookmarks.py +++ b/poezio/bookmarks.py @@ -41,13 +41,20 @@ log = logging.getLogger(__name__) class Bookmark: def __init__(self, - jid: JID, + jid: Union[JID, str], name: Optional[str] = None, autojoin=False, nick: Optional[str] = None, password: Optional[str] = None, method='local') -> None: - self.jid = jid + try: + if isinstance(jid, JID): + self.jid = jid + else: + self.jid = JID(jid) + except InvalidJID: + log.debug('Invalid JID %r provided for bookmark %r', jid, name) + raise self.name = name or jid self.autojoin = autojoin self.nick = nick |