Fix signin leaking

This commit is contained in:
Benau 2018-03-05 16:34:15 +08:00
parent eec166c90d
commit d5c1ac30ab
6 changed files with 13 additions and 18 deletions

View File

@ -129,10 +129,10 @@ void PlayerManager::onSTKQuit()
* RequestManager.
*/
Online::XMLRequest *PlayerManager::requestSignIn(const irr::core::stringw &username,
const irr::core::stringw &password)
void PlayerManager::requestSignIn(const irr::core::stringw &username,
const irr::core::stringw &password)
{
return getCurrentPlayer()->requestSignIn(username, password);
getCurrentPlayer()->requestSignIn(username, password);
} // requestSignIn
// ----------------------------------------------------------------------------

View File

@ -111,8 +111,8 @@ public:
static void resumeSavedSession();
static void onSTKQuit();
static void requestSignOut();
static Online::XMLRequest *requestSignIn(const irr::core::stringw &username,
const irr::core::stringw &password);
static void requestSignIn(const irr::core::stringw &username,
const irr::core::stringw &password);
// ------------------------------------------------------------------------
/** Returns the current player. */

View File

@ -138,8 +138,8 @@ public:
virtual Online::OnlineProfile* getProfile() const = 0;
virtual void requestPoll() const = 0;
virtual void requestSavedSession() = 0;
virtual Online::XMLRequest* requestSignIn(const irr::core::stringw &username,
const irr::core::stringw &password) = 0;
virtual void requestSignIn(const irr::core::stringw &username,
const irr::core::stringw &password) = 0;
virtual void signIn(bool success, const XMLNode * input) = 0;
virtual void signOut(bool success, const XMLNode * input,
const irr::core::stringw &info) = 0;

View File

@ -1023,8 +1023,7 @@ int handleCmdLine()
if (!login.empty() && !password.empty())
{
irr::core::stringw s;
Online::XMLRequest* request =
PlayerManager::requestSignIn(login, password);
PlayerManager::requestSignIn(login, password);
while (PlayerManager::getCurrentOnlineState() != PlayerProfile::OS_SIGNED_IN)
{
Online::RequestManager::get()->update(0.0f);
@ -1032,7 +1031,6 @@ int handleCmdLine()
}
Log::info("Main", "Logged in from command-line.");
can_wan = true;
delete request;
}
if (!can_wan && CommandLine::has("--login-id", &n) &&

View File

@ -111,15 +111,14 @@ namespace Online
* \param username Name of user.
* \param password Password.
*/
OnlinePlayerProfile::SignInRequest*
OnlinePlayerProfile::requestSignIn(const core::stringw &username,
void OnlinePlayerProfile::requestSignIn(const core::stringw &username,
const core::stringw &password)
{
// If the player changes the online account, there can be a
// logout stil happening.
assert(m_online_state == OS_SIGNED_OUT ||
m_online_state == OS_SIGNING_OUT);
SignInRequest * request = new SignInRequest(false);
SignInRequest * request = new SignInRequest(true);
// We can't use setUserDetail here, since there is no token yet
request->setApiURL(API::USER_PATH, "connect");
@ -130,8 +129,6 @@ namespace Online
: "false");
request->queue();
m_online_state = OS_SIGNING_IN;
return request;
} // requestSignIn
// ------------------------------------------------------------------------

View File

@ -52,7 +52,7 @@ namespace Online
{
virtual void callback ();
public:
SignInRequest(bool manage_memory = false)
SignInRequest(bool manage_memory)
: XMLRequest(manage_memory, /*priority*/10) {}
}; // SignInRequest
@ -105,8 +105,8 @@ namespace Online
const std::string& getToken() const { return m_token; }
virtual void requestSavedSession();
virtual void requestSignOut();
virtual SignInRequest *requestSignIn(const irr::core::stringw &username,
const irr::core::stringw &password);
virtual void requestSignIn(const irr::core::stringw &username,
const irr::core::stringw &password);
public:
OnlinePlayerProfile(const XMLNode *player);