core: use of Const for profile_key + replaced '@DEFAULT@' default profile_key by '@NONE@'
This commit is contained in:
parent
2a40da1664
commit
005ec59a8a
1 changed files with 123 additions and 101 deletions
|
|
@ -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 @@ class RoomGame(object):
|
|||
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 @@ class RoomGame(object):
|
|||
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 @@ class RoomGame(object):
|
|||
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 @@ class RoomGame(object):
|
|||
# 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue