diff src/plugins/plugin_misc_room_game.py @ 916:1a759096ccbd

core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'
author Goffi <goffi@goffi.org>
date Fri, 21 Mar 2014 16:27:09 +0100
parents 386ab96af575
children c6d8fc63b1db
line wrap: on
line diff
--- a/src/plugins/plugin_misc_room_game.py	Fri Mar 21 16:19:46 2014 +0100
+++ b/src/plugins/plugin_misc_room_game.py	Fri Mar 21 16:27:09 2014 +0100
@@ -18,6 +18,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 from sat.core.i18n import _
+from sat.core.constants import Const as C
 from logging import debug, warning, error
 from twisted.words.protocols.jabber.jid import JID
 from twisted.words.xish import domish
@@ -382,7 +383,7 @@
             debug(_("Still waiting for %(users)s before starting the game %(game)s in %(room)s") % {'users': result[2], 'game': self.name, 'room': room.occupantJID.userhost()})
         return result
 
-    def getUniqueName(self, muc_service="", profile_key='@DEFAULT@'):
+    def getUniqueName(self, muc_service="", profile_key=C.PROF_KEY_NONE):
         """
         @param muc_service: you can leave empty to autofind the muc service
         @param profile_key
@@ -391,7 +392,7 @@
         room = self.host.plugins["XEP-0045"].getUniqueName(muc_service, profile_key=profile_key)
         return "sat_%s_%s" % (self.name.lower(), room) if room != "" else ""
 
-    def prepareRoom(self, other_players=None, room_jid_s=None, profile_key='@NONE@'):
+    def prepareRoom(self, other_players=None, room_jid_s=None, profile_key=C.PROF_KEY_NONE):
         """Prepare the room for a game: create it if it doesn't exist and invite players.
         @param other_players: list for other players JID userhosts
         @param room_jid_s: JID userhost of the room, or None to generate a unique name
@@ -517,7 +518,7 @@
             self._initGame(room_jid_s, user_nick)
         return True, False
 
-    def createGame(self, room_jid_s, nicks=None, profile_key='@NONE@'):
+    def createGame(self, room_jid_s, nicks=None, profile_key=C.PROF_KEY_NONE):
         """Create a new game - this can be called directly from a frontend
         and skips all the checks and invitation system, but the game must
         not exist and all the players must be in the room already.
@@ -545,7 +546,7 @@
                 # The dict must be COPIED otherwise it is shared between all users
                 self.games[room_jid_s]['players_data'][nick] = copy.deepcopy(self.player_init)
 
-    def playerReady(self, player, referee, profile_key='@NONE@'):
+    def playerReady(self, player, referee, profile_key=C.PROF_KEY_NONE):
         """Must be called when player is ready to start a new game
         @param player: the player nick in the room
         @param referee: referee userhost