summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bookmark.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/bookmark.py b/src/bookmark.py
index 8b4fed27..66a89830 100644
--- a/src/bookmark.py
+++ b/src/bookmark.py
@@ -56,3 +56,20 @@ class Bookmark(object):
p.text = self.password
el.append(p)
return el
+
+ def parse_from_element(el, method=None):
+ """
+ Generate a Bookmark object from a <conference/> element
+ """
+ jid = el.get('jid')
+ name = el.get('name')
+ autojoin = True if el.get('autojoin', False) == 'true' else False
+ nick = None
+ for n in el.iter('nick'):
+ nick = nick.text
+ password = None
+ for p in el.iter('password'):
+ password = p.text
+
+ return Bookmark(jid, name, autojoin, nick, password, method)
+