24 #ifndef __MASTERSERVER_H__
25 #define __MASTERSERVER_H__
28 #include <QHostAddress>
33 #include "polymorphism.h"
61 RESPONSE_NO_RESPONSE_YET,
77 QString engineName()
const;
83 bool isAddressSame(
const QHostAddress &address,
unsigned short port)
const;
90 bool isEnabled()
const;
98 bool isTimeouted()
const;
113 QString masterBanHelp()
const;
115 void notifyResponse(Response response);
116 int numPlayers()
const;
117 int numServers()
const;
118 ServerPtr operator[] (
int index)
const;
129 void pushPacketToCache(
const QByteArray &data);
130 void resetPacketCaching();
135 Response readResponse(
const QByteArray &data);
140 bool sendRequest(QUdpSocket *socket);
142 const QList<ServerPtr> &servers()
const;
144 void updateAddress();
152 virtual void refreshStarts();
157 void setEnabled(
bool b);
164 void timeoutRefresh();
173 void message(
const QString &title,
const QString &content,
bool isError);
185 void messageImportant(
const Message &message);
195 virtual QByteArray createServerListRequest()=0;
200 void emptyServerList();
202 POLYMORPHIC_SETTER_DECLARE_CONST(QString,
MasterClient, masterBanHelp, ());
203 QString masterBanHelp_default()
const;
205 bool preparePacketCache(
bool write);
211 virtual Response readMasterResponse(
const QByteArray &data)=0;
213 void readPacketCache();
217 void registerNewServer(ServerPtr server);
219 void setTimeouted(
bool b);
224 virtual void timeoutRefreshEx();
229 void emitBannedMessage();
Message object used to pass messages throughout the Doomseeker's system.
A representation of a server for a given game.
Abstract base for all MasterClients.