summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);