Added chat history to a room that is displayed on join.

With this update a new chat history definition is added on a per
room bases which allows operators to specify the number of chat
messages to store and present to the user on join.  Please see
the sample ini for room definitions.
This commit is contained in:
woogerboy21 2015-09-12 13:46:22 -04:00
parent f97a7e8370
commit 87a64da1bc
23 changed files with 141 additions and 16 deletions

View file

@ -9,6 +9,7 @@
#include <QReadWriteLock>
#include "serverinfo_user_container.h"
#include "pb/response.pb.h"
#include "pb/serverinfo_chat_message.pb.h"
class Server_DatabaseInterface;
class Server_ProtocolHandler;
@ -30,6 +31,7 @@ signals:
void gameListChanged(const ServerInfo_Game &gameInfo);
private:
int id;
int chatHistorySize;
QString name;
QString description;
QString permissionLevel;
@ -45,7 +47,8 @@ private slots:
public:
mutable QReadWriteLock usersLock;
mutable QReadWriteLock gamesLock;
Server_Room(int _id, const QString &_name, const QString &_description, const QString &_permissionLevel, bool _autoJoin, const QString &_joinMessage, const QStringList &_gameTypes, Server *parent);
QList<ServerInfo_ChatMessage> chatHistory;
Server_Room(int _id, int _chatHistorySize, const QString &_name, const QString &_description, const QString &_permissionLevel, bool _autoJoin, const QString &_joinMessage, const QStringList &_gameTypes, Server *parent );
~Server_Room();
int getId() const { return id; }
QString getName() const { return name; }
@ -60,6 +63,7 @@ public:
const ServerInfo_Room &getInfo(ServerInfo_Room &result, bool complete, bool showGameTypes = false, bool includeExternalData = true) const;
int getGamesCreatedByUser(const QString &name) const;
QList<ServerInfo_Game> getGamesOfUser(const QString &name) const;
QList<ServerInfo_ChatMessage> getChatHistory() { return chatHistory; }
void addClient(Server_ProtocolHandler *client);
void removeClient(Server_ProtocolHandler *client);