summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-04-10 19:33:27 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-04-10 19:33:27 +0000
commitab05a30ab1f725e421287bf8158508c3ba3eddd3 (patch)
treeccbbd21993e21a9e8a6d358d0216e980b1818e65
parenta1ef91459fb0a353c9919c1b8ff349efdf162b3c (diff)
Steam: small fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@8938 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--protocols/Steam/Steam_12.vcxproj4
-rw-r--r--protocols/Steam/Steam_12.vcxproj.filters12
-rw-r--r--protocols/Steam/src/Steam/message.h2
-rw-r--r--protocols/Steam/src/http_request.h4
-rw-r--r--protocols/Steam/src/steam_account.cpp25
-rw-r--r--protocols/Steam/src/steam_contacts.cpp10
-rw-r--r--protocols/Steam/src/steam_proto.cpp22
-rw-r--r--protocols/Steam/src/steam_proto.h1
-rw-r--r--protocols/Steam/src/steam_thread.cpp4
-rw-r--r--protocols/Steam/src/steam_utils.cpp16
10 files changed, 65 insertions, 35 deletions
diff --git a/protocols/Steam/Steam_12.vcxproj b/protocols/Steam/Steam_12.vcxproj
index 1208a72e32..6cf599dbfa 100644
--- a/protocols/Steam/Steam_12.vcxproj
+++ b/protocols/Steam/Steam_12.vcxproj
@@ -192,9 +192,10 @@
</ResourceCompile>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClInclude Include="src\common.h" />
<ClInclude Include="src\http_request.h" />
- <ClInclude Include="src\steam.h" />
<ClInclude Include="src\Steam\authorization.h" />
+ <ClInclude Include="src\Steam\avatar.h" />
<ClInclude Include="src\Steam\crypto.h" />
<ClInclude Include="src\Steam\friend.h" />
<ClInclude Include="src\Steam\friend_list.h" />
@@ -208,6 +209,7 @@
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\steam_account.cpp" />
+ <ClCompile Include="src\steam_avatars.cpp" />
<ClCompile Include="src\steam_contacts.cpp" />
<ClCompile Include="src\steam_events.cpp" />
<ClCompile Include="src\steam_dialogs.cpp" />
diff --git a/protocols/Steam/Steam_12.vcxproj.filters b/protocols/Steam/Steam_12.vcxproj.filters
index 04374351bd..e928166046 100644
--- a/protocols/Steam/Steam_12.vcxproj.filters
+++ b/protocols/Steam/Steam_12.vcxproj.filters
@@ -48,6 +48,9 @@
<ClCompile Include="src\steam_utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\steam_avatars.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\resource.h">
@@ -59,9 +62,6 @@
<ClInclude Include="src\steam_proto.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\steam.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\http_request.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -89,6 +89,12 @@
<ClInclude Include="src\Steam\message.h">
<Filter>Header Files\Steam</Filter>
</ClInclude>
+ <ClInclude Include="src\Steam\avatar.h">
+ <Filter>Header Files\Steam</Filter>
+ </ClInclude>
+ <ClInclude Include="src\common.h">
+ <Filter>Header Files</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
diff --git a/protocols/Steam/src/Steam/message.h b/protocols/Steam/src/Steam/message.h
index 389f50b13e..38427d5fcc 100644
--- a/protocols/Steam/src/Steam/message.h
+++ b/protocols/Steam/src/Steam/message.h
@@ -25,7 +25,7 @@ namespace SteamWebApi
char data[256];
mir_snprintf(data, SIZEOF(data),
- "access_token=%s&umqid=%s&persona_state=%i&type=personastate",
+ "access_token=%s&umqid=%s&type=personastate&persona_state=%i",
token,
sessionId,
state);
diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h
index 8ba2ebffa1..47e9acc3d8 100644
--- a/protocols/Steam/src/http_request.h
+++ b/protocols/Steam/src/http_request.h
@@ -140,7 +140,9 @@ class SecureHttpRequest : public HttpRequest
{
public:
SecureHttpRequest(HANDLE hNetlibUser, int request, LPCSTR url)
- : HttpRequest(hNetlibUser, request, url) { flags = NLHRF_HTTP11 | NLHRF_SSL; }
+ : HttpRequest(hNetlibUser, request, url) {
+ flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMPSEND;
+ }
};
#endif //_HTTP_REQUEST_H_ \ No newline at end of file
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();
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 52f59ab466..dd461c909c 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -48,6 +48,16 @@ void CSteamProto::UpdateContact(MCONTACT hContact, const SteamWebApi::FriendApi:
// only for contacts
if (hContact)
{
+ /*{
+ "type": "personastate",
+ "timestamp" : 130789088,
+ "utc_timestamp" : 1397151246,
+ "steamid_from" : "76561198010620323",
+ "status_flags" : 863,
+ "persona_state" : 4,
+ "persona_name" : "necrostorm"
+ }*/
+
setWord(hContact, "Status", SteamToMirandaStatus(contact->GetState()));
setDword(hContact, "LastEventDateTS", contact->GetLastEvent());
}
diff --git a/protocols/Steam/src/steam_proto.cpp b/protocols/Steam/src/steam_proto.cpp
index 94e592e2fb..771d80e96b 100644
--- a/protocols/Steam/src/steam_proto.cpp
+++ b/protocols/Steam/src/steam_proto.cpp
@@ -106,6 +106,8 @@ DWORD_PTR __cdecl CSteamProto:: GetCaps(int type, MCONTACT hContact)
return PF2_ONLINE;
case PFLAGNUM_4:
return PF4_AVATARS;
+ case PFLAGNUM_5:
+ return PF2_SHORTAWAY | PF2_HEAVYDND | PF2_OUTTOLUNCH;
case PFLAG_UNIQUEIDTEXT:
return (DWORD_PTR)Translate("SteamID");
case PFLAG_UNIQUEIDSETTING:
@@ -236,19 +238,19 @@ int CSteamProto::SetStatus(int new_status)
m_iStatus = ID_STATUS_CONNECTING;
ForkThread(&CSteamProto::LogInThread, NULL);
}
- else
- {
- if (IsOnline())
- {
- ForkThread(&CSteamProto::SetServerStatusThread, &new_status);
+ //else
+ //{
+ //if (IsOnline())
+ //{
+ // ForkThread(&CSteamProto::SetServerStatusThread, (void*)new_status);
- return 0;
- }
+ // return 0;
+ //}
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
+ //ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
- return 0;
- }
+ //return 0;
+ //}
}
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, m_iStatus);
diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h
index beef8660fa..a4c459bdb9 100644
--- a/protocols/Steam/src/steam_proto.h
+++ b/protocols/Steam/src/steam_proto.h
@@ -106,6 +106,7 @@ protected:
// account
bool IsOnline();
bool IsMe(const char *steamId);
+ void SetServerStatus(WORD status);
void Authorize(SteamWebApi::AuthorizationApi::AuthResult *authResult);
void __cdecl LogInThread(void*);
void __cdecl LogOutThread(void*);
diff --git a/protocols/Steam/src/steam_thread.cpp b/protocols/Steam/src/steam_thread.cpp
index e528092d03..c0b410fab0 100644
--- a/protocols/Steam/src/steam_thread.cpp
+++ b/protocols/Steam/src/steam_thread.cpp
@@ -68,7 +68,9 @@ void CSteamProto::PollStatus(const char *token, const char *sessionId, UINT32 me
if (IsMe(steamId))
{
debugLogA("Change own status to %i", status);
- SetStatus(status);
+ WORD oldStatus = m_iStatus;
+ m_iStatus = m_iDesiredStatus = status;
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
}
else
{
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp
index 821d6ef3e1..862164e957 100644
--- a/protocols/Steam/src/steam_utils.cpp
+++ b/protocols/Steam/src/steam_utils.cpp
@@ -10,10 +10,9 @@ WORD CSteamProto::SteamToMirandaStatus(int state)
return ID_STATUS_DND;
case 3: //Away
return ID_STATUS_AWAY;
- /*case 4: //Snoozing
- prim = PURPLE_STATUS_EXTENDED_AWAY;
- break;
- case 5: //Looking to trade
+ case 4: //Playing
+ return PF2_OUTTOLUNCH;
+ /*case 5: //Looking to trade
return "trade";
case 6: //Looking to play
return "play";*/
@@ -33,12 +32,11 @@ int CSteamProto::MirandaToSteamState(int status)
return 2; //Busy
case ID_STATUS_AWAY:
return 3; //Away
- /*case 4: //Snoozing
- prim = PURPLE_STATUS_EXTENDED_AWAY;
- break;
- case 5: //Looking to trade
+ /*case PF2_OUTTOLUNCH:
+ return 4; //Playing
+ case 5: //Looking to trade
return "trade";
- case 6: //Looking to play
+ case 6: //Looking to play
return "play";*/
//case 1: //Online
default: