Mania++
 All Classes Functions Variables Pages
Public Member Functions | Private Attributes | List of all members
Methods Class Reference

Contains all server methods and returns usable data types. More...

#include <Methods.h>

Public Member Functions

 Methods (GbxRemote *serverPtr, std::map< std::string, Player > *playerListPtr)
 Constructor with link to server connection. More...
 
GbxError GetCurrentError ()
 Returns the current server error (from GbxRemote).
 
bool Authenticate (std::string username, std::string password)
 Authenticates with the server. Returns whether authentication was successful. More...
 
bool ChangeAuthPassword (std::string username, std::string password)
 Changes authentication passwordd. Returns whether change was successful. More...
 
bool EnableCallbacks (bool enable)
 Enables/disables callbacks. Returns whether change was successful. More...
 
bool SetApiVersion (std::string version)
 Sets the API version of the server. Returns whether change was successful. More...
 
std::vector< std::string > ListMethods ()
 Returns list of available server methods. More...
 
ServerVersion GetVersion ()
 Returns server version information. More...
 
SystemInfo GetSystemInfo ()
 Returns system information. More...
 
bool SetConnectionRates (int downloadRate, int uploadRate)
 Sets the server connection rates. More...
 
ServerStatus GetStatus ()
 Returns server status. More...
 
bool QuitGame ()
 Quit the server.
 
bool ChatSendServerMessage (std::string text)
 Send chat message to all players. More...
 
bool ChatSendServerMessageToLogin (std::string text, std::string login)
 Send chat message to player login. More...
 
bool ChatSendServerMessageToPlayer (std::string text, Player player)
 Send chat message to player. More...
 
std::vector< std::string > GetChatLines ()
 Get latest chat lines.
 
bool ChatEnableManualRouting (bool enable, bool autoForward)
 Enable/disable manual chat routing. More...
 
bool ChatForwardToLogin (std::string text, std::string sender, std::string destination="")
 Forwards chat message to player. More...
 
bool SendNotice (std::string text, std::string avatarLogin="", int variant=0)
 Send notice to all players. More...
 
bool SendNoticeToLogin (std::string login, std::string text, std::string avatarLogin="", int variant=0)
 Send notice to player login. More...
 
bool SendOpenLinkToLogin (std::string login, std::string link, int linkType)
 Send link to player login. More...
 
bool CallVote (std::string xmlRequest)
 Start callvote. More...
 
bool CallVoteEx (std::string xmlRequest, double ratio, int timeout, int whoVotes)
 Start callvote. More...
 
bool CancelVote ()
 Cancels the current callvote.
 
CurrentCallVote GetCurrentCallVote ()
 Returns the current callvote.
 
bool SetCallVoteTimeOut (int timeout)
 Sets the default callvote timeout. More...
 
CurrentNextValue GetCallVoteTimeOut ()
 Gets the default callvote timeout.
 
bool SetCallVoteRatio (double ratio)
 Sets the default callvote ratio. More...
 
double GetCallVoteRatio ()
 Gets the default callvote ratio.
 
bool SetCallVoteRatios (std::vector< CallVoteRatio > ratios)
 Sets the callvote ratios. More...
 
std::vector< CallVoteRatioGetCallVoteRatios ()
 Gets the callvote ratios.
 
bool SetCallVoteRatiosEx (bool replaceAll, std::vector< ExtendedCallVoteRatio > ratios)
 Sets the callvote ratios. More...
 
std::vector
< ExtendedCallVoteRatio
GetCallVoteRatiosEx ()
 Gets the callvote ratios.
 
bool SendDisplayManialinkPage (std::string page, int timeout, bool hideOnClick)
 Displays ManiaLink page to all players. More...
 
bool SendDisplayManialinkPageToLogin (std::string login, std::string page, int timeout, bool hideOnClick)
 Displays ManiaLink page to a player. More...
 
bool SendHideManialinkPage ()
 Hides all ManiaLink pages for all players.
 
bool SendHideManialinkPageToLogin (std::string login)
 Hides all ManiaLink pages for a player. More...
 
std::vector< ManiaLinkPageAnswerGetManialinkPageAnswers ()
 Returns the latest results from the current ManiaLink page.
 
Map GetNextMapInfo ()
 Provides a map object for the map being played next on the server.
 
Map GetCurrentMapInfo ()
 Provides a map object for the map currently being played on the server. More...
 
Map GetMapInfo (std::string fileName)
 Provides a map object for the map with the specified file name. More...
 
