#include <customservers.h>
Public Member Functions | |
bool | hasSameServer (const Server *otherServer) const |
const EnginePlugin * | plugin () const override |
QList< ServerPtr > | readConfig () |
void | refreshStarts () override |
QList< ServerPtr > | setServers (const QList< CustomServerInfo > &serverDefs) |
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 | 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) |
static bool | isServerPinned (const CustomServerInfo &serverInfo) |
static void | setServerPinned (const CustomServerInfo &serverInfo, bool pinned) |
Protected Member Functions | |
QByteArray | createServerListRequest () override |
Produce contents of server list request packet that is sent to the master server. More... | |
Response | readMasterResponse (const QByteArray &data) override |
Called to read and analyze the response from the MasterServer. More... | |
Protected Member Functions inherited from MasterClient | |
QHostAddress | address () const |
Address of the master server. More... | |
void | emptyServerList () |
QString | masterBanHelp_default () const |
unsigned short | port () const |
Network port of the master server. More... | |
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 56 of file customservers.h.
|
inlineoverrideprotectedvirtual |
Produce contents of server list request packet that is sent to the master server.
Implements MasterClient.
Definition at line 109 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 54 of file customservers.cpp.
bool CustomServers::hasSameServer | ( | const Server * | otherServer | ) | const |
Returns true if server with the same plugin, host and port is known.
Definition at line 117 of file customservers.cpp.
|
inlineoverridevirtual |
This is supposed to return the plugin this MasterClient belongs to. If it doesn't belong to any plugin then return nullptr. 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 82 of file customservers.h.
QList< ServerPtr > CustomServers::readConfig | ( | ) |
Convenience method - tries to read config seeking for "CustomServers" entry, decode it and launch setServers() method.
Definition at line 128 of file customservers.cpp.
|
inlineoverrideprotectedvirtual |
Called to read and analyze the response from the MasterServer.
Implements MasterClient.
Definition at line 113 of file customservers.h.
|
inlineoverridevirtual |
Since this is not required here (there's no real master to refresh) this does nothing.
Reimplemented from MasterClient.
Definition at line 97 of file customservers.h.
QList< ServerPtr > CustomServers::setServers | ( | const QList< CustomServerInfo > & | serverDefs | ) |
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 its hostname cannot be resolved. |
Definition at line 151 of file customservers.cpp.