summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--poezio/bookmarks.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/poezio/bookmarks.py b/poezio/bookmarks.py
index 074566cd..ccda2b93 100644
--- a/poezio/bookmarks.py
+++ b/poezio/bookmarks.py
@@ -49,19 +49,35 @@ class Bookmark:
method='local') -> None:
try:
if isinstance(jid, JID):
- self.jid = jid
+ self._jid = jid
else:
- self.jid = JID(jid)
+ self._jid = JID(jid)
except InvalidJID:
- log.debug('Invalid JID %r provided for bookmark %r', jid, name)
+ log.debug('Invalid JID %r provided for bookmark', jid)
raise
- self.name = name or str(jid)
+ self.name = name or str(self.jid)
self.autojoin = autojoin
self.nick = nick
self.password = password
self._method = method
@property
+ def jid(self) -> JID:
+ """Jid getter"""
+ return self._jid
+
+ @jid.setter
+ def jid(self, jid: JID) -> None:
+ try:
+ if isinstance(jid, JID):
+ self._jid = jid
+ else:
+ self._jid = JID(jid)
+ except InvalidJID:
+ log.debug('Invalid JID %r provided for bookmark', jid)
+ raise
+
+ @property
def method(self) -> str:
return self._method