Esempio n. 1
0
 def createRoom(self,
                name,
                password='',
                initResult=ACTION_RESULT.SHOW_ROOM):
     roomJID = jid_entity.makeUserRoomJID()
     if not roomJID:
         return (False,
                 ClientActionError(CLIENT_ACTION_ID.CREATE_USER_ROOM,
                                   CLIENT_ERROR_ID.NOT_SUPPORTED))
     else:
         exists = self.getChannelByName(name)
         if exists is not None:
             return (False,
                     ClientChannelError(
                         CHANNEL_ERROR_ID.NAME_ALREADY_EXISTS, name))
         if roomJID not in self.__actions:
             from gui.shared.utils import getPlayerName
             name = '{0} ({1})'.format(name, getPlayerName())
             action = CreateAction(roomJID, name, password, initResult)
             self.__actions[roomJID] = action
             action.start()
         else:
             return (False,
                     ClientActionError(CLIENT_ACTION_ID.CREATE_USER_ROOM,
                                       CLIENT_ERROR_ID.LOCKED))
         return (True, None)
Esempio n. 2
0
 def createRoom(self, name, password = '', initResult = ACTION_RESULT.SHOW_ROOM):
     roomJID = jid_entity.makeUserRoomJID()
     if not roomJID:
         return (False, ClientActionError(CLIENT_ACTION_ID.CREATE_USER_ROOM, CLIENT_ERROR_ID.NOT_SUPPORTED))
     else:
         exists = self.getChannelByName(name)
         if exists is not None:
             return (False, ClientChannelError(CHANNEL_ERROR_ID.NAME_ALREADY_EXISTS, name))
         if roomJID not in self.__actions:
             action = CreateAction(roomJID, name, password, initResult)
             self.__actions[roomJID] = action
             action.start()
         else:
             return (False, ClientActionError(CLIENT_ACTION_ID.CREATE_USER_ROOM, CLIENT_ERROR_ID.LOCKED))
         return (True, None)