summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2015-05-05 15:03:08 +0000
committerRobert Pösel <robyer@seznam.cz>2015-05-05 15:03:08 +0000
commitcf4dec2379e4c1558c5b6346810dc07d9670b557 (patch)
treebf759004815dc364ec0a7d918f6330f12aa4c2df
parent62c035c1dfc9ab599ab5403869022ebbc7910f66 (diff)
Steam: Handle expired token (this solves silent login error)
git-svn-id: http://svn.miranda-ng.org/main/trunk@13442 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Steam/src/steam_account.cpp24
-rw-r--r--protocols/Steam/src/steam_proto.h2
2 files changed, 18 insertions, 8 deletions
diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp
index 43328069a3..af1d1e5cb5 100644
--- a/protocols/Steam/src/steam_account.cpp
+++ b/protocols/Steam/src/steam_account.cpp
@@ -208,12 +208,24 @@ void CSteamProto::OnGotSession(const NETLIBHTTPREQUEST *response, void *)
}
}
+void CSteamProto::HandleTokenExpired()
+{
+ // Notify error to user
+ ShowNotification(_T("Steam"), TranslateT("Connection token expired. Please login again."));
+
+ // Delete expired token
+ delSetting("TokenSecret");
+
+ // Set status to offline
+ SetStatus(ID_STATUS_OFFLINE);
+}
+
void CSteamProto::OnLoggedOn(const NETLIBHTTPREQUEST *response, void *)
{
if (response == NULL)
{
- SetStatus(ID_STATUS_OFFLINE);
- return;
+ // Probably expired TokenSecret
+ return HandleTokenExpired();
}
JSONROOT root(response->pData);
@@ -222,12 +234,8 @@ void CSteamProto::OnLoggedOn(const NETLIBHTTPREQUEST *response, void *)
ptrW error(json_as_string(node));
if (lstrcmpi(error, L"OK")/* || response->resultCode == HTTP_STATUS_UNAUTHORIZED*/)
{
- //delSetting("TokenSecret");
- //delSetting("Cookie");
-
- // set status to offline
- SetStatus(ID_STATUS_OFFLINE);
- return;
+ // Probably expired TokenSecret
+ return HandleTokenExpired();
}
node = json_get(root, "umqid");
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h
index 6487a4ed9f..1a2e7f38f2 100644
--- a/protocols/Steam/src/steam_proto.h
+++ b/protocols/Steam/src/steam_proto.h
@@ -190,6 +190,8 @@ protected:
void OnLoggedOn(const NETLIBHTTPREQUEST *response, void *arg);
+ void HandleTokenExpired();
+
// contacts
void SetContactStatus(MCONTACT hContact, WORD status);
void SetAllContactsStatus(WORD status);