changed leave game shortcut, server cleanups, added max_games_per_user

This commit is contained in:
Max-Wilhelm Bruker 2011-04-21 01:52:09 +02:00
parent d0b8c6ebd9
commit 38b31681e2
11 changed files with 85 additions and 64 deletions

View file

@ -19,15 +19,12 @@ class Server : public QObject
signals:
void pingClockTimeout();
private slots:
void gameCreated(Server_Game *game);
void gameClosing(int gameId);
void broadcastRoomUpdate();
public:
mutable QMutex serverMutex;
Server(QObject *parent = 0);
~Server();
AuthenticationResult loginUser(Server_ProtocolHandler *session, QString &name, const QString &password);
QList<Server_Game *> getGames() const { return games.values(); }
const QMap<int, Server_Room *> &getRooms() { return rooms; }
int getNextGameId() { return nextGameId++; }
@ -42,12 +39,12 @@ public:
virtual int getMessageCountingInterval() const { return 0; }
virtual int getMaxMessageCountPerInterval() const { return 0; }
virtual int getMaxMessageSizePerInterval() const { return 0; }
virtual int getMaxGamesPerUser() const { return 0; }
virtual QMap<QString, ServerInfo_User *> getBuddyList(const QString &name) = 0;
virtual QMap<QString, ServerInfo_User *> getIgnoreList(const QString &name) = 0;
virtual bool getUserBanned(Server_ProtocolHandler * /*client*/, const QString & /*userName*/) const { return false; }
protected:
QMap<int, Server_Game *> games;
QList<Server_ProtocolHandler *> clients;
QMap<QString, Server_ProtocolHandler *> users;
QMap<int, Server_Room *> rooms;
@ -55,6 +52,8 @@ protected:
virtual bool userExists(const QString &user) = 0;
virtual AuthenticationResult checkUserPassword(const QString &user, const QString &password) = 0;
virtual ServerInfo_User *getUserData(const QString &name) = 0;
int getUsersCount() const;
int getGamesCount() const;
int nextGameId;
void addRoom(Server_Room *newRoom);
};