bool CheckMapForCurrentServerParams (std::string fileName)
 Checks if the map matches the current server settings. More...
 
std::vector< MapGetMapList (int limit, int index)
 Gets the maplist from the server. More...
 
bool AddMap (std::string fileName)
 Add the map with the specified filename at the end of the current selection. More...
 
int AddMapList (std::vector< std::string > fileNames)
 Add the list of maps with the specified filenames at the end of the current selection. More...
 
bool RemoveMap (std::string fileName)
 Remove the map with the specified filename from the current selection. More...
 
int RemoveMapList (std::vector< std::string > fileNames)
 Remove the list of maps with the specified filenames from the current selection. More...
 
bool InsertMap (std::string fileName)
 Insert the map with the specified filename after the current map. More...
 
int InsertMapList (std::vector< std::string > fileNames)
 Insert the list of maps with the specified filenames after the current map. More...
 
bool ChooseNextMap (std::string fileName)
 Set as next map the one with the specified filename, if it is present in the selection. More...
 
int ChooseNextMapList (std::vector< std::string > fileNames)
 Set as next maps the list of maps with the specified filenames, if they are present in the selection. More...
 

Private Attributes

GbxRemoteserver
 Pointer to GbxRemote.
 
std::map< std::string, Player > * playerList
 Pointer to the playerlist.
 

Detailed Description

Contains all server methods and returns usable data types.

Constructor & Destructor Documentation

Methods::Methods ( GbxRemote serverPtr,
std::map< std::string, Player > *  playerListPtr 
)

Constructor with link to server connection.

Parameters
serverPtrPointer to server connection.
playerListPtrPointer to the playerlist.

Member Function Documentation

bool Methods::AddMap ( std::string  fileName)

Add the map with the specified filename at the end of the current selection.

Parameters
fileNameFilename of the map.
int Methods::AddMapList ( std::vector< std::string >  fileNames)

Add the list of maps with the specified filenames at the end of the current selection.

Parameters
fileNamesList of map filenames.
bool Methods::Authenticate ( std::string  username,
std::string  password 
)

Authenticates with the server. Returns whether authentication was successful.

Parameters
usernameServer username (f.e. SuperAdmin).
passwordServer password.
bool Methods::CallVote ( std::string  xmlRequest)

Start callvote.

Parameters
xmlRequestCallvote request.
bool Methods::CallVoteEx ( std::string  xmlRequest,
double  ratio,
int  timeout,
int  whoVotes 
)

Start callvote.

Parameters
xmlRequestCallvote request.
ratioPassing ratio (between 0 and 1, -1 = default).
timeoutTimeout for the callvote (0 = default, 1 = indefinite).
whoVotesWho votes for the callvote (0 = active players, 1 = all players, 2 = everyone, including spectators).
bool Methods::ChangeAuthPassword ( std::string  username,
std::string  password 
)

Changes authentication passwordd. Returns whether change was successful.

Parameters
usernameServer username (f.e. SuperAdmin).
passwordNew password for user.
bool Methods::ChatEnableManualRouting ( bool  enable,
bool  autoForward 
)

Enable/disable manual chat routing.

Parameters
enableEnable routing?
autoForwardAutoforward?
bool Methods::ChatForwardToLogin ( std::string  text,
std::string  sender,
std::string  destination = "" 
)

Forwards chat message to player.

Parameters
textChat message.
senderSending login.
destinationDestination login (empty for all players).
bool Methods::ChatSendServerMessage ( std::string  text)

Send chat message to all players.

Parameters
textChat message.
bool Methods::ChatSendServerMessageToLogin ( std::string  text,
std::string  login 
)

Send chat message to player login.

Parameters
textChat message.
loginPlayer login to which the message should be send.
bool Methods::ChatSendServerMessageToPlayer ( std::string  text,
Player  player 
)

Send chat message to player.

Parameters
textChat message.
playerPlayer object to which the message should be send.
bool Methods::CheckMapForCurrentServerParams ( std::string  fileName)

Checks if the map matches the current server settings.

Parameters
fileNameFile name of the map.
bool Methods::ChooseNextMap ( std::string  fileName)

Set as next map the one with the specified filename, if it is present in the selection.

Parameters
fileNameFilename of the map.
int Methods::ChooseNextMapList ( std::vector< std::string >  fileNames)

Set as next maps the list of maps with the specified filenames, if they are present in the selection.

Parameters
fileNamesList of map filenames.
bool Methods::EnableCallbacks ( bool  enable)

Enables/disables callbacks. Returns whether change was successful.

