Mercurial > libervia-backend
diff src/plugins/plugin_xep_0277.py @ 1268:bb30bf3ae932
plugins XEP-0060, XEP-0277, groupblog: make use of RSM (XEP-0059)
author | souliane <souliane@mailoo.org> |
---|---|
date | Mon, 15 Dec 2014 14:04:19 +0100 |
parents | 0b87d029f0a3 |
children | 54a898821740 |
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0277.py Mon Dec 15 14:03:13 2014 +0100 +++ b/src/plugins/plugin_xep_0277.py Mon Dec 15 14:04:19 2014 +0100 @@ -44,6 +44,7 @@ "type": "XEP", "protocols": [], "dependencies": ["XEP-0163", "XEP-0060", "TEXT-SYNTAXES"], + "recommendations": ["XEP-0059"], "main": "XEP_0277", "handler": "no", "description": _("""Implementation of microblogging Protocol""") @@ -77,8 +78,8 @@ def parseCommentUrl(self, node_url): """Determine the fields comments_service and comments_node of a microblog data from the href attribute of an entry's link element. For example this input: - xmpp:sat-pubsub.libervia.org?node=urn%3Axmpp%3Acomments%3A_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn%3Axmpp%3Agroupblog%3Asouliane%libervia.org - will return (JID(u'sat-pubsub.libervia.org'), 'urn:xmpp:comments:_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn:xmpp:groupblog:souliane%libervia.org') + xmpp:sat-pubsub.libervia.org?node=urn%3Axmpp%3Acomments%3A_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn%3Axmpp%3Agroupblog%3Asouliane%40libervia.org + will return (JID(u'sat-pubsub.libervia.org'), 'urn:xmpp:comments:_c5c4a142-2279-4b2a-ba4c-1bc33aa87634__urn:xmpp:groupblog:souliane@libervia.org') @return: a tuple (JID, str) """ parsed_url = urlparse.urlparse(node_url, 'xmpp') @@ -315,10 +316,12 @@ @param pub_jid: jid of the publisher @param max_items: how many microblogs we want to get @param profile_key: profile key + + @return: a deferred couple with the list of items and RSM information. """ d = self.host.plugins["XEP-0060"].getItems(jid.JID(pub_jid), NS_MICROBLOG, max_items=max_items, profile_key=profile_key) - d.addCallback(lambda items: defer.DeferredList(map(self.item2mbdata, items), consumeErrors=True)) - d.addCallback(lambda result: [value for (success, value) in result if success]) + d.addCallback(lambda res: (defer.DeferredList(map(self.item2mbdata, res[0]), consumeErrors=True), res[1])) + d.addCallback(lambda res: ([value for (success, value) in res[0] if success], res[1])) return d def setMicroblogAccess(self, access="presence", profile_key=C.PROF_KEY_NONE):