Add stanza generators for the <storage/> element

This commit is contained in:
mathieui 2011-11-26 23:09:03 +01:00
parent 68c0ddeb29
commit 2ff8e40c22

View file

@ -92,6 +92,18 @@ def remove(value):
value = get_by_jid(value) value = get_by_jid(value)
bookmarks.remove(value) bookmarks.remove(value)
def stanza_pep():
storage = Storage()
for b in filter(lambda b: b.method == 'pep', bookmarks):
storage.append(b.stanza())
return storage
def stanza_privatexml():
storage = Storage()
for b in filter(lambda b: b.method == 'privatexml', bookmarks):
storage.append(b.stanza())
return storage
def save_pep(xmpp): def save_pep(xmpp):
xmpp.plugin['xep_0048'].set_bookmarks(stanza_pep()) xmpp.plugin['xep_0048'].set_bookmarks(stanza_pep())