plugins XEP-0060, XEP-0277, groupblog: make use of RSM (XEP-0059)
This commit is contained in:
parent
bbcced67d1
commit
f3b7bd1ec2
3 changed files with 289 additions and 143 deletions
|
|
@ -44,6 +44,7 @@ PLUGIN_INFO = {
|
|||
"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 @@ class XEP_0277(object):
|
|||
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 @@ class XEP_0277(object):
|
|||
@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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue