示例#1
0
void ProtocolOld::onRecvFirstMessage(NetworkMessage& msg)
{
    if (g_game.getGameState() == GAME_STATE_SHUTDOWN) {
        disconnect();
        return;
    }

    /*uint16_t clientOS =*/ msg.get<uint16_t>();
    uint16_t version = msg.get<uint16_t>();
    msg.skipBytes(12);

    if (version <= 760) {
        disconnectClient("Only clients with protocol " CLIENT_VERSION_STR " allowed!");
        return;
    }

    if (!Protocol::RSA_decrypt(msg)) {
        disconnect();
        return;
    }

    uint32_t key[4];
    key[0] = msg.get<uint32_t>();
    key[1] = msg.get<uint32_t>();
    key[2] = msg.get<uint32_t>();
    key[3] = msg.get<uint32_t>();
    enableXTEAEncryption();
    setXTEAKey(key);

    if (version <= 822) {
        disableChecksum();
    }

    disconnectClient("Only clients with protocol " CLIENT_VERSION_STR " allowed!");
}
示例#2
0
bool ProtocolOld::parseFirstPacket(NetworkMessage& msg)
{
	if(g_game.getGameState() == GAME_STATE_SHUTDOWN)
	{
		getConnection()->closeConnection();
		return false;
	}

	/*uint16_t clientOS =*/ msg.GetU16();
	uint16_t version = msg.GetU16();
	msg.SkipBytes(12);

	if(version <= 760)
		disconnectClient(0x0A, "Only clients with protocol " CLIENT_VERSION_STR " allowed!");

	if(!RSA_decrypt(msg))
	{
		getConnection()->closeConnection();
		return false;
	}

	uint32_t key[4];
	key[0] = msg.GetU32();
	key[1] = msg.GetU32();
	key[2] = msg.GetU32();
	key[3] = msg.GetU32();
	enableXTEAEncryption();
	setXTEAKey(key);

	if(version <= 822)
		disableChecksum();

	disconnectClient(0x0A, "Only clients with protocol " CLIENT_VERSION_STR " allowed!");
	return false;
}
示例#3
0
bool ProtocolOld::parseFirstPacket(NetworkMessage& msg)
{
	if(g_game.getGameState() == GAMESTATE_SHUTDOWN)
	{
		getConnection()->close();
		return false;
	}

	/*uint16_t operatingSystem = */msg.get<uint16_t>();
	uint16_t version = msg.get<uint16_t>();
	msg.skip(12);
	if(version <= 760)
		disconnectClient(0x0A, CLIENT_VERSION_STRING);

	if(!RSA_decrypt(msg))
	{
		getConnection()->close();
		return false;
	}

	uint32_t key[4] = {msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>()};
	enableXTEAEncryption();
	setXTEAKey(key);

	if(version <= 822)
		disableChecksum();

	disconnectClient(0x0A, CLIENT_VERSION_STRING);
	return false;
}
示例#4
0
void ProtocolOld::onRecvFirstMessage(NetworkMessage& msg)
{
	if(g_game.getGameState() == GAMESTATE_SHUTDOWN)
	{
		getConnection()->close();
		return;
	}

	msg.skip(2);
	uint16_t version = msg.get<uint16_t>();

	msg.skip(12);
	if(version <= 760)
		disconnectClient(0x0A, "Only clients with protocol " CLIENT_VERSION_STRING " allowed!");

	if(!RSA_decrypt(msg))
	{
		getConnection()->close();
		return;
	}

	uint32_t key[4] = {msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>(), msg.get<uint32_t>()};
	enableXTEAEncryption();
	setXTEAKey(key);

	if(version <= 822)
		disableChecksum();

	disconnectClient(0x0A, "Only clients with protocol " CLIENT_VERSION_STRING " allowed!");
}
示例#5
0
文件: Server.cpp 项目: izissise/PFA
void            Server::run()
{
  ENetEvent     event;

  std::cout << "Actual port => " << _set.getCvar("sv_port") << std::endl;
  std::cout << "Quiet => " << _set.getCvar("sv_quiet") << std::endl;
  std::cout << "Debug => " << _set.getCvar("sv_debug") << std::endl;

  while ((enet_host_service(_server, &event, 50)) >= 0)
    {
      switch (event.type)
        {
        case ENET_EVENT_TYPE_CONNECT:
          connectClient(event.peer);
          break;
        case ENET_EVENT_TYPE_RECEIVE:
          handlePackets(event);
          break;
        case ENET_EVENT_TYPE_DISCONNECT:
          disconnectClient(event.peer);
        default:
          break;
        }
      updateClients();
    }
}
示例#6
0
文件: Client.cpp 项目: mworks/mworks
bool Client::connectToServer(const std::string &host, const int port) {
    std::unique_lock<std::mutex> lock(connectedEventReceivedMutex);
    
    remoteConnection.reset(new ZeroMQClient(incoming_event_buffer,
                                            outgoing_event_buffer,
                                            host,
                                            port,
                                            port + 1));
    if (!remoteConnection->connect()) {
        //TODO log the error somewhere.
        return false; 
    }
    
    // Send client connected event, using memory address of remoteConnection as the client ID
    putEvent(SystemEventFactory::clientConnectedToServerControl(reinterpret_cast<long>(remoteConnection.get())));
    
    // Wait for connection acknowledgement from server
    connectedEventReceived = false;
    if (!connectedEventReceivedCondition.wait_for(lock,
                                                  std::chrono::seconds(2),
                                                  [this]() { return connectedEventReceived; }))
    {
        (void)disconnectClient();
        return false;
    }
    
    // Request component codec, variable codec, experiment state, and protocol names
    putEvent(SystemEventFactory::requestComponentCodecControl());
    putEvent(SystemEventFactory::requestCodecControl());
    putEvent(SystemEventFactory::requestExperimentStateControl());
    putEvent(SystemEventFactory::requestProtocolsControl());
    
    return true;
}
示例#7
0
bool Server::stateRecieveField( const QString& cmd, ClientsIterator client )
{
    QRegExp rx( "field:(\\d{1,2}):([0-8]+):" );
    if( rx.indexIn(cmd) == -1 )
        return false;

    if( client->status != Client::ST_AUTHORIZED )
        return false;

    int shipSize = rx.cap(1).toInt();
    const QString& field = rx.cap(2);

    client->setField( field, shipSize );
    if( !client->field()->checkField() )
    {
        client->send( "wrongfield:" );
        qDebug() << "User" << client->login << "passed wrong field";
        client->field()->showField();
        disconnectClient( client );
        return true;
    }

    client->status = Client::ST_READY;
    return true;
}
void InspectorFrontendHost::disconnectFromBackend()
{
    if (m_client) {
        m_client->disconnectFromBackend();
        disconnectClient(); // Disconnect from client.
    }
}
void InspectorFrontendHost::closeWindow()
{
    if (m_client) {
        m_client->closeWindow();
        disconnectClient(); // Disconnect from client.
    }
}
示例#10
0
文件: Client.cpp 项目: mworks/mworks
Client::~Client() {
    disconnectClient();
    
    if (incoming_listener) {
        incoming_listener->killListener();
    }
}
void QmlProfilerClientManager::connectToTcpServer()
{
    if (m_connection.isNull()) {
        QTC_ASSERT(m_qmlclientplugin.isNull(), disconnectClient());
        createConnection();
        QTC_ASSERT(m_connection, emit connectionFailed(); return);
        m_connection->connectToHost(m_tcpHost, m_tcpPort.number());
    }
示例#12
0
// Disconnect client from server and record winner status for him and his
// opponent, if there was a game between'em
void Server::disconnectClientAndRecord(
    ClientsIterator client,
    bool winnerStatus
)
{
    if( client == clients_.end() )
        return;

    if(
        client->status == Client::ST_MAKING_STEP ||
        client->status == Client::ST_WAITING_STEP
    )
    {
        Client& winner = winnerStatus
            ? client.value()
            : client->playingWith.value();
        Client& looser = !winnerStatus
            ? client.value()
            : client->playingWith.value();

        recordSessionStatistic(
            winner.login,
            looser.login
        );

        PlayerStats stat = stats_.getStat(winner.login);
        QString winInfo("win: winRate: ");
        winInfo.append(QString::number(stat.roundsWon));
        winInfo.append(" loseRate: ");
        winInfo.append(QString::number(stat.roundsLost));

        stat = stats_.getStat(looser.login);
        QString loseInfo("lose: winRate: ");
        loseInfo.append(QString::number(stat.roundsWon));
        loseInfo.append(" loseRate: ");
        loseInfo.append(QString::number(stat.roundsLost));

        winner.send(winInfo);
        looser.send(loseInfo);
    }

    if( client->playingWith != clients_.end() )
        disconnectClient( client->playingWith );

    disconnectClient( client );
}
void QmlProfilerClientManager::clearConnection()
{
    m_localSocket.clear();
    m_tcpHost.clear();
    m_tcpPort = Utils::Port();
    disconnectClient();
    stopConnectionTimer();
}
示例#14
0
void ProtocolLogin::getCharacterList(const std::string& accountName, const std::string& password, uint16_t version)
{
	Account account;
	if (!IOLoginData::loginserverAuthentication(accountName, password, account)) {
		disconnectClient("Account name or password is not correct.", version);
		return;
	}

	auto output = OutputMessagePool::getOutputMessage();
	//Update premium days
	Game::updatePremium(account);

	const std::string& motd = g_config.getString(ConfigManager::MOTD);
	if (!motd.empty()) {
		//Add MOTD
		output->addByte(0x14);

		std::ostringstream ss;
		ss << g_game.getMotdNum() << "\n" << motd;
		output->addString(ss.str());
	}

	//Add session key
	output->addByte(0x28);
	output->addString(accountName + "\n" + password);

	//Add char list
	output->addByte(0x64);

	output->addByte(1); // number of worlds

	output->addByte(0); // world id
	output->addString(g_config.getString(ConfigManager::SERVER_NAME));
	output->addString(g_config.getString(ConfigManager::IP));
	output->add<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT));
	output->addByte(0);

	uint8_t size = std::min<size_t>(std::numeric_limits<uint8_t>::max(), account.characters.size());
	output->addByte(size);
	for (uint8_t i = 0; i < size; i++) {
		output->addByte(0);
		output->addString(account.characters[i]);
	}

	// Add premium days
	if (version >= 1080) {
		output->addByte((g_config.getBoolean(ConfigManager::FREE_PREMIUM)) ? 0x01 : 0x00);
		auto time = std::chrono::system_clock::now() + std::chrono::hours(account.premiumDays * 24);
		std::chrono::seconds timestamp = std::chrono::duration_cast<std::chrono::seconds>(time.time_since_epoch());
		output->add<uint32_t>(g_config.getBoolean(ConfigManager::FREE_PREMIUM) ? 0 : timestamp.count());
	} else {
		output->add<uint16_t>(g_config.getBoolean(ConfigManager::FREE_PREMIUM) ? 0xFFFF : account.premiumDays);
	}

	send(output);

	disconnect();
}
void QmlProfilerClientManager::setTcpConnection(QString host, Utils::Port port)
{
    if (!m_localSocket.isEmpty() || m_tcpHost != host || m_tcpPort != port) {
        m_tcpHost = host;
        m_tcpPort = port;
        m_localSocket.clear();
        disconnectClient();
        stopConnectionTimer();
    }
}
void QmlProfilerClientManager::setLocalSocket(QString file)
{
    if (m_localSocket != file || !m_tcpHost.isEmpty() || m_tcpPort.isValid()) {
        m_localSocket = file;
        m_tcpHost.clear();
        m_tcpPort = Utils::Port();
        disconnectClient();
        stopConnectionTimer();
    }
}
//--------------------------------------------------------------
void ofxMatrixNetworkServer::exit() {
    //for each client lets send them a message letting them know what port they are connected on
	for(int i = 0; i < getLastID(); i++){
		if(isClientConnected(i)){
            sendExit(i);
            disconnectClient(i);
        }
	}
    
    close();
}
示例#18
0
static int
handleClient(int handle, void *context)
{
  int rc;
  ClientRef client = (ClientRef) context;
  rc = handleClientRequest(client);
  if (rc <= 0) {
    disconnectClient(client);
  }
  return rc;
}
示例#19
0
void GamePair::removeClient(S32 index)
{
   // Disconnect before deleting
   ClientGame *clientGame = GameManager::getClientGames()->get(index);

   disconnectClient(index);

   this->idle(5, 5);      // Let things settle

   GameManager::deleteClientGame(index);
}
示例#20
0
void ProtocolLogin::getCharacterList(const std::string& accountName, const std::string& password, uint16_t version)
{
	Account account;
	if (!IOLoginData::loginserverAuthentication(accountName, password, account)) {
		disconnectClient("Account name or password is not correct.", version);
		return;
	}

	OutputMessage_ptr output = OutputMessagePool::getInstance()->getOutputMessage(this, false);
	if (output) {
		//Update premium days
		Game::updatePremium(account);

		//Add MOTD
		output->addByte(0x14);

		std::ostringstream ss;
		ss << g_game.getMotdNum() << "\n" << g_config.getString(ConfigManager::MOTD);
		output->addString(ss.str());

		//Add session key
		output->addByte(0x28);
		output->addString(accountName + "\n" + password);

		//Add char list
		output->addByte(0x64);

		output->addByte(1); // number of worlds

		output->addByte(0); // world id
		output->addString(g_config.getString(ConfigManager::SERVER_NAME));
		output->addString(g_config.getString(ConfigManager::IP));
		output->add<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT));
		output->addByte(0);

		uint8_t size = std::min<size_t>(std::numeric_limits<uint8_t>::max(), account.characters.size());
		output->addByte(size);
		for (uint8_t i = 0; i < size; i++) {
			output->addByte(0);
			output->addString(account.characters[i]);
		}

		//Add premium days
		if (g_config.getBoolean(ConfigManager::FREE_PREMIUM)) {
			output->add<uint16_t>(0xFFFF);    //client displays free premium
		} else {
			output->add<uint16_t>(account.premiumDays);
		}

		OutputMessagePool::getInstance()->send(output);
	}

	getConnection()->close();
}
示例#21
0
void ProtocolLogin::getCharacterList(uint32_t accountName, const std::string& password)
{
	uint32_t serverIp = serverIPs[0].first;
	for (uint32_t i = 0; i < serverIPs.size(); i++) {
		if ((serverIPs[i].first & serverIPs[i].second) == (getConnection()->getIP() & serverIPs[i].second)) {
			serverIp = serverIPs[i].first;
			break;
		}
	}

	Account account;
	if (!IOLoginData::loginserverAuthentication(accountName, password, account)) {
		disconnectClient("Account name or password is not correct.");
		return;
	}

	auto output = OutputMessagePool::getOutputMessage();
	//Update premium days
	Game::updatePremium(account);

	const std::string& motd = g_config.getString(ConfigManager::MOTD);
	if (!motd.empty()) {
		//Add MOTD
		output->addByte(0x14);

		std::ostringstream ss;
		ss << g_game.getMotdNum() << "\n" << motd;
		output->addString(ss.str());
	}

	//Add char list
	output->addByte(0x64);

	uint8_t size = std::min<size_t>(std::numeric_limits<uint8_t>::max(), account.characters.size());
	output->addByte(size);
	for (uint8_t i = 0; i < size; i++) {
		output->addString(account.characters[i]);
		output->addString(g_config.getString(ConfigManager::SERVER_NAME));
		output->add<uint32_t>(serverIp);
		output->add<uint16_t>(g_config.getNumber(ConfigManager::GAME_PORT));
	}

	//Add premium days
	if (g_config.getBoolean(ConfigManager::FREE_PREMIUM)) {
		output->add<uint16_t>(0xFFFF); //client displays free premium
	} else {
		output->add<uint16_t>(account.premiumDays);
	}

	send(output);

	disconnect();
}
示例#22
0
/*!
 * Disconnects all clients, or disconnects from the server.
 */
void QxtRPCService::disconnectAll()
{
    if(isClient()) 
        disconnectServer();

    if(isServer()) {
        QList<quint64> clientIDs = clients();
        foreach(quint64 id, clientIDs) {
            // Disconnect from each client in turn.
            disconnectClient(id);
        }
    }
示例#23
0
//--------------------------
string ofxTCPServer::receive(int clientID){
	if( !isClientSetup(clientID) ){
		ofLog(OF_LOG_WARNING, "ofxTCPServer: client " + ofToString(clientID) + " doesn't exist");
		return "client doesn't exist";
	}
	
	if( !TCPConnections[clientID].isConnected() ){
		disconnectClient(clientID);
		return "";
	}

	return TCPConnections[clientID].receive();
}
//--------------------------
string WebSocketServer::receive(int clientID){
	if( !isClientSetup(clientID) ){
		if(verbose)printf("WebSocketServer::receive -  client %i doesn't exist\n", clientID);
		return "client doesn't exist";
	}
	
	if( !webSocketClients[clientID].isConnected() ){
		disconnectClient(clientID);
		return "";
	}
	
	return webSocketClients[clientID].receive();
}
void DCOPDispatcher::dispatchClient( Client *client )
{
    int cmd;
    QByteArray data;
    int res = client->m_connection->read( &cmd, data );

    if ( res == -1 )
    {
        kdDebug() << "error reading from dcop client!" << endl;
        // ### FIXME
        disconnectClient( client->m_owner );
        return;
    }

    Client *oldClient = s_currentClient;
    s_currentClient = client;
    bool oldTransactionAdded = m_transactionAdded;
    m_transactionAdded = false;

    QCString remApp, remObj, remFun;
    QByteArray callData;
#ifndef QT_NO_DATASTREAM
    QDataStream stream(data, IO_ReadOnly);

    stream >> remApp >> remObj >> remFun >> callData;
#endif
    QCString replyType;
    QByteArray replyData;

    // ### return value!
    process( remObj, remFun, callData, replyType, replyData );

    if ( cmd == DCOPClient::Call && !m_transactionAdded )
    {
        // send back reply

        QByteArray reply;
#ifndef QT_NO_DATASTREAM
        QDataStream replyStream( reply, IO_WriteOnly );
        replyStream << replyType << replyData;
#endif
        client->m_connection->send( 0, reply );
    }

    s_currentClient = oldClient;
    m_transactionAdded = oldTransactionAdded;
}
示例#26
0
文件: Client.cpp 项目: mworks/mworks
void Client::handleEvent(shared_ptr<Event> evt) { 
	int code = evt->getEventCode();
    
    switch (code) {
        case RESERVED_CODEC_CODE:
            registry->updateFromCodecDatum(evt->getData());
            // Request updated values for all variables
            putEvent(SystemEventFactory::requestVariablesUpdateControl());
            break;
            
        case RESERVED_SYSTEM_EVENT_CODE: {
            auto &sysEvent = evt->getData();
            if (sysEvent.getElement(M_SYSTEM_PAYLOAD_TYPE).getInteger() == M_SERVER_CONNECTED_CLIENT) {
                long clientID = sysEvent.getElement(M_SYSTEM_PAYLOAD).getInteger();
                std::lock_guard<std::mutex> lock(connectedEventReceivedMutex);
                if (remoteConnection &&
                    clientID == reinterpret_cast<long>(remoteConnection.get()))
                {
                    // Received connection acknowledgement from server.  Notify any thread waiting
                    // in connectToServer.
                    connectedEventReceived = true;
                    connectedEventReceivedCondition.notify_all();
                }
            }
            break;
        }
            
        case RESERVED_TERMINATION_CODE:
            mwarning(M_CLIENT_MESSAGE_DOMAIN, "Received termination notification from server; disconnecting");
            (void)disconnectClient();
            break;
            
        default:
            break;
    }
    
    handleCallbacks(evt);

    if(code >= N_RESERVED_CODEC_CODES && code < registry->getNVariables() + N_RESERVED_CODEC_CODES) {
        shared_ptr <Variable> var = registry->getVariable(code);
        if(var) {
            var->setSilentValue(evt->getData());
		} else {
			mwarning(M_CLIENT_MESSAGE_DOMAIN, "Invalid variable, client not processing event code: %d", code);
		}
	}
}
示例#27
0
GamePair::~GamePair()
{
   // Disconnect all ClientGames before deleting
   const Vector<ClientGame *> *clientGames = GameManager::getClientGames();

   GameManager::getServerGame()->setAutoLeveling(false);    // No need to run this while we're shutting down

   for(S32 i = 0; i < clientGames->size(); i++)
      disconnectClient(i);

   // Note that when the client disconnects, all local ghosted objects, including GameType, are deleted
   idle(10, 5);

   // Clean up GameManager
   GameManager::reset();
 
   LuaScriptRunner::clearScriptCache();
   LuaScriptRunner::shutdown();
}
示例#28
0
void ScarabServer::shutdown() {
    // shut down the accept thread.
    stopAccepting();
    if(acceptThread) {
        acceptThread->cancel();
    }
    if(tempClient) {
        delete tempClient;
        tempClient = NULL;
    }
    // disconnect every client.
    for(int i = 0; i < numberOfConnectedClients; i++) {
        disconnectClient(i);
    }
    if(listening) {
        scarab_session_close(listeningSocket);
        listening = false;
        listeningSocket = NULL;
    }
}
示例#29
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    isBot=false;
    started = false;

    ui->setupUi(this);

    displayText("Start");

    // Load sounds
    bullet = new QSound("/sounds/bullet.wav");

    networkThread = new QThread();
    networkManager = new NetworkManager();

    networkManager->moveToThread(networkThread);
    networkThread->start();
    //connect(networkThread, SIGNAL(started()), networkManager, SLOT(network_init()));

    connect(ui->connectButton,SIGNAL(clicked()),this,SLOT(connect_clicked()));
    connect(networkManager, SIGNAL(writeText(QString)), this, SLOT(displayText(QString)));
    connect(ui->disconnectButton, SIGNAL(released()), this, SLOT(stopPlay()));
    connect(this, SIGNAL(sendKeyEvent(QKeyEvent*,int)), networkManager, SLOT(process_key(QKeyEvent*,int)));
    connect(networkManager, SIGNAL(newPlayerScore(int)), ui->playerScore, SLOT(setNum(int)));
    connect(networkManager, SIGNAL(newHealthPoints(int)), ui->healthPoints, SLOT(setValue(int)));
    connect(networkManager, SIGNAL(newPlayerId(int)), ui->playerIdLabel, SLOT(setNum(int)));
    connect(networkManager, SIGNAL(newTeamId(int)),ui->equipe, SLOT(setNum(int)));
    connect(networkManager, SIGNAL(newIdInTeam(int)), this, SLOT(setSprite(int)));
    connect(ui->checkBoxBot, SIGNAL(stateChanged(int)), this, SLOT(setBot(int)));
    connect(ui->nameEdit, SIGNAL(textChanged(QString)), networkManager, SLOT(setLogin(QString)));
    connect(ui->disconnectButton, SIGNAL(released()), networkManager, SLOT(disconnectClient()));
    connect(this, SIGNAL(setIP(QString,int)), networkManager, SLOT(setIP(QString,int)));
    connect(this, SIGNAL(setRequestedTeam(int)), networkManager, SLOT(setRequestedTeam(int)));
    connect(networkManager, SIGNAL(disconnected()), this, SLOT(stopPlay()));
    connect(this, SIGNAL(startNetworkManager()), networkManager, SLOT(network_init()));

    readSettings();
}
示例#30
0
 /*! PASS command (User password). During handshake/connecting this actually triggers the user
     authentication and causes the server to check the password and login, also load the specific
     account information from the database and tell all other clients that a user has logged in.
 */
 void QwsClientSocket::handleMessagePASS(const QwMessage &message)
 {
     if (m_sessionState == Qws::StateConnected && !user.nickname().isEmpty()) {
         // We need a handshake first and a nickname. Send the client the session id of its own
         // session and proceed.
         user.setCryptedPassword(message.stringArg(0));
         user.setLoginTime(QDateTime::currentDateTime());
         user.setLastActivity(QDateTime::currentDateTime());

         QwsUser loadedUser = m_serverController->hook_readAccount(user.loginName(),
                                                                   Qws::UserTypeAccount);
         if (!loadedUser.isNull() && loadedUser.password() == user.password()) {

             // Copy some additional information
             user.setGroupName(loadedUser.groupName());
             user.setPrivileges(loadedUser.privileges());
             user.setDownloadSpeedLimit(loadedUser.downloadSpeedLimit());
             user.setUploadSpeedLimit(loadedUser.uploadSpeedLimit());
             user.setDownloadLimit(loadedUser.downloadLimit());
             user.setUploadLimit(loadedUser.uploadLimit());

             // Login successful
             QwMessage reply("201");
             reply.appendArg(QString::number(user.userId()));
             sendMessage(reply);

             m_sessionState = Qws::StateActive;
             emit sessionStateChanged(m_sessionState);
             emit requestedRoomTopic(1);
             return;

         }
     }

     // If in doubt, fail
     m_serverController->qwLog(tr("Login failed for '%1'.").arg(user.loginName()));
     sendError(Qw::ErrorLoginFailed);
     disconnectClient();
     return;
 }