Mercurial > libervia-web
diff src/server/server.py @ 586:3eb3a2c0c011
browser and server side: uses RSM (XEP-0059)
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 28 Nov 2014 00:31:27 +0100 |
parents | 8a607044ecfa |
children | a90cc8fc9605 |
line wrap: on
line diff
--- a/src/server/server.py Thu Oct 23 16:56:36 2014 +0200 +++ b/src/server/server.py Fri Nov 28 00:31:27 2014 +0100 @@ -301,51 +301,46 @@ else: raise Exception("Invalid data") - def jsonrpc_getMblogs(self, publisher_jid, item_ids): + def jsonrpc_getMblogs(self, publisher_jid, item_ids, max_items=C.RSM_MAX_ITEMS): """Get specified microblogs posted by a contact @param publisher_jid: jid of the publisher @param item_ids: list of microblogs items IDs @return list of microblog data (dict)""" profile = ISATSession(self.session).profile - d = self.asyncBridgeCall("getGroupBlogs", publisher_jid, item_ids, profile) + d = self.asyncBridgeCall("getGroupBlogs", publisher_jid, item_ids, {'max': unicode(max_items)}, False, profile) return d - def jsonrpc_getMblogsWithComments(self, publisher_jid, item_ids): + def jsonrpc_getMblogsWithComments(self, publisher_jid, item_ids, max_comments=C.RSM_MAX_COMMENTS): """Get specified microblogs posted by a contact and their comments @param publisher_jid: jid of the publisher @param item_ids: list of microblogs items IDs @return list of couple (microblog data, list of microblog data)""" profile = ISATSession(self.session).profile - d = self.asyncBridgeCall("getGroupBlogsWithComments", publisher_jid, item_ids, profile) + d = self.asyncBridgeCall("getGroupBlogsWithComments", publisher_jid, item_ids, {}, max_comments, profile) return d - def jsonrpc_getLastMblogs(self, publisher_jid, max_item): - """Get last microblogs posted by a contact - @param publisher_jid: jid of the publisher - @param max_item: number of items to ask - @return list of microblog data (dict)""" - profile = ISATSession(self.session).profile - d = self.asyncBridgeCall("getLastGroupBlogs", publisher_jid, max_item, profile) - return d - - def jsonrpc_getMassiveLastMblogs(self, publishers_type, publishers_list, max_item): + def jsonrpc_getMassiveMblogs(self, publishers_type, publishers_list, rsm=None): """Get lasts microblogs posted by several contacts at once @param publishers_type: one of "ALL", "GROUP", "JID" @param publishers_list: list of publishers type (empty list of all, list of groups or list of jids) @param max_item: number of items to ask @return: dictionary key=publisher's jid, value=list of microblog data (dict)""" profile = ISATSession(self.session).profile - d = self.asyncBridgeCall("getMassiveLastGroupBlogs", publishers_type, publishers_list, max_item, profile) + if rsm is None: + rsm = {'max': unicode(C.RSM_MAX_ITEMS)} + d = self.asyncBridgeCall("getMassiveGroupBlogs", publishers_type, publishers_list, rsm, profile) self.sat_host.bridge.massiveSubscribeGroupBlogs(publishers_type, publishers_list, profile) return d - def jsonrpc_getMblogComments(self, service, node): + def jsonrpc_getMblogComments(self, service, node, rsm=None): """Get all comments of given node @param service: jid of the service hosting the node @param node: comments node """ profile = ISATSession(self.session).profile - d = self.asyncBridgeCall("getGroupBlogComments", service, node, profile) + if rsm is None: + rsm = {'max': unicode(C.RSM_MAX_COMMENTS)} + d = self.asyncBridgeCall("getGroupBlogComments", service, node, rsm, profile) return d def jsonrpc_getPresenceStatuses(self):