Commit d62a2170 authored by Maxime Buquet's avatar Maxime Buquet

bookmarks: Convert specified jid to JID object if possible

Signed-off-by: Maxime Buquet's avatarMaxime “pep” Buquet <pep@bouah.net>
parent 01bca5cc
......@@ -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
......
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