Added server-version configuration, which supports the GSOC server (version 2).
Made version 1 compatible with the 0.8.1 stkaddon server (i.e. all commands are sent to client-user.php, and receive the actual command as 'action' parameter).
This commit is contained in:
parent
940a296366
commit
93fcb9a2a7
@ -694,6 +694,12 @@ namespace UserConfigParams
|
||||
&m_online_group,
|
||||
"The server used for online multiplayer."));
|
||||
|
||||
PARAM_PREFIX IntUserConfigParam m_server_version
|
||||
PARAM_DEFAULT( IntUserConfigParam( 1,
|
||||
"server-version",
|
||||
&m_online_group,
|
||||
"Version of the server API to use."));
|
||||
|
||||
// ---- Addon server related entries
|
||||
PARAM_PREFIX GroupUserConfigParam m_addon_group
|
||||
PARAM_DEFAULT( GroupUserConfigParam("AddonAndNews",
|
||||
|
@ -99,18 +99,30 @@ namespace Online
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
/** A handy shortcut that appends the given path to the URL of the
|
||||
* mutiplayer server.
|
||||
* mutiplayer server. It also supports the old (version 1) api,
|
||||
* where a 'action' parameter was sent to 'client-user.php'.
|
||||
* \param path The path to add to the server.(see API::USER_*)
|
||||
* \param action The action to perform. eg: connect, pool
|
||||
*/
|
||||
void HTTPRequest::setApiURL(const std::string& path, const std::string &action)
|
||||
void HTTPRequest::setApiURL(const std::string& path,
|
||||
const std::string &action)
|
||||
{
|
||||
setURL(
|
||||
(std::string)UserConfigParams::m_server_multiplayer +
|
||||
API::VERSION + "/" + // eg: v1, v2, etc
|
||||
path + // eg: user/, server/
|
||||
action + "/" // eg: connect/, pool/, get-server-list/
|
||||
);
|
||||
// Old (0.8.1) API: send to client-user.php, and add action as a parameter
|
||||
if(UserConfigParams::m_server_version==1)
|
||||
{
|
||||
setURL( (std::string)UserConfigParams::m_server_multiplayer +
|
||||
"client-user.php" );
|
||||
addParameter("action", action);
|
||||
}
|
||||
else
|
||||
{
|
||||
setURL(
|
||||
(std::string)UserConfigParams::m_server_multiplayer +
|
||||
API::VERSION + "/" + // eg: v1, v2, etc
|
||||
path + // eg: user/, server/
|
||||
action + "/" // eg: connect/, pool/, get-server-list/
|
||||
);
|
||||
}
|
||||
} // setServerURL
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user