comparison libervia.tac @ 259:a20815c75c15

server_side: extra data is now added for sendMblog, allowing to send rich text with the 'rich' key.
author Goffi <goffi@goffi.org>
date Fri, 15 Nov 2013 15:06:47 +0100
parents 53c7f0237f1e
children 3df0c3634c29
comparison
equal deleted inserted replaced
258:53c7f0237f1e 259:a20815c75c15
226 def jsonrpc_sendMessage(self, to_jid, msg, subject, _type, options={}): 226 def jsonrpc_sendMessage(self, to_jid, msg, subject, _type, options={}):
227 """send message""" 227 """send message"""
228 profile = ISATSession(self.session).profile 228 profile = ISATSession(self.session).profile
229 return self.sat_host.bridge.sendMessage(to_jid, msg, subject, _type, options, profile) 229 return self.sat_host.bridge.sendMessage(to_jid, msg, subject, _type, options, profile)
230 230
231 def jsonrpc_sendMblog(self, _type, dest, text): 231 def jsonrpc_sendMblog(self, _type, dest, text, extra={}):
232 """ Send microblog message 232 """ Send microblog message
233 @param _type: one of "PUBLIC", "GROUP" 233 @param _type: one of "PUBLIC", "GROUP"
234 @param dest: destinees (list of groups, ignored for "PUBLIC") 234 @param dest: destinees (list of groups, ignored for "PUBLIC")
235 @param text: microblog's text 235 @param text: microblog's text
236 """ 236 """
237 profile = ISATSession(self.session).profile 237 profile = ISATSession(self.session).profile
238 extra['allow_comments'] = 'True'
239
238 if _type in ("PUBLIC", "GROUP") and text: 240 if _type in ("PUBLIC", "GROUP") and text:
239 if _type == "PUBLIC": 241 if _type == "PUBLIC":
240 #This text if for the public microblog 242 #This text if for the public microblog
241 print "sending public blog" 243 print "sending public blog"
242 return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, {'allow_comments': 'True'}, profile) 244 return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, extra, profile)
243 else: 245 else:
244 print "sending group blog" 246 print "sending group blog"
245 return self.sat_host.bridge.sendGroupBlog("GROUP", [dest], text, {'allow_comments': 'True'}, profile) 247 return self.sat_host.bridge.sendGroupBlog("GROUP", [dest], text, extra, profile)
246 else: 248 else:
247 raise Exception("Invalid data") 249 raise Exception("Invalid data")
248 250
249 def jsonrpc_sendMblogComment(self, node, text): 251 def jsonrpc_sendMblogComment(self, node, text):
250 """ Send microblog message 252 """ Send microblog message