comparison libervia.tac @ 55:d5266c41ca24

Roster list update, contact deletion + some refactoring
author Goffi <goffi@goffi.org>
date Sun, 29 May 2011 02:13:53 +0200
parents f25c4077f6b9
children e552a67b933d
comparison
equal deleted inserted replaced
54:f25c4077f6b9 55:d5266c41ca24
145 def jsonrpc_addContact(self, entity, name, groups): 145 def jsonrpc_addContact(self, entity, name, groups):
146 """Subscribe to contact presence, and add it to the given groups""" 146 """Subscribe to contact presence, and add it to the given groups"""
147 profile = ISATSession(self.session).profile 147 profile = ISATSession(self.session).profile
148 self.sat_host.bridge.addContact(entity, profile) 148 self.sat_host.bridge.addContact(entity, profile)
149 self.sat_host.bridge.updateContact(entity, name, groups, profile) 149 self.sat_host.bridge.updateContact(entity, name, groups, profile)
150
151 def jsonrpc_delContact(self, entity):
152 """Remove contact from contacts list"""
153 profile = ISATSession(self.session).profile
154 self.sat_host.bridge.delContact(entity, profile)
150 155
151 def jsonrpc_subscription(self, sub_type, entity, name, groups): 156 def jsonrpc_subscription(self, sub_type, entity, name, groups):
152 """Confirm (or infirm) subscription, 157 """Confirm (or infirm) subscription,
153 and setup user roster in case of subscription""" 158 and setup user roster in case of subscription"""
154 profile = ISATSession(self.session).profile 159 profile = ISATSession(self.session).profile
577 self.bridge.register("connected", self.signal_handler.connected) 582 self.bridge.register("connected", self.signal_handler.connected)
578 self.bridge.register("connectionError", self.signal_handler.connectionError) 583 self.bridge.register("connectionError", self.signal_handler.connectionError)
579 self.bridge.register("actionResult", self.action_handler.actionResultCb, "request") 584 self.bridge.register("actionResult", self.action_handler.actionResultCb, "request")
580 for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', 585 for signal_name in ['presenceUpdate', 'personalEvent', 'newMessage', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew',
581 'tarotGameChooseContrat', 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', 586 'tarotGameChooseContrat', 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore',
582 'subscribe']: 587 'subscribe', 'contactDeleted', 'newContact']:
583 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) 588 self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name))
584 root.putChild('json_signal_api', self.signal_handler) 589 root.putChild('json_signal_api', self.signal_handler)
585 root.putChild('json_api', MethodHandler(self)) 590 root.putChild('json_api', MethodHandler(self))
586 root.putChild('register_api', _register) 591 root.putChild('register_api', _register)
587 root.putChild('blog', MicroBlog(self)) 592 root.putChild('blog', MicroBlog(self))