diff libervia.tac @ 268:79970bf6af93

browser_side: added class RoomAndContactsChooser: - unified UI for all the MUC menu items callbacks to join a room, invite people and start a game
author souliane <souliane@mailoo.org>
date Sun, 17 Nov 2013 17:57:14 +0100
parents cc778206b7ae
children a763b2ac5d41
line wrap: on
line diff
--- a/libervia.tac	Sun Nov 17 17:53:37 2013 +0100
+++ b/libervia.tac	Sun Nov 17 17:57:14 2013 +0100
@@ -358,10 +358,18 @@
         profile = ISATSession(self.session).profile
         return self.sat_host.bridge.getRoomsJoined(profile)
 
-    def jsonrpc_launchTarotGame(self, other_players):
-        """Create a room, invite the other players and start a Tarot game"""
+    def jsonrpc_launchTarotGame(self, other_players, room_jid=""):
+        """Create a room, invite the other players and start a Tarot game
+        @param room_jid: leave empty string to generate a unique room name
+        """
         profile = ISATSession(self.session).profile
-        self.sat_host.bridge.tarotGameLaunch(other_players, profile)
+        try:
+            if room_jid != "":
+                room_jid = JID(room_jid).userhost()
+        except:
+            warning('Invalid room jid')
+            return
+        self.sat_host.bridge.tarotGameLaunch(other_players, room_jid, profile)
 
     def jsonrpc_getTarotCardsPaths(self):
         """Give the path of all the tarot cards"""
@@ -384,10 +392,18 @@
         profile = ISATSession(self.session).profile
         self.sat_host.bridge.tarotGamePlayCards(player_nick, referee, cards, profile)
 
-    def jsonrpc_launchRadioCollective(self, invited):
-        """Create a room, invite people, and start a radio collective"""
+    def jsonrpc_launchRadioCollective(self, invited, room_jid=""):
+        """Create a room, invite people, and start a radio collective
+        @param room_jid: leave empty string to generate a unique room name
+        """
         profile = ISATSession(self.session).profile
-        self.sat_host.bridge.radiocolLaunch(invited, profile)
+        try:
+            if room_jid != "":
+                room_jid = JID(room_jid).userhost()
+        except:
+            warning('Invalid room jid')
+            return
+        self.sat_host.bridge.radiocolLaunch(invited, room_jid, profile)
 
     def jsonrpc_getEntityData(self, jid, keys):
         """Get cached data for an entit