plugin groupblog: added getLastGroupBlogs method
This commit is contained in:
parent
1a329be228
commit
26f59a523e
1 changed files with 77 additions and 38 deletions
|
|
@ -75,7 +75,7 @@ class XEP_0277():
|
|||
doc = {
|
||||
})
|
||||
|
||||
def _item2mbdata(self, item):
|
||||
def item2mbdata(self, item):
|
||||
"""Convert an XML Item to microblog data used in bridge API
|
||||
@param item: domish.Element of microblog item
|
||||
@return: microblog data (dictionary)"""
|
||||
|
|
@ -110,7 +110,7 @@ class XEP_0277():
|
|||
|
||||
def microblogCB(self, itemsEvent, profile):
|
||||
for item in itemsEvent.items:
|
||||
microblog_data = self._item2mbdata(item)
|
||||
microblog_data = self.item2mbdata(item)
|
||||
self.host.bridge.personalEvent(itemsEvent.sender.full(), "MICROBLOG", microblog_data, profile)
|
||||
|
||||
def data2entry(self, data, profile):
|
||||
|
|
@ -149,14 +149,14 @@ class XEP_0277():
|
|||
def getLastMicroblogs(self, pub_jid, max_items=10, profile_key='@DEFAULT@', callback=None, errback=None):
|
||||
"""Get the last published microblogs
|
||||
@param pub_jid: jid of the publisher
|
||||
@param max_items: how many microblogs we wants to get
|
||||
@param max_items: how many microblogs we want to get
|
||||
@param profile_key: profile key
|
||||
@param callback: used for the async answer
|
||||
@param errback: used for the async answer
|
||||
"""
|
||||
assert(callback)
|
||||
d = self.host.plugins["XEP-0060"].getItems(jid.JID(pub_jid), NS_MICROBLOG, max_items=max_items, profile_key=profile_key)
|
||||
d.addCallbacks(lambda items: callback(map(self._item2mbdata, items)), errback)
|
||||
d.addCallbacks(lambda items: callback(map(self.item2mbdata, items)), errback)
|
||||
|
||||
def setMicroblogAccess(self, access="presence", profile_key='@DEFAULT@', callback=None, errback=None):
|
||||
"""Create a microblog node on PEP with given access
|
||||
|
|
|
|||
Loading…
Reference in a new issue