database interface separated from server, multiple concurrent database connections are now possible

This commit is contained in:
Max-Wilhelm Bruker 2012-05-28 16:32:45 +02:00
parent 2b89c353bf
commit b328c1ed4d
21 changed files with 347 additions and 310 deletions

View file

@ -5,6 +5,7 @@
LocalServer::LocalServer(QObject *parent)
: Server(parent)
{
setDatabaseInterface(new LocalServer_DatabaseInterface(this));
addRoom(new Server_Room(0, QString(), QString(), false, QString(), QStringList(), this));
}
@ -15,14 +16,26 @@ LocalServer::~LocalServer()
LocalServerInterface *LocalServer::newConnection()
{
LocalServerInterface *lsi = new LocalServerInterface(this);
LocalServerInterface *lsi = new LocalServerInterface(this, getDatabaseInterface());
addClient(lsi);
return lsi;
}
ServerInfo_User LocalServer::getUserData(const QString &name, bool /*withId*/)
LocalServer_DatabaseInterface::LocalServer_DatabaseInterface(LocalServer *_localServer)
: Server_DatabaseInterface(_localServer),
nextGameId(0),
nextReplayId(0)
{
}
ServerInfo_User LocalServer_DatabaseInterface::getUserData(const QString &name, bool /*withId*/)
{
ServerInfo_User result;
result.set_name(name.toStdString());
return result;
}
AuthenticationResult LocalServer_DatabaseInterface::checkUserPassword(Server_ProtocolHandler *handler, const QString &user, const QString &password, QString &reasonStr, int &secondsLeft)
{
return UnknownUser;
}