diff libervia.tac @ 110:dfc02690deb4

browser side: CSS: header, unibox, tabs + drag'n' drop reworked
author Adrien Vigneron <adrienvigneron@mailoo.org>
date Wed, 29 Jun 2011 23:52:00 +0200
parents c3fb3292f582
children 2e2e10785c33
line wrap: on
line diff
--- a/libervia.tac	Wed Jun 29 20:24:09 2011 +0200
+++ b/libervia.tac	Wed Jun 29 23:52:00 2011 +0200
@@ -53,6 +53,7 @@
 TIMEOUT = 10 #Session's time out, after that the user will be disconnected
 LIBERVIA_DIR = "output/"
 MEDIA_DIR = "media/"
+AVATARS_DIR = "avatars/"
 CARDS_DIR = "games/cards/tarot"
 
 class ISATSession(Interface):
@@ -262,6 +263,14 @@
         profile = ISATSession(self.session).profile
         self.sat_host.bridge.tarotGamePlayCards(player_nick, referee, cards, profile)
 
+    def jsonrpc_getAvatar(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'])
+
 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"""
@@ -613,6 +622,7 @@
         root.putChild('blog', MicroBlog(self))
         root.putChild('css', ProtectedFile("server_css/"))
         root.putChild(os.path.dirname(MEDIA_DIR), ProtectedFile(self.media_dir))
+        root.putChild(os.path.dirname(AVATARS_DIR), ProtectedFile(os.path.join(self.local_dir, AVATARS_DIR)))
         self.site = server.Site(root)
         self.site.sessionFactory = LiberviaSession