From ab05a30ab1f725e421287bf8158508c3ba3eddd3 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Thu, 10 Apr 2014 19:33:27 +0000 Subject: Steam: small fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@8938 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Steam/src/steam_account.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'protocols/Steam/src/steam_account.cpp') diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp index 17e47887ab..a1261291ea 100644 --- a/protocols/Steam/src/steam_account.cpp +++ b/protocols/Steam/src/steam_account.cpp @@ -16,7 +16,7 @@ bool CSteamProto::IsMe(const char *steamId) void CSteamProto::SetServerStatusThread(void *arg) { - WORD status = *((WORD*)arg); + WORD status = *((WORD*)&arg); ptrA token(getStringA("TokenSecret")); ptrA sessionId(getStringA("SessionID")); @@ -24,19 +24,27 @@ void CSteamProto::SetServerStatusThread(void *arg) int state = CSteamProto::MirandaToSteamState(status); // change status - if (m_iStatus == state) - return; - - int oldStatus = m_iStatus; - m_iStatus = state; + WORD oldStatus = m_iStatus; + m_iDesiredStatus = status; SteamWebApi::MessageApi::SendResult sendResult; SteamWebApi::MessageApi::SendStatus(m_hNetlibUser, token, sessionId, state, &sendResult); if (sendResult.IsSuccess()) + { + m_iStatus = status; ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus); + } else - m_iStatus = oldStatus; + m_iDesiredStatus = m_iStatus; +} + +void CSteamProto::SetServerStatus(WORD status) +{ + if (m_iStatus == status) + return; + + ForkThread(&CSteamProto::SetServerStatusThread, (void*)status); } void CSteamProto::Authorize(SteamWebApi::AuthorizationApi::AuthResult *authResult) @@ -163,8 +171,7 @@ void CSteamProto::LogInThread(void* param) setDword("MessageID", loginResult.GetMessageId()); // set selected status - m_iStatus = m_iDesiredStatus; - ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iDesiredStatus); + //CSteamProto::SetServerStatusThread((void*)m_iDesiredStatus); // load contact list LoadContactList(); -- cgit v1.2.3