From 5d2487dc97a63b0545b2d7d56405e7417fa2dd75 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Wed, 9 Apr 2014 12:06:39 +0000 Subject: Steam: - add searching by name - added contact info updating - small improvements git-svn-id: http://svn.miranda-ng.org/main/trunk@8901 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/src/steam_thread.cpp | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'protocols/Steam/src/steam_thread.cpp') diff --git a/protocols/Steam/src/steam_thread.cpp b/protocols/Steam/src/steam_thread.cpp index ef6cb813b0..a4adad5ba8 100644 --- a/protocols/Steam/src/steam_thread.cpp +++ b/protocols/Steam/src/steam_thread.cpp @@ -7,9 +7,10 @@ void CSteamProto::PollStatus(const char *token, const char *sessionId, UINT32 me if (!pollResult->IsSuccess()) return; + CMStringA updatedIds; for (int i = 0; i < pollResult->GetItemCount(); i++) { - const SteamWebApi::PollApi::PoolItem *item = pollResult->operator[](i); + const SteamWebApi::PollApi::PoolItem *item = pollResult->GetAt(i); switch (item->GetType()) { case SteamWebApi::PollApi::POOL_TYPE_TYPING: @@ -83,11 +84,19 @@ void CSteamProto::PollStatus(const char *token, const char *sessionId, UINT32 me SetContactStatus(hContact, status); } + + if (updatedIds.IsEmpty()) + updatedIds.Append(steamId); + else + updatedIds.AppendFormat(",%s", steamId); } } break; } } + + if (!updatedIds.IsEmpty()) + ForkThread(&CSteamProto::UpdateContactsThread, mir_strdup(updatedIds)); } void CSteamProto::PollingThread(void*) @@ -117,15 +126,22 @@ void CSteamProto::PollingThread(void*) }*/ if (!pollResult.IsSuccess()) + { + SetStatus(ID_STATUS_OFFLINE); + + // token has expired + if (pollResult.GetStatus() == HTTP_STATUS_UNAUTHORIZED) + { + delSetting("TokenSecret"); + delSetting("Cookie"); + } + break; + } messageId = pollResult.GetMessageId(); - } - - if (pollResult.IsSuccess()) setDword("MessageID", messageId); - else - SetStatus(ID_STATUS_OFFLINE); + } m_hPollingThread = NULL; debugLogA("CSteamProto::PollingThread: leaving"); -- cgit v1.2.3