# HG changeset patch # User souliane # Date 1378477410 -7200 # Node ID 7b26be266ab164f9b99bfd3379e3d018b7ec4665 # Parent 8bbac49765d645cf1987919712d9dc4bb4121282 plugin XEP-0085: Chat State Notifications TODO: check for security limit in core/memory while setting a parameter diff -r 8bbac49765d6 -r 7b26be266ab1 browser_side/panels.py --- a/browser_side/panels.py Fri Sep 06 16:07:35 2013 +0200 +++ b/browser_side/panels.py Fri Sep 06 16:23:30 2013 +0200 @@ -206,6 +206,14 @@ self.setText('') self._timeCb(None) #we remove the popup sender.cancelKey() + else: + self.__onComposing() + + def __onComposing(self): + """Callback when the user is composing a text.""" + if hasattr(self._selected_cache, "target"): + target_s = str(self._selected_cache.target) + self.host.bridge.call('chatStateComposing', None, target_s) def onMouseUp(self, sender, x, y): size = (self.getOffsetWidth(), self.getOffsetHeight()) diff -r 8bbac49765d6 -r 7b26be266ab1 libervia.tac --- a/libervia.tac Fri Sep 06 16:07:35 2013 +0200 +++ b/libervia.tac Fri Sep 06 16:23:30 2013 +0200 @@ -185,10 +185,10 @@ self.sat_host.bridge.setPresence('', '', 0, {'':status}, profile) - def jsonrpc_sendMessage(self, to_jid, msg, subject, _type): + def jsonrpc_sendMessage(self, to_jid, msg, subject, _type, options={}): """send message""" profile = ISATSession(self.session).profile - return self.sat_host.bridge.sendMessage(to_jid, msg, subject, _type, profile) + return self.sat_host.bridge.sendMessage(to_jid, msg, subject, _type, options, profile) def jsonrpc_sendMblog(self, _type, dest, text): """ Send microblog message @@ -352,22 +352,30 @@ profile = ISATSession(self.session).profile return self.sat_host.bridge.getCard(jid, profile) - #def jsonrpc_getParamsUI(self): - # """Return the parameters XMLUI for profile""" - # profile = ISATSession(self.session).profile - # d = defer.Deferred() - # self.sat_host.bridge.getParamsUI(profile, callback=d.callback, errback=d.errback) - # #d.addCallback(lambda result: unicode(result)) - # return d + def jsonrpc_getParamsUI(self): + """Return the parameters XMLUI for profile""" + profile = ISATSession(self.session).profile + d = defer.Deferred() + security_limit = 0 + self.sat_host.bridge.getParamsUI(security_limit, profile, callback=d.callback, errback=d.errback) + return d - #def jsonrpc_setParam(self, name, value, category): - # profile = ISATSession(self.session).profile - # return self.sat_host.bridge.setParam(name, value, category, profile) + def jsonrpc_setParam(self, name, value, category): + profile = ISATSession(self.session).profile + return self.sat_host.bridge.setParam(name, value, category, profile) def jsonrpc_launchAction(self, action_type, data): profile = ISATSession(self.session).profile return self.sat_host.bridge.launchAction(action_type, data, profile) + def jsonrpc_chatStateComposing(self, to_jid_s): + """Broadcast a signal for "composing" state. + @param to_jid_s: contact the user is composing to + """ + profile = ISATSession(self.session).profile + self.sat_host.bridge.chatStateComposing(to_jid_s, profile) + + class Register(jsonrpc.JSONRPC): """This class manage the registration procedure with SàT It provide an api for the browser, check password and setup the web server""" @@ -782,7 +790,8 @@ #plugins for signal_name in ['personalEvent', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', 'tarotGameChooseContrat', 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', - 'radiocolStarted', 'radiocolPreload', 'radiocolPlay', 'radiocolNoUpload', 'radiocolUploadOk', 'radiocolSongRejected']: + 'radiocolStarted', 'radiocolPreload', 'radiocolPlay', 'radiocolNoUpload', 'radiocolUploadOk', 'radiocolSongRejected', + 'chatStateReceived']: self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name), "plugin") self.media_dir = self.bridge.getConfig('','media_dir') self.local_dir = self.bridge.getConfig('','local_dir')