From 9f522eb773175d67693db495250fd7c45dd1ec54 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 10 Apr 2014 13:59:14 +0000 Subject: Steam: minor fixes and improvements git-svn-id: http://svn.miranda-ng.org/main/trunk@8934 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/Steam_10.vcxproj | 2 +- protocols/Steam/src/Steam/login.h | 2 +- protocols/Steam/src/steam_account.cpp | 6 +++++- protocols/Steam/src/steam_avatars.cpp | 6 +++++- protocols/Steam/src/steam_contacts.cpp | 34 ++++++++++++++-------------------- protocols/Steam/src/steam_dialogs.cpp | 1 - protocols/Steam/src/steam_thread.cpp | 3 +++ 7 files changed, 29 insertions(+), 25 deletions(-) diff --git a/protocols/Steam/Steam_10.vcxproj b/protocols/Steam/Steam_10.vcxproj index 5cd612d9c6..ec0391f1f0 100644 --- a/protocols/Steam/Steam_10.vcxproj +++ b/protocols/Steam/Steam_10.vcxproj @@ -19,7 +19,7 @@ - {8236EA1F-579A-4AFB-9DFE-5FA056AEDDBB} + {F5282DBC-756B-4071-B186-3E82C0E8E1F7} Steam diff --git a/protocols/Steam/src/Steam/login.h b/protocols/Steam/src/Steam/login.h index 16e5708327..c9a39c8ce4 100644 --- a/protocols/Steam/src/Steam/login.h +++ b/protocols/Steam/src/Steam/login.h @@ -26,7 +26,7 @@ namespace SteamWebApi { loginResult->success = false; - char data[128]; + char data[256]; mir_snprintf(data, SIZEOF(data), "access_token=%s", token); SecureHttpRequest request(hConnection, REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logon/v0001"); diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp index f7d86e7c68..17e47887ab 100644 --- a/protocols/Steam/src/steam_account.cpp +++ b/protocols/Steam/src/steam_account.cpp @@ -170,7 +170,7 @@ void CSteamProto::LogInThread(void* param) LoadContactList(); // start pooling thread - if (m_hPollingThread == NULL && !m_bTerminated) + if (m_hPollingThread == NULL) { m_bTerminated = false; m_hPollingThread = ForkThreadEx(&CSteamProto::PollingThread, NULL, NULL); @@ -182,6 +182,10 @@ void CSteamProto::LogOutThread(void*) ptrA token(getStringA("TokenSecret")); ptrA sessionId(getStringA("SessionID")); + while (m_hPollingThread != NULL) + Sleep(500); + + m_bTerminated = false; SteamWebApi::LoginApi::Logoff(m_hNetlibUser, token, sessionId); delSetting("SessionID"); diff --git a/protocols/Steam/src/steam_avatars.cpp b/protocols/Steam/src/steam_avatars.cpp index b009e1c32d..45ee6b80fe 100644 --- a/protocols/Steam/src/steam_avatars.cpp +++ b/protocols/Steam/src/steam_avatars.cpp @@ -99,4 +99,8 @@ INT_PTR CSteamProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) } return -1; -} \ No newline at end of file +} + +//INT_PTR CSteamProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) +//{ +//} \ No newline at end of file diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp index 8433425b33..52f59ab466 100644 --- a/protocols/Steam/src/steam_contacts.cpp +++ b/protocols/Steam/src/steam_contacts.cpp @@ -85,20 +85,15 @@ void CSteamProto::UpdateContact(MCONTACT hContact, const SteamWebApi::FriendApi: fwrite(avatar.GetData(), sizeof(char), avatar.GetDataSize(), fp); fclose(fp); - if (hContact) - { - PROTO_AVATAR_INFORMATIONW pai = { sizeof(pai) }; - pai.format = PA_FORMAT_JPEG; - pai.hContact = hContact; - wcscpy(pai.filename, avatarPath); + PROTO_AVATAR_INFORMATIONW pai = { sizeof(pai) }; + pai.format = PA_FORMAT_JPEG; + pai.hContact = hContact; + wcscpy(pai.filename, avatarPath); - ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0); - } - else - CallService(MS_AV_SETMYAVATART, (WPARAM)m_szModuleName, (LPARAM)avatarPath); - } + ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, (HANDLE)&pai, 0); - setString("AvatarUrl", contact->GetAvatarUrl()); + setString("AvatarUrl", contact->GetAvatarUrl()); + } } } @@ -130,16 +125,15 @@ void CSteamProto::UpdateContactsThread(void *arg) { const SteamWebApi::FriendApi::Summary *contact = summarues.GetAt(i); - if (IsMe(contact->GetSteamId())) - UpdateContact(NULL, contact); - else + MCONTACT hContact = NULL; + if (!IsMe(contact->GetSteamId())) { - MCONTACT hContact = this->FindContact(contact->GetSteamId()); - if (!hContact) - { - UpdateContact(hContact, contact); - } + hContact = this->FindContact(contact->GetSteamId()); + if (hContact == NULL) + return; } + + UpdateContact(hContact, contact); } } diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index ad836d841a..0b7711262a 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -157,7 +157,6 @@ INT_PTR CALLBACK CSteamProto::MainOptionsProc(HWND hwnd, UINT message, WPARAM wP { EnableWindow(GetDlgItem(hwnd, IDC_USERNAME), FALSE); EnableWindow(GetDlgItem(hwnd, IDC_PASSWORD), FALSE); - EnableWindow(GetDlgItem(hwnd, IDC_GROUP), FALSE); } } return TRUE; diff --git a/protocols/Steam/src/steam_thread.cpp b/protocols/Steam/src/steam_thread.cpp index 75c60577fd..e528092d03 100644 --- a/protocols/Steam/src/steam_thread.cpp +++ b/protocols/Steam/src/steam_thread.cpp @@ -66,7 +66,10 @@ void CSteamProto::PollStatus(const char *token, const char *sessionId, UINT32 me const wchar_t *nickname = state->GetNickname(); if (IsMe(steamId)) + { + debugLogA("Change own status to %i", status); SetStatus(status); + } else { MCONTACT hContact = FindContact(steamId); -- cgit v1.2.3