changeset 117:2e2e10785c33

server side: refactored signal according to SàT's bridge changes + getCardCache handling + updatedValue handling
author Goffi <goffi@goffi.org>
date Wed, 06 Jul 2011 01:09:19 +0200
parents aff34642616b
children a2a21e0290dc
files libervia.tac
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libervia.tac	Tue Jul 05 14:06:03 2011 +0200
+++ b/libervia.tac	Wed Jul 06 01:09:19 2011 +0200
@@ -263,13 +263,11 @@
         profile = ISATSession(self.session).profile
         self.sat_host.bridge.tarotGamePlayCards(player_nick, referee, cards, profile)
 
-    def jsonrpc_getAvatar(self, jid):
+    def jsonrpc_getCardCache(self, jid):
         """Get the avatar of a contact
         @param jid: jid of contact from who we want the avatar
         @return: path to the avatar image"""
-        cache = self.bridge.getCardCache(jid)
-        if cache.has_key('avatar'): 
-            return self.bridge.getAvatarFile(cache['avatar'])
+        return self.sat_host.bridge.getCardCache(jid)
 
 class Register(jsonrpc.JSONRPC):
     """This class manage the registration procedure with SàT
@@ -609,11 +607,14 @@
             sys.exit(1)
         self.bridge.register("connected", self.signal_handler.connected)
         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',
-                            'subscribe', 'contactDeleted', 'newContact']:
+        self.bridge.register("actionResult", self.action_handler.actionResultCb) 
+        #core
+        for signal_name in ['presenceUpdate', 'newMessage', 'subscribe', 'contactDeleted', 'newContact', 'updatedValue']:
             self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name))
+        #plugins
+        for signal_name in ['personalEvent', 'roomJoined', 'roomUserJoined', 'roomUserLeft', 'tarotGameStarted', 'tarotGameNew', 'tarotGameChooseContrat',
+                            'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore']:
+            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')
         root.putChild('json_signal_api', self.signal_handler)