#include <customservers.h>
Public Member Functions | |
const EnginePlugin * | plugin () const |
void | readConfig (QObject *receiver, const char *slotUpdated, const char *slotBegunRefreshing) |
void | refreshStarts () |
void | setServers (const QList< CustomServerInfo > &csiList, QObject *receiver, const char *slotUpdated, const char *slotBegunRefreshing) |
Public Member Functions inherited from MasterClient | |
void | clearServers () |
QString | engineName () const |
Extracts engine name from pluginInfo() if available. More... | |
bool | isAddressSame (const QHostAddress &address, unsigned short port) const |
Returns true if the passed address:port is the same as this master server's. More... | |
bool | isEnabled () const |
bool | isTimeouted () const |
Indicates that the server has timeouted recently. More... | |
QString | masterBanHelp () const |
[Virtual] Help message displayed to the user when ban is detected. More... | |
void | notifyResponse (Response response) |
int | numPlayers () const |
int | numServers () const |
ServerPtr | operator[] (int index) const |
void | pushPacketToCache (const QByteArray &data) |
Response | readResponse (const QByteArray &data) |
Calls readMasterResponse and handles packet caching. More... | |
void | resetPacketCaching () |
bool | sendRequest (QUdpSocket *socket) |
Sends request packet through socket. More... | |
const QList< ServerPtr > & | servers () const |
void | updateAddress () |
Static Public Member Functions | |
static void | decodeConfigEntries (const QString &str, QList< CustomServerInfo > &outCustomServerInfoList) |
Protected Member Functions | |
QByteArray | createServerListRequest () |
Produce contents of server list request packet that is sent to the master server. More... | |
Response | readMasterResponse (const QByteArray &data) |
Called to read and analyze the response from the MasterServer. More... | |
Protected Member Functions inherited from MasterClient | |
void | emptyServerList () |
QString | masterBanHelp_default () const |
POLYMORPHIC_SETTER_DECLARE_CONST (QString, MasterClient, masterBanHelp,()) | |
bool | preparePacketCache (bool write) |
void | readPacketCache () |
void | registerNewServer (ServerPtr server) |
Registers new server with this MasterClient. More... | |
void | setTimeouted (bool b) |
virtual void | timeoutRefreshEx () |
Reimplement this for clean up purposes. More... | |
Additional Inherited Members | |
Public Types inherited from MasterClient | |
enum | Response { RESPONSE_GOOD, RESPONSE_TIMEOUT, RESPONSE_WAIT, RESPONSE_BAD, RESPONSE_BANNED, RESPONSE_NO_RESPONSE_YET, RESPONSE_PENDING, RESPONSE_REPLY, RESPONSE_OLD } |
Public Slots inherited from MasterClient | |
void | setEnabled (bool b) |
void | timeoutRefresh () |
Times the refreshing process out. More... | |
Signals inherited from MasterClient | |
void | listUpdated () |
void | message (const QString &title, const QString &content, bool isError) |
void | messageImportant (const Message &message) |
Signal used to forward important message to Doomseeker. More... | |
A 'fake' master server that is used to handle custom servers from various engines.
Definition at line 48 of file customservers.h.
|
inlineprotectedvirtual |
Produce contents of server list request packet that is sent to the master server.
Implements MasterClient.
Definition at line 96 of file customservers.h.
|
static |
Reads data in format (<engine_name>;<host_name>;<port>);(...)...
and splits it to a list of CustomServerInfo objects. If a server for unknown engine is found it will be appended anyway but the CustomServerInfo::engineIndex will be set to a negative value.
str | - concatenated string in required format |
Definition at line 32 of file customservers.cpp.
|
inlinevirtual |
This is supposed to return the plugin this MasterClient belongs to. If it doesn't belong to any plugin then return NULL. New instances of EnginePlugin shouldn't be created here. Instead each plugin should keep a global instance of EnginePlugin (singleton?) and a pointer to this instance should be returned.
Implements MasterClient.
Definition at line 66 of file customservers.h.
void CustomServers::readConfig | ( | QObject * | receiver, |
const char * | slotUpdated, | ||
const char * | slotBegunRefreshing | ||
) |
Convenience method - tries to read config seeking for "CustomServers" entry, decode it and launch setServers() method.
receiver | - object to receive server signals |
slotUpdated | - slot to receive Server::updated signals |
slotBegunRefreshing | - slot to receive Server::begunRefreshing signals |
Definition at line 86 of file customservers.cpp.
|
inlineprotectedvirtual |
Called to read and analyze the response from the MasterServer.
Implements MasterClient.
Definition at line 97 of file customservers.h.
|
inlinevirtual |
Since this is not required here (there's no real master to refresh) this does nothing.
Reimplemented from MasterClient.
Definition at line 81 of file customservers.h.
void CustomServers::setServers | ( | const QList< CustomServerInfo > & | csiList, |
QObject * | receiver, | ||
const char * | slotUpdated, | ||
const char * | slotBegunRefreshing | ||
) |
Sets a list of custom servers.
csiList | - list of custom servers. If element's engineIndex is < 0 the element is discarded. Also the element will be discarded if it's hostname cannot be resolved. |
receiver | - object to receive server signals |
slotUpdated | - slot to receive Server::updated signals |
slotBegunRefreshing | - slot to receive Server::begunRefreshing signals |
Definition at line 92 of file customservers.cpp.