diff libervia.py @ 127:e19a8de8b3de

radio collective first draft
author Goffi <goffi@goffi.org>
date Sun, 22 Jan 2012 19:38:05 +0100
parents adecb2566b53
children 2849ec993d89
line wrap: on
line diff
--- a/libervia.py	Thu Jan 05 00:43:13 2012 +0100
+++ b/libervia.py	Sun Jan 22 19:38:05 2012 +0100
@@ -241,6 +241,8 @@
              name == 'tarotGameYourTurn' or \
              name == 'tarotGameScore':
             self._tarotGameGenericCb(name, args[0], args[1:])
+        elif name == 'radiocolStarted':
+            self._radioColStartedCb(*args)
         elif name == 'subscribe':
             self._subscribeCb(*args)
         elif name == 'contactDeleted':
@@ -310,8 +312,6 @@
             other = _to if _from.bare == self.whoami.bare else _from
             self.contact_panel.setContactMessageWaiting(other.bare, True)
             
-
-
     def _presenceUpdateCb(self, entity, show, priority, statuses):
         _entity = JID(entity)
         #XXX: QnD way to get our status
@@ -327,6 +327,8 @@
         chat_panel.setUserNick(user_nick)
         if _target.node.startswith('sat_tarot_'): #XXX: it's not really beautiful, but it works :)
             self.addTab(chat_panel, "Tarot")
+        elif _target.node.startswith('sat_radiocol_'):
+            self.addTab(chat_panel, "Radio collective")
         else:
             self.addTab(chat_panel, _target.node)
         chat_panel.setPresents(room_nicks)
@@ -353,6 +355,11 @@
             if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid:
                 getattr(lib_wid.getGame("Tarot"), event_name)(*args) 
 
+    def _radioColStartedCb(self, room_jid, referee):
+        for lib_wid in self.libervia_widgets:
+            if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid:
+                lib_wid.startGame("RadioCol", referee)
+    
     def _getPresenceStatusCb(self, presence_data):
         for entity in presence_data:
             for resource in presence_data[entity]: