#include <customservers.h>
Public Member Functions | |
const EnginePlugin * | plugin () const |
void | readConfig (QObject *receiver, const char *slotUpdated, const char *slotBegunRefreshing) |
bool | readMasterResponse (QByteArray &data) |
Called to read and analyze the response from the MasterServer. | |
void | refresh () |
void | setServers (const QList< CustomServerInfo > &csiList, QObject *receiver, const char *slotUpdated, const char *slotBegunRefreshing) |
Static Public Member Functions | |
static void | decodeConfigEntries (const QString &str, QList< CustomServerInfo > &outCustomServerInfoList) |
Protected Member Functions | |
bool | getServerListRequest (QByteArray &data) |
Method that is supposed to produce the contents of server list request packet that is sent to the master server. |
A 'fake' master server that is used to handle custom servers from various engines.
void CustomServers::decodeConfigEntries | ( | const QString & | str, | |
QList< CustomServerInfo > & | outCustomServerInfoList | |||
) | [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 |
bool CustomServers::getServerListRequest | ( | QByteArray & | data | ) | [inline, protected, virtual] |
Method that is supposed to produce the contents of server list request packet that is sent to the master server.
Implements MasterClient.
const EnginePlugin* CustomServers::plugin | ( | ) | const [inline, virtual] |
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.
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 |
bool CustomServers::readMasterResponse | ( | QByteArray & | data | ) | [inline, virtual] |
Called to read and analyze the response from the MasterServer.
Implements MasterClient.
void CustomServers::refresh | ( | ) | [inline, virtual] |
Since this is not required here (there's no real master to refresh) this does nothing.
Reimplemented from MasterClient.
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 |