changeset 689:a6adefddcb0a

browser and server side: complete changeset 669 (a8fddccf5b84) about joining MUC: - TODO: some issues remain when a MUC is already joined and you enter a "short" name (JID node) in the dialog
author souliane <souliane@mailoo.org>
date Thu, 02 Apr 2015 00:36:08 +0200 (2015-04-01)
parents 6fc3ff3936ba
children 76a67d04c63e
files src/browser/sat_browser/game_tarot.py src/server/server.py
diffstat 2 files changed, 17 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/game_tarot.py	Wed Apr 01 22:04:17 2015 +0200
+++ b/src/browser/sat_browser/game_tarot.py	Thu Apr 02 00:36:08 2015 +0200
@@ -400,7 +400,7 @@
         def onPlayersSelected(room_jid, other_players):
             other_players = [unicode(contact) for contact in other_players]
             room_jid_s = unicode(room_jid) if room_jid else ''
-            host.bridge.launchTarotGame(other_players, room_jid_s, profile=C.PROF_KEY_NONE, callback=lambda dummy: None, errback=self.host.showFailureRoomInvalid)
+            host.bridge.launchTarotGame(other_players, room_jid_s, profile=C.PROF_KEY_NONE, callback=lambda dummy: None, errback=host.showFailureRoomInvalid)
         dialog.RoomAndContactsChooser(host, onPlayersSelected, 3, title="Tarot", title_invite=_(u"Please select 3 other players"), visible=(False, True))
 
     def gotMenus():
--- a/src/server/server.py	Wed Apr 01 22:04:17 2015 +0200
+++ b/src/server/server.py	Thu Apr 02 00:36:08 2015 +0200
@@ -392,20 +392,21 @@
 
     def jsonrpc_joinMUC(self, room_jid, nick):
         """Join a Multi-User Chat room
-        @room_jid: leave empty string to generate a unique name
+
+        @param room_jid (unicode): room JID or empty string to generate a unique name
+        @param nick (unicode): user nick
         """
         profile = ISATSession(self.session).profile
         d = self.asyncBridgeCall("joinMUC", room_jid, nick, {}, profile)
         return d
 
     def jsonrpc_inviteMUC(self, contact_jid, room_jid):
-        """Invite a user to a Multi-User Chat room"""
+        """Invite a user to a Multi-User Chat room
+
+        @param contact_jid (unicode): contact to invite
+        @param room_jid (unicode): room JID or empty string to generate a unique name
+        """
         profile = ISATSession(self.session).profile
-        try:
-            room_jid = JID(room_jid).userhost()
-        except:
-            log.warning('Invalid room jid')
-            return
         room_id = room_jid.split("@")[0]
         service = room_jid.split("@")[1]
         self.sat_host.bridge.inviteMUC(contact_jid, service, room_id, {}, profile)
@@ -431,16 +432,12 @@
         return self.sat_host.bridge.getRoomsSubjects(profile)
 
     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
+        """Create a room, invite the other players and start a Tarot game.
+
+        @param other_players (list[unicode]): JIDs of the players to play with
+        @param room_jid (unicode): room JID or empty string to generate a unique name
         """
         profile = ISATSession(self.session).profile
-        try:
-            if room_jid != "":
-                room_jid = JID(room_jid).userhost()
-        except:
-            log.warning('Invalid room jid')
-            return
         self.sat_host.bridge.tarotGameLaunch(other_players, room_jid, profile)
 
     def jsonrpc_getTarotCardsPaths(self):
@@ -460,16 +457,12 @@
         self.sat_host.bridge.tarotGamePlayCards(player_nick, referee, cards, profile)
 
     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
+        """Create a room, invite people, and start a radio collective.
+
+        @param invited (list[unicode]): JIDs of the contacts to play with
+        @param room_jid (unicode): room JID or empty string to generate a unique name
         """
         profile = ISATSession(self.session).profile
-        try:
-            if room_jid != "":
-                room_jid = JID(room_jid).userhost()
-        except:
-            log.warning('Invalid room jid')
-            return
         self.sat_host.bridge.radiocolLaunch(invited, room_jid, profile)
 
     def jsonrpc_getEntitiesData(self, jids, keys):