Mercurial > libervia-web
diff libervia.tac @ 132:30d8e328559b
server & browser side: microblogging refactoring first draft
- use of new getLastGroupBlogs and getMassiveLastGroupBlogs methods
- microblgos browser's cache is temporarily deactivated
- last 10 microblogs for everybody are requested on new meta microblog widget
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 02 Apr 2012 00:25:38 +0200 |
parents | ddfcc4cb6cee |
children | 4ad621df9e34 |
line wrap: on
line diff
--- a/libervia.tac Tue Mar 06 09:09:15 2012 +0100 +++ b/libervia.tac Mon Apr 02 00:25:38 2012 +0200 @@ -201,6 +201,27 @@ return self.sat_host.bridge.sendPersonalEvent("MICROBLOG", {'content':text}, profile) else: return self.sat_host.bridge.sendGroupBlog([recip], text, profile) + + 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 = defer.Deferred() + self.sat_host.bridge.getLastGroupBlogs(publisher_jid, max_item, profile, callback=d.callback, errback=d.errback) + return d + + def jsonrpc_getMassiveLastMblogs(self, publishers_type, publishers_list, max_item): + """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 = defer.Deferred() + self.sat_host.bridge.getMassiveLastGroupBlogs(publishers_type, publishers_list, max_item, profile, callback=d.callback, errback=d.errback) + return d def jsonrpc_getPresenceStatus(self): """Get Presence information for connected contacts""" @@ -301,10 +322,6 @@ else: return None - def _fillMblogNodes(self, result, session): - """Fill the microblog nodes association for this session""" - session.sat_mblog_nodes = dict(result) - def render(self, request): """ Render method with some hacks: @@ -514,8 +531,6 @@ _session.notifyOnExpire(onExpire) d = defer.Deferred() - self.sat_host.bridge.getMblogNodes(profile, d.callback, d.errback) - d.addCallback(self._fillMblogNodes, _session) return result('LOGGED') def _logginError(self, login, request, error_type):