diff options
author | mathieui <mathieui@mathieui.net> | 2011-11-26 23:06:11 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2011-11-26 23:06:11 +0100 |
commit | 2f5ecf24b7d4394901389a0ab2f2fe1fd9c37114 (patch) | |
tree | aad7b34b307083e1c816787afc60a2d06fd25270 | |
parent | 64b8970d259171b5f59807fab77a149c0df630c7 (diff) | |
download | poezio-2f5ecf24b7d4394901389a0ab2f2fe1fd9c37114.tar.gz poezio-2f5ecf24b7d4394901389a0ab2f2fe1fd9c37114.tar.bz2 poezio-2f5ecf24b7d4394901389a0ab2f2fe1fd9c37114.tar.xz poezio-2f5ecf24b7d4394901389a0ab2f2fe1fd9c37114.zip |
Add a parser from xml Element to Bookmark
-rw-r--r-- | src/bookmark.py | 17 |
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) + |