Mercurial > libervia-web
comparison libervia.tac @ 214:7b26be266ab1
plugin XEP-0085: Chat State Notifications
TODO: check for security limit in core/memory while setting a parameter
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 06 Sep 2013 16:23:30 +0200 |
parents | 890776a6fdb7 |
children | e830a0c60d32 |
comparison
equal
deleted
inserted
replaced
213:8bbac49765d6 | 214:7b26be266ab1 |
---|---|
183 """Change the status""" | 183 """Change the status""" |
184 profile = ISATSession(self.session).profile | 184 profile = ISATSession(self.session).profile |
185 self.sat_host.bridge.setPresence('', '', 0, {'':status}, profile) | 185 self.sat_host.bridge.setPresence('', '', 0, {'':status}, profile) |
186 | 186 |
187 | 187 |
188 def jsonrpc_sendMessage(self, to_jid, msg, subject, _type): | 188 def jsonrpc_sendMessage(self, to_jid, msg, subject, _type, options={}): |
189 """send message""" | 189 """send message""" |
190 profile = ISATSession(self.session).profile | 190 profile = ISATSession(self.session).profile |
191 return self.sat_host.bridge.sendMessage(to_jid, msg, subject, _type, profile) | 191 return self.sat_host.bridge.sendMessage(to_jid, msg, subject, _type, options, profile) |
192 | 192 |
193 def jsonrpc_sendMblog(self, _type, dest, text): | 193 def jsonrpc_sendMblog(self, _type, dest, text): |
194 """ Send microblog message | 194 """ Send microblog message |
195 @param _type: one of "PUBLIC", "GROUP" | 195 @param _type: one of "PUBLIC", "GROUP" |
196 @param dest: destinees (list of groups, ignored for "PUBLIC") | 196 @param dest: destinees (list of groups, ignored for "PUBLIC") |
350 @param jid: jid of contact from who we want data | 350 @param jid: jid of contact from who we want data |
351 @return: id to retrieve the profile""" | 351 @return: id to retrieve the profile""" |
352 profile = ISATSession(self.session).profile | 352 profile = ISATSession(self.session).profile |
353 return self.sat_host.bridge.getCard(jid, profile) | 353 return self.sat_host.bridge.getCard(jid, profile) |
354 | 354 |
355 #def jsonrpc_getParamsUI(self): | 355 def jsonrpc_getParamsUI(self): |
356 # """Return the parameters XMLUI for profile""" | 356 """Return the parameters XMLUI for profile""" |
357 # profile = ISATSession(self.session).profile | 357 profile = ISATSession(self.session).profile |
358 # d = defer.Deferred() | 358 d = defer.Deferred() |
359 # self.sat_host.bridge.getParamsUI(profile, callback=d.callback, errback=d.errback) | 359 security_limit = 0 |
360 # #d.addCallback(lambda result: unicode(result)) | 360 self.sat_host.bridge.getParamsUI(security_limit, profile, callback=d.callback, errback=d.errback) |
361 # return d | 361 return d |
362 | 362 |
363 #def jsonrpc_setParam(self, name, value, category): | 363 def jsonrpc_setParam(self, name, value, category): |
364 # profile = ISATSession(self.session).profile | 364 profile = ISATSession(self.session).profile |
365 # return self.sat_host.bridge.setParam(name, value, category, profile) | 365 return self.sat_host.bridge.setParam(name, value, category, profile) |
366 | 366 |
367 def jsonrpc_launchAction(self, action_type, data): | 367 def jsonrpc_launchAction(self, action_type, data): |
368 profile = ISATSession(self.session).profile | 368 profile = ISATSession(self.session).profile |
369 return self.sat_host.bridge.launchAction(action_type, data, profile) | 369 return self.sat_host.bridge.launchAction(action_type, data, profile) |
370 | 370 |
371 def jsonrpc_chatStateComposing(self, to_jid_s): | |
372 """Broadcast a signal for "composing" state. | |
373 @param to_jid_s: contact the user is composing to | |
374 """ | |
375 profile = ISATSession(self.session).profile | |
376 self.sat_host.bridge.chatStateComposing(to_jid_s, profile) | |
377 | |
378 | |
371 class Register(jsonrpc.JSONRPC): | 379 class Register(jsonrpc.JSONRPC): |
372 """This class manage the registration procedure with SàT | 380 """This class manage the registration procedure with SàT |
373 It provide an api for the browser, check password and setup the web server""" | 381 It provide an api for the browser, check password and setup the web server""" |
374 | 382 |
375 def __init__(self, sat_host): | 383 def __init__(self, sat_host): |
780 for signal_name in ['presenceUpdate', 'newMessage', 'subscribe', 'contactDeleted', 'newContact', 'entityDataUpdated']: | 788 for signal_name in ['presenceUpdate', 'newMessage', 'subscribe', 'contactDeleted', 'newContact', 'entityDataUpdated']: |
781 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) | 789 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) |
782 #plugins | 790 #plugins |
783 for signal_name in ['personalEvent', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', 'tarotGameChooseContrat', | 791 for signal_name in ['personalEvent', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', 'tarotGameChooseContrat', |
784 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', | 792 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', |
785 'radiocolStarted', 'radiocolPreload', 'radiocolPlay', 'radiocolNoUpload', 'radiocolUploadOk', 'radiocolSongRejected']: | 793 'radiocolStarted', 'radiocolPreload', 'radiocolPlay', 'radiocolNoUpload', 'radiocolUploadOk', 'radiocolSongRejected', |
794 'chatStateReceived']: | |
786 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name), "plugin") | 795 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name), "plugin") |
787 self.media_dir = self.bridge.getConfig('','media_dir') | 796 self.media_dir = self.bridge.getConfig('','media_dir') |
788 self.local_dir = self.bridge.getConfig('','local_dir') | 797 self.local_dir = self.bridge.getConfig('','local_dir') |
789 root.putChild('', Redirect('libervia.html')) | 798 root.putChild('', Redirect('libervia.html')) |
790 root.putChild('json_signal_api', self.signal_handler) | 799 root.putChild('json_signal_api', self.signal_handler) |