Parameters
enableEnable (true) or disable (false).
Map Methods::GetCurrentMapInfo ( )

Provides a map object for the map currently being played on the server.

This is mainly meant for the start-up of the controller. The current map can always be request via the Current property of MapList.

Map Methods::GetMapInfo ( std::string  fileName)

Provides a map object for the map with the specified file name.

Parameters
fileNameFile name of the map.
std::vector< Map > Methods::GetMapList ( int  limit,
int  index 
)

Gets the maplist from the server.

Parameters
limitMaximum amount of maps to be retrieved.
indexMap index on which to start the retrieval.
ServerStatus Methods::GetStatus ( )

Returns server status.

Returns empty struct if no information could be retrieved.

SystemInfo Methods::GetSystemInfo ( )

Returns system information.

Returns empty struct if no information could be retrieved.

ServerVersion Methods::GetVersion ( )

Returns server version information.

Returns empty struct if no information could be retrieved.

bool Methods::InsertMap ( std::string  fileName)

Insert the map with the specified filename after the current map.

Parameters
fileNameFilename of the map.
int Methods::InsertMapList ( std::vector< std::string >  fileNames)

Insert the list of maps with the specified filenames after the current map.

Parameters
fileNamesList of map filenames.
std::vector< std::string > Methods::ListMethods ( )

Returns list of available server methods.

Returns empty vector if no methods could be retrieved.

bool Methods::RemoveMap ( std::string  fileName)

Remove the map with the specified filename from the current selection.

Parameters
fileNameFilename of the map.
int Methods::RemoveMapList ( std::vector< std::string >  fileNames)

Remove the list of maps with the specified filenames from the current selection.

Parameters
fileNamesList of map filenames.
bool Methods::SendDisplayManialinkPage ( std::string  page,
int  timeout,
bool  hideOnClick 
)

Displays ManiaLink page to all players.

Parameters
pageXML page to be displayed.
timeoutTimeout to autohide (0 = permanent).
hideOnClickHide the page if a page option is clicked.
bool Methods::SendDisplayManialinkPageToLogin ( std::string  login,
std::string  page,
int  timeout,
bool  hideOnClick 
)

Displays ManiaLink page to a player.

Parameters
loginPlayer login.
pageXML page to be displayed.
timeoutTimeout to autohide (0 = permanent).
hideOnClickHide the page if a page option is clicked.
bool Methods::SendHideManialinkPageToLogin ( std::string  login)

Hides all ManiaLink pages for a player.

Parameters
loginPlayer login.
bool Methods::SendNotice ( std::string  text,
std::string  avatarLogin = "",
int  variant = 0 
)

Send notice to all players.

Parameters
textChat message.
avatarLoginAvatar login.
variantNotice variant (0 = normal, 1 = sad, 2 = happy).
bool Methods::SendNoticeToLogin ( std::string  login,
std::string  text,
std::string  avatarLogin = "",
int  variant = 0 
)

Send notice to player login.

Parameters
loginPlayer login.
textChat message.
avatarLoginAvatar login.
variantNotice variant (0 = normal, 1 = sad, 2 = happy).
bool Methods::SendOpenLinkToLogin ( std::string  login,
std::string  link,
int  linkType 
)

Send link to player login.

Parameters
loginPlayer login.
linkLink address.
linkTypeLink type (0 = external, 1 = ManiaLink).
bool Methods::SetApiVersion ( std::string  version)

Sets the API version of the server. Returns whether change was successful.

Parameters
versionAPI version.
bool Methods::SetCallVoteRatio ( double  ratio)

Sets the default callvote ratio.

Parameters
ratioDefault timeout.
bool Methods::SetCallVoteRatios ( std::vector< CallVoteRatio ratios)

Sets the callvote ratios.

Parameters
ratiosList of callvote ratios.
bool Methods::SetCallVoteRatiosEx ( bool  replaceAll,
std::vector< ExtendedCallVoteRatio ratios 
)

Sets the callvote ratios.

Parameters
replaceAllReplace all current callvote ratios?
ratiosList of callvote ratios.
Todo:
Implement when GbxParameters supports structs.
bool Methods::SetCallVoteTimeOut ( int  timeout)

Sets the default callvote timeout.

Parameters
timeoutDefault timeout.
bool Methods::SetConnectionRates ( int  downloadRate,
int  uploadRate 
)

Sets the server connection rates.

Parameters
downloadRateNew download rate.
uploadRateNew upload rate.

The documentation for this class was generated from the following files: