Mercurial > libervia-web
comparison 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 |
comparison
equal
deleted
inserted
replaced
53:dc7861390f10 | 54:f25c4077f6b9 |
---|---|
140 def jsonrpc_getContacts(self): | 140 def jsonrpc_getContacts(self): |
141 """Return all passed args.""" | 141 """Return all passed args.""" |
142 profile = ISATSession(self.session).profile | 142 profile = ISATSession(self.session).profile |
143 return self.sat_host.bridge.getContacts(profile) | 143 return self.sat_host.bridge.getContacts(profile) |
144 | 144 |
145 def jsonrpc_addContact(self, entity, name, groups): | |
146 """Subscribe to contact presence, and add it to the given groups""" | |
147 profile = ISATSession(self.session).profile | |
148 self.sat_host.bridge.addContact(entity, profile) | |
149 self.sat_host.bridge.updateContact(entity, name, groups, profile) | |
150 | |
151 def jsonrpc_subscription(self, sub_type, entity, name, groups): | |
152 """Confirm (or infirm) subscription, | |
153 and setup user roster in case of subscription""" | |
154 profile = ISATSession(self.session).profile | |
155 self.sat_host.bridge.subscription(sub_type, entity, profile) | |
156 if sub_type == 'subscribed': | |
157 self.sat_host.bridge.updateContact(entity, name, groups, profile) | |
158 | |
159 def jsonrpc_getWaitingSub(self): | |
160 """Return list of room already joined by user""" | |
161 profile = ISATSession(self.session).profile | |
162 return self.sat_host.bridge.getWaitingSub(profile) | |
163 | |
145 def jsonrpc_setStatus(self, status): | 164 def jsonrpc_setStatus(self, status): |
146 """Change the status""" | 165 """Change the status""" |
147 profile = ISATSession(self.session).profile | 166 profile = ISATSession(self.session).profile |
148 print "new status received:", status | 167 print "new status received:", status |
149 self.sat_host.bridge.setPresence('', '', 0, {'':status}, profile) | 168 self.sat_host.bridge.setPresence('', '', 0, {'':status}, profile) |
321 | 340 |
322 def _registerNewAccount(self, args): | 341 def _registerNewAccount(self, args): |
323 """Create a new account, or return error | 342 """Create a new account, or return error |
324 @param args: dict of args as given by the form | 343 @param args: dict of args as given by the form |
325 @return: "REGISTRATION" in case of success""" | 344 @return: "REGISTRATION" in case of success""" |
345 #TODO: must be moved in SàT core | |
346 | |
326 try: | 347 try: |
327 profile = login = args['login'][0] | 348 profile = login = args['login'][0] |
328 email = args['email'][0] | 349 email = args['email'][0] |
329 except KeyError: | 350 except KeyError: |
330 return "BAD REQUEST" | 351 return "BAD REQUEST" |
426 _session.notifyOnExpire(onExpire) | 447 _session.notifyOnExpire(onExpire) |
427 | 448 |
428 d = defer.Deferred() | 449 d = defer.Deferred() |
429 self.sat_host.bridge.getMblogNodes(profile, d.callback, d.errback) | 450 self.sat_host.bridge.getMblogNodes(profile, d.callback, d.errback) |
430 d.addCallback(self._fillMblogNodes, _session) | 451 d.addCallback(self._fillMblogNodes, _session) |
452 | |
431 if finish: | 453 if finish: |
432 request.write('LOGGED') | 454 request.write('LOGGED') |
433 request.finish() | 455 request.finish() |
434 else: | 456 else: |
435 return "LOGGED" | 457 return "LOGGED" |
554 sys.exit(1) | 576 sys.exit(1) |
555 self.bridge.register("connected", self.signal_handler.connected) | 577 self.bridge.register("connected", self.signal_handler.connected) |
556 self.bridge.register("connectionError", self.signal_handler.connectionError) | 578 self.bridge.register("connectionError", self.signal_handler.connectionError) |
557 self.bridge.register("actionResult", self.action_handler.actionResultCb, "request") | 579 self.bridge.register("actionResult", self.action_handler.actionResultCb, "request") |
558 for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', | 580 for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', |
559 'tarotGameChooseContrat', 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore']: | 581 'tarotGameChooseContrat', 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', |
582 'subscribe']: | |
560 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) | 583 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) |
561 root.putChild('json_signal_api', self.signal_handler) | 584 root.putChild('json_signal_api', self.signal_handler) |
562 root.putChild('json_api', MethodHandler(self)) | 585 root.putChild('json_api', MethodHandler(self)) |
563 root.putChild('register_api', _register) | 586 root.putChild('register_api', _register) |
564 root.putChild('blog', MicroBlog(self)) | 587 root.putChild('blog', MicroBlog(self)) |