38 lines
1 KiB
C++
38 lines
1 KiB
C++
#ifndef SERVER_PROTOCOLHANDLER_H
|
|
#define SERVER_PROTOCOLHANDLER_H
|
|
|
|
#include <QObject>
|
|
#include <QPair>
|
|
#include "server.h"
|
|
|
|
class Server_Player;
|
|
class Command;
|
|
class ProtocolItem;
|
|
|
|
class Server_ProtocolHandler : public QObject {
|
|
Q_OBJECT
|
|
private:
|
|
Server *server;
|
|
QMap<int, QPair<Server_Game *, Server_Player *> > games;
|
|
QMap<QString, Server_ChatChannel *> chatChannels;
|
|
QString playerName;
|
|
|
|
Server *getServer() const { return server; }
|
|
QPair<Server_Game *, Server_Player *> getGame(int gameId) const;
|
|
|
|
AuthenticationResult authState;
|
|
bool acceptsGameListChanges;
|
|
bool acceptsChatChannelListChanges;
|
|
public:
|
|
Server_ProtocolHandler(Server *_server, QObject *parent = 0);
|
|
~Server_ProtocolHandler();
|
|
|
|
bool getAcceptsGameListChanges() const { return acceptsGameListChanges; }
|
|
bool getAcceptsChatChannelListChanges() const { return acceptsChatChannelListChanges; }
|
|
const QString &getPlayerName() const { return playerName; }
|
|
|
|
void processCommand(Command *command);
|
|
virtual void sendProtocolItem(ProtocolItem *item) = 0;
|
|
};
|
|
|
|
#endif
|