comparison libervia.tac @ 202:2bc6cf004e61

browser, server: comments handling: - banner in unibar show a specific message when the message will be a comment - comments are inserted in a subpanel, in chronological order
author Goffi <goffi@goffi.org>
date Thu, 20 Jun 2013 12:16:46 +0200
parents aa76793da353
children 890776a6fdb7
comparison
equal deleted inserted replaced
201:aa76793da353 202:2bc6cf004e61
199 profile = ISATSession(self.session).profile 199 profile = ISATSession(self.session).profile
200 if _type in ("PUBLIC", "GROUP") and text: 200 if _type in ("PUBLIC", "GROUP") and text:
201 if _type == "PUBLIC": 201 if _type == "PUBLIC":
202 #This text if for the public microblog 202 #This text if for the public microblog
203 print "sending public blog" 203 print "sending public blog"
204 return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, profile) 204 return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, {'allow_comments': 'True'}, profile)
205 else: 205 else:
206 print "sending group blog" 206 print "sending group blog"
207 return self.sat_host.bridge.sendGroupBlog("GROUP", [dest], text, profile) 207 return self.sat_host.bridge.sendGroupBlog("GROUP", [dest], text, {'allow_comments': 'True'}, profile)
208 else:
209 raise Exception("Invalid data")
210
211 def jsonrpc_sendMblogComment(self, node, text):
212 """ Send microblog message
213 @param node: url of the comments node
214 @param text: comment
215 """
216 profile = ISATSession(self.session).profile
217 if node and text:
218 return self.sat_host.bridge.sendGroupBlogComment(node, text, profile)
208 else: 219 else:
209 raise Exception("Invalid data") 220 raise Exception("Invalid data")
210 221
211 def jsonrpc_getLastMblogs(self, publisher_jid, max_item): 222 def jsonrpc_getLastMblogs(self, publisher_jid, max_item):
212 """Get last microblogs posted by a contact 223 """Get last microblogs posted by a contact
227 profile = ISATSession(self.session).profile 238 profile = ISATSession(self.session).profile
228 d = defer.Deferred() 239 d = defer.Deferred()
229 self.sat_host.bridge.getMassiveLastGroupBlogs(publishers_type, publishers_list, max_item, profile, callback=d.callback, errback=d.errback) 240 self.sat_host.bridge.getMassiveLastGroupBlogs(publishers_type, publishers_list, max_item, profile, callback=d.callback, errback=d.errback)
230 self.sat_host.bridge.massiveSubscribeGroupBlogs(publishers_type, publishers_list, profile) 241 self.sat_host.bridge.massiveSubscribeGroupBlogs(publishers_type, publishers_list, profile)
231 return d 242 return d
243
244 def jsonrpc_getMblogComments(self, service, node):
245 """Get all comments of given node
246 @param service: jid of the service hosting the node
247 @param node: comments node
248 """
249 profile = ISATSession(self.session).profile
250 d = defer.Deferred()
251 self.sat_host.bridge.getGroupBlogComments(service, node, profile, callback=d.callback, errback=d.errback)
252 return d
253
232 254
233 def jsonrpc_getPresenceStatus(self): 255 def jsonrpc_getPresenceStatus(self):
234 """Get Presence information for connected contacts""" 256 """Get Presence information for connected contacts"""
235 profile = ISATSession(self.session).profile 257 profile = ISATSession(self.session).profile
236 return self.sat_host.bridge.getPresenceStatus(profile) 258 return self.sat_host.bridge.getPresenceStatus(profile)