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

@@ -7,10 +7,9 @@
class Server_DatabaseInterface : public QObject {
Q_OBJECT
private:
int nextGameId, nextReplayId;
public:
Server_DatabaseInterface();
Server_DatabaseInterface(QObject *parent = 0)
: QObject(parent) { }
virtual AuthenticationResult checkUserPassword(Server_ProtocolHandler *handler, const QString &user, const QString &password, QString &reasonStr, int &secondsLeft) = 0;
virtual bool userExists(const QString &user) { return false; }
@@ -19,13 +18,15 @@ public:
virtual bool isInBuddyList(const QString &whoseList, const QString &who) { return false; }
virtual bool isInIgnoreList(const QString &whoseList, const QString &who) { return false; }
virtual ServerInfo_User getUserData(const QString &name, bool withId = false) = 0;
virtual void storeGameInformation(const QString &roomName, const QStringList &roomGameTypes, const ServerInfo_Game &gameInfo, const QSet<QString> &allPlayersEver, const QSet<QString> &allSpectatorsEver, const QList<GameReplay *> &replayList) { }
virtual DeckList *getDeckFromDatabase(int deckId, const QString &userName) { return 0; }
virtual qint64 startSession(const QString &userName, const QString &address) { return 0; }
public slots:
virtual void endSession(qint64 sessionId) { }
public:
virtual int getNextGameId() { return nextGameId++; }
virtual int getNextReplayId() { return nextReplayId++; }
virtual int getNextGameId() = 0;
virtual int getNextReplayId() = 0;
virtual void clearSessionTables() { }
virtual void lockSessionTables() { }