comparison libervia.tac @ 297:19bcd39c77f6

server side: sendMessage is now async
author Goffi <goffi@goffi.org>
date Tue, 17 Dec 2013 01:36:57 +0100
parents 92d76ab67156
children e4f586fc6101
comparison
equal deleted inserted replaced
296:92d76ab67156 297:19bcd39c77f6
227 """ 227 """
228 profile = ISATSession(self.session).profile 228 profile = ISATSession(self.session).profile
229 self.sat_host.bridge.setPresence('', presence, 0, {'': status}, profile) 229 self.sat_host.bridge.setPresence('', presence, 0, {'': status}, profile)
230 230
231 231
232 def jsonrpc_sendMessage(self, to_jid, msg, subject, _type, options={}): 232 def jsonrpc_sendMessage(self, to_jid, msg, subject, type_, options={}):
233 """send message""" 233 """send message"""
234 profile = ISATSession(self.session).profile 234 profile = ISATSession(self.session).profile
235 return self.sat_host.bridge.sendMessage(to_jid, msg, subject, _type, options, profile) 235 return self.asyncBridgeCall("sendMessage", to_jid, msg, subject, type_, options, profile)
236 236
237 def jsonrpc_sendMblog(self, _type, dest, text, extra={}): 237 def jsonrpc_sendMblog(self, type_, dest, text, extra={}):
238 """ Send microblog message 238 """ Send microblog message
239 @param _type: one of "PUBLIC", "GROUP" 239 @param type_: one of "PUBLIC", "GROUP"
240 @param dest: destinees (list of groups, ignored for "PUBLIC") 240 @param dest: destinees (list of groups, ignored for "PUBLIC")
241 @param text: microblog's text 241 @param text: microblog's text
242 """ 242 """
243 profile = ISATSession(self.session).profile 243 profile = ISATSession(self.session).profile
244 extra['allow_comments'] = 'True' 244 extra['allow_comments'] = 'True'
245 245
246 if _type in ("PUBLIC", "GROUP") and text: 246 if type_ in ("PUBLIC", "GROUP") and text:
247 if _type == "PUBLIC": 247 if type_ == "PUBLIC":
248 #This text if for the public microblog 248 #This text if for the public microblog
249 print "sending public blog" 249 print "sending public blog"
250 return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, extra, profile) 250 return self.sat_host.bridge.sendGroupBlog("PUBLIC", [], text, extra, profile)
251 else: 251 else:
252 print "sending group blog" 252 print "sending group blog"