servatrice/cockatrice/src/localserver.cpp
woogerboy21 2f23a9cb2f Smarter rooms (#2484)
* Added VIP only room

* Added DONATOR room.

* Extended Room to include privilege level.

* Updated room join logic

* Updated server tab permissions column display based on perm+privlevel definitions

* Fixed new client -> old server blank permissions column on server tab

Added the ability for registered user - VIP/DONATOR/PRIVILEGED room.
2017-03-22 21:45:16 -04:00

43 lines
1.3 KiB
C++

#include "localserver.h"
#include "localserverinterface.h"
#include "server_room.h"
LocalServer::LocalServer(QObject *parent)
: Server(parent)
{
setDatabaseInterface(new LocalServer_DatabaseInterface(this));
addRoom(new Server_Room(0, 0, QString(), QString(), QString(), QString(), false, QString(), QStringList(), this));
}
LocalServer::~LocalServer()
{
// LocalServer is single threaded so it doesn't need locks on this
while (!clients.isEmpty())
clients.first()->prepareDestroy();
prepareDestroy();
}
LocalServerInterface *LocalServer::newConnection()
{
LocalServerInterface *lsi = new LocalServerInterface(this, getDatabaseInterface());
addClient(lsi);
return lsi;
}
LocalServer_DatabaseInterface::LocalServer_DatabaseInterface(LocalServer *_localServer)
: Server_DatabaseInterface(_localServer), localServer(_localServer)
{
}
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 */, const QString & /* clientId */, QString & /* reasonStr */, int & /* secondsLeft */)
{
return UnknownUser;
}