Mercurial > libervia-web
diff libervia.tac @ 54:f25c4077f6b9
addind contact + subscription management + misc
- removed bad html_sanitize (not needed in Label !)
- added isContactInRoster method in ContactPanel
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 28 May 2011 20:18:14 +0200 |
parents | 72c51a4839cc |
children | d5266c41ca24 |
line wrap: on
line diff
--- a/libervia.tac Sat May 28 20:14:38 2011 +0200 +++ b/libervia.tac Sat May 28 20:18:14 2011 +0200 @@ -142,6 +142,25 @@ profile = ISATSession(self.session).profile return self.sat_host.bridge.getContacts(profile) + def jsonrpc_addContact(self, entity, name, groups): + """Subscribe to contact presence, and add it to the given groups""" + profile = ISATSession(self.session).profile + self.sat_host.bridge.addContact(entity, profile) + self.sat_host.bridge.updateContact(entity, name, groups, profile) + + def jsonrpc_subscription(self, sub_type, entity, name, groups): + """Confirm (or infirm) subscription, + and setup user roster in case of subscription""" + profile = ISATSession(self.session).profile + self.sat_host.bridge.subscription(sub_type, entity, profile) + if sub_type == 'subscribed': + self.sat_host.bridge.updateContact(entity, name, groups, profile) + + def jsonrpc_getWaitingSub(self): + """Return list of room already joined by user""" + profile = ISATSession(self.session).profile + return self.sat_host.bridge.getWaitingSub(profile) + def jsonrpc_setStatus(self, status): """Change the status""" profile = ISATSession(self.session).profile @@ -323,6 +342,8 @@ """Create a new account, or return error @param args: dict of args as given by the form @return: "REGISTRATION" in case of success""" + #TODO: must be moved in SàT core + try: profile = login = args['login'][0] email = args['email'][0] @@ -428,6 +449,7 @@ d = defer.Deferred() self.sat_host.bridge.getMblogNodes(profile, d.callback, d.errback) d.addCallback(self._fillMblogNodes, _session) + if finish: request.write('LOGGED') request.finish() @@ -556,7 +578,8 @@ self.bridge.register("connectionError", self.signal_handler.connectionError) self.bridge.register("actionResult", self.action_handler.actionResultCb, "request") for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', - 'tarotGameChooseContrat', 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore']: + 'tarotGameChooseContrat', 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', + 'subscribe']: self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) root.putChild('json_signal_api', self.signal_handler) root.putChild('json_api', MethodHandler(self))