summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-04-09 20:39:05 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-04-09 20:39:05 +0000
commitf2840507e11f4220e606b99bb2e895acd5cb6811 (patch)
tree6033a7134a4381e85dbc02625c88433bb7709ec9 /protocols
parentb80be7b3bbfae105935f49c34e9e64f1760ad08e (diff)
Steam: fixed errors in x64
git-svn-id: http://svn.miranda-ng.org/main/trunk@8904 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Steam/src/Steam/authorization.h22
-rw-r--r--protocols/Steam/src/Steam/friend.h2
-rw-r--r--protocols/Steam/src/Steam/friend_list.h5
-rw-r--r--protocols/Steam/src/Steam/login.h7
-rw-r--r--protocols/Steam/src/Steam/message.h41
-rw-r--r--protocols/Steam/src/Steam/poll.h12
-rw-r--r--protocols/Steam/src/http_request.h2
-rw-r--r--protocols/Steam/src/steam.h1
-rw-r--r--protocols/Steam/src/steam_account.cpp5
-rw-r--r--protocols/Steam/src/steam_utils.cpp6
10 files changed, 51 insertions, 52 deletions
diff --git a/protocols/Steam/src/Steam/authorization.h b/protocols/Steam/src/Steam/authorization.h
index e9b1733107..27921e2aa1 100644
--- a/protocols/Steam/src/Steam/authorization.h
+++ b/protocols/Steam/src/Steam/authorization.h
@@ -66,20 +66,20 @@ namespace SteamWebApi
ptrA base64Username(mir_urlEncode(ptrA(mir_utf8encodeW(username))));
- CMStringA data;
- data.AppendFormat("username=%s", base64Username);
- data.AppendFormat("&password=%s", ptrA(mir_urlEncode(password)));
- data.AppendFormat("&emailauth=%s", ptrA(mir_urlEncode(authResult->emailauth.c_str())));
- data.AppendFormat("&emailsteamid=%s", authResult->emailsteamid.c_str());
- data.AppendFormat("&captchagid=%s", authResult->captchagid.c_str());
- data.AppendFormat("&captcha_text=%s", ptrA(mir_urlEncode(authResult->captcha_text.c_str())));
- data.AppendFormat("&rsatimestamp=%s", timestamp);
- data.AppendFormat("&oauth_scope=%s", "read_profile write_profile read_client write_client");
- data.Append("&oauth_client_id=DE45CD61");
+ char data[1024];
+ mir_snprintf(data, SIZEOF(data),
+ "username=%s&password=%s&emailauth=%s&emailsteamid=%s&captchagid=%s&captcha_text=%s&rsatimestamp=%s&oauth_client_id=DE45CD61",
+ base64Username,
+ ptrA(mir_urlEncode(password)),
+ ptrA(mir_urlEncode(authResult->emailauth.c_str())),
+ authResult->emailsteamid.c_str(),
+ authResult->captchagid.c_str(),
+ ptrA(mir_urlEncode(authResult->captcha_text.c_str())),
+ timestamp);
HttpRequest request(hConnection, REQUEST_POST, STEAM_COM_URL "/mobilelogin/dologin");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
- request.SetData(data.GetBuffer(), data.GetLength());
+ request.SetData(data, strlen(data));
mir_ptr<NETLIBHTTPREQUEST> response(request.Send());
if (!response)
diff --git a/protocols/Steam/src/Steam/friend.h b/protocols/Steam/src/Steam/friend.h
index c01226e823..23ce23d319 100644
--- a/protocols/Steam/src/Steam/friend.h
+++ b/protocols/Steam/src/Steam/friend.h
@@ -44,7 +44,7 @@ namespace SteamWebApi
std::vector<Summary*> items;
public:
- int GetItemCount() const { return items.size(); }
+ size_t GetItemCount() const { return items.size(); }
const Summary *GetAt(int idx) const { return items.at(idx); }
};
diff --git a/protocols/Steam/src/Steam/friend_list.h b/protocols/Steam/src/Steam/friend_list.h
index 160e3a0df5..c5c529a0b9 100644
--- a/protocols/Steam/src/Steam/friend_list.h
+++ b/protocols/Steam/src/Steam/friend_list.h
@@ -14,9 +14,8 @@ namespace SteamWebApi
std::vector<std::string> items;
public:
- int GetItemCount() const { return items.size(); }
-
- const char *GetAt(int idx) const { return items.at(idx).c_str(); }
+ size_t GetItemCount() const { return items.size(); }
+ const char * GetAt(int idx) const { return items.at(idx).c_str(); }
};
static void Load(HANDLE hConnection, const char *token, const char *steamId, FriendList *friendList)
diff --git a/protocols/Steam/src/Steam/login.h b/protocols/Steam/src/Steam/login.h
index d46e0a8e52..e4d748313a 100644
--- a/protocols/Steam/src/Steam/login.h
+++ b/protocols/Steam/src/Steam/login.h
@@ -26,13 +26,12 @@ namespace SteamWebApi
{
loginResult->success = false;
- CMStringA data;
- data.AppendFormat("access_token=%s", token);
- //data.Append("&ui_mode=web");
+ char data[128];
+ mir_snprintf(data, SIZEOF(data), "access_token=%s", token);
HttpRequest request(hConnection, REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Logon/v0001");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
- request.SetData(data.GetBuffer(), data.GetLength());
+ request.SetData(data, strlen(data));
mir_ptr<NETLIBHTTPREQUEST> response(request.Send());
if (!response)
diff --git a/protocols/Steam/src/Steam/message.h b/protocols/Steam/src/Steam/message.h
index d390049e4c..bc3bd8243b 100644
--- a/protocols/Steam/src/Steam/message.h
+++ b/protocols/Steam/src/Steam/message.h
@@ -23,15 +23,16 @@ namespace SteamWebApi
{
sendResult->success = false;
- CMStringA data;
- data.AppendFormat("access_token=%s", token);
- data.AppendFormat("&umqid=%s", sessionId);
- data.AppendFormat("&persona_state=%u", state);
- data.Append("&type=personastate");
+ char data[256];
+ mir_snprintf(data, SIZEOF(data),
+ "access_token=%s&umqid=%s&persona_state=%i&type=personastate",
+ token,
+ sessionId,
+ state);
HttpRequest request(hConnection, REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
- request.SetData(data.GetBuffer(), data.GetLength());
+ request.SetData(data, strlen(data));
mir_ptr<NETLIBHTTPREQUEST> response(request.Send());
if (!response)
@@ -47,16 +48,17 @@ namespace SteamWebApi
{
sendResult->success = false;
- CMStringA data;
- data.AppendFormat("access_token=%s", token);
- data.AppendFormat("&umqid=%s", sessionId);
- data.AppendFormat("&steamid_dst=%s", steamId);
- data.Append("&type=saytext");
- data.AppendFormat("&text=%s", ptrA(mir_urlEncode(text)));
+ char data[1024];
+ mir_snprintf(data, SIZEOF(data),
+ "access_token=%s&umqid=%s&steamid_dst=%s&type=saytext&text=%s",
+ token,
+ sessionId,
+ steamId,
+ ptrA(mir_urlEncode(text)));
HttpRequest request(hConnection, REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
- request.SetData(data.GetBuffer(), data.GetLength());
+ request.SetData(data, strlen(data));
mir_ptr<NETLIBHTTPREQUEST> response(request.Send());
if (!response)
@@ -83,15 +85,16 @@ namespace SteamWebApi
{
sendResult->success = false;
- CMStringA data;
- data.AppendFormat("access_token=%s", token);
- data.AppendFormat("&umqid=%s", sessionId);
- data.AppendFormat("&steamid_dst=%s", steamId);
- data.Append("&type=typing");
+ char data[256];
+ mir_snprintf(data, SIZEOF(data),
+ "access_token=%s&umqid=%s&steamid_dst=%s&type=typing",
+ token,
+ sessionId,
+ steamId);
HttpRequest request(hConnection, REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Message/v0001");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
- request.SetData(data.GetBuffer(), data.GetLength());
+ request.SetData(data, strlen(data));
mir_ptr<NETLIBHTTPREQUEST> response(request.Send());
if (!response)
diff --git a/protocols/Steam/src/Steam/poll.h b/protocols/Steam/src/Steam/poll.h
index 78d337d388..c94551e3e9 100644
--- a/protocols/Steam/src/Steam/poll.h
+++ b/protocols/Steam/src/Steam/poll.h
@@ -72,8 +72,8 @@ namespace SteamWebApi
PollResult() : messageId(0), need_relogin(false) { }
UINT32 GetMessageId() const { return messageId; }
- int IsNeedRelogin() const { return need_relogin; }
- int GetItemCount() const { return items.size(); }
+ bool IsNeedRelogin() const { return need_relogin; }
+ size_t GetItemCount() const { return items.size(); }
const PoolItem *GetAt(int idx) const { return items.at(idx); }
};
@@ -83,14 +83,12 @@ namespace SteamWebApi
pollResult->need_relogin = false;
pollResult->items.clear();
- CMStringA data;
- data.AppendFormat("access_token=%s", token);
- data.AppendFormat("&umqid=%s", sessionId);
- data.AppendFormat("&message=%iu", messageId);
+ char data[512];
+ mir_snprintf(data, SIZEOF(data), "access_token=%s&umqid=%s&message=%u", token, sessionId, messageId);
HttpRequest request(hConnection, REQUEST_POST, STEAM_API_URL "/ISteamWebUserPresenceOAuth/Poll/v0001");
request.AddHeader("Content-Type", "application/x-www-form-urlencoded");
- request.SetData(data.GetBuffer(), data.GetLength());
+ request.SetData(data, strlen(data));
request.SetTimeout(90000); // may need to encrease timeout
mir_ptr<NETLIBHTTPREQUEST> response(request.Send());
diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h
index 2e3f9e17a2..9425e8223c 100644
--- a/protocols/Steam/src/http_request.h
+++ b/protocols/Steam/src/http_request.h
@@ -70,7 +70,7 @@ public:
if (pData != NULL)
mir_free(pData);
- dataLength = size;
+ dataLength = (int)size;
pData = (char*)mir_alloc(size);
memcpy(pData, data, size);
}
diff --git a/protocols/Steam/src/steam.h b/protocols/Steam/src/steam.h
index 376491066f..f95e7f9e4e 100644
--- a/protocols/Steam/src/steam.h
+++ b/protocols/Steam/src/steam.h
@@ -11,7 +11,6 @@
#include <m_options.h>
#include <m_popup.h>
#include <m_json.h>
-#include <m_string.h>
#include <m_imgsrvc.h>
#include <m_protocols.h>
#include <m_protomod.h>
diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp
index 523c5f09f2..4dd80088a4 100644
--- a/protocols/Steam/src/steam_account.cpp
+++ b/protocols/Steam/src/steam_account.cpp
@@ -58,14 +58,15 @@ void CSteamProto::Authorize(SteamWebApi::AuthorizationApi::AuthResult *authResul
DWORD error = 0;
DWORD encryptedSize = 0;
- if ((error = RsaEncrypt(rsaKey, password, strlen(password), NULL, encryptedSize)) != 0)
+ DWORD passwordSize = (DWORD)strlen(password);
+ if ((error = RsaEncrypt(rsaKey, password, passwordSize, NULL, encryptedSize)) != 0)
{
debugLogA("CSteamProto::Rsa: encryption error (%lu)", error);
return;
}
BYTE *encryptedPassword = (BYTE*)mir_calloc(encryptedSize);
- if ((error = RsaEncrypt(rsaKey, password, strlen(password), encryptedPassword, encryptedSize)) != 0)
+ if ((error = RsaEncrypt(rsaKey, password, passwordSize, encryptedPassword, encryptedSize)) != 0)
{
debugLogA("CSteamProto::Rsa: encryption error (%lu)", error);
return;
diff --git a/protocols/Steam/src/steam_utils.cpp b/protocols/Steam/src/steam_utils.cpp
index 2f2caca443..821d6ef3e1 100644
--- a/protocols/Steam/src/steam_utils.cpp
+++ b/protocols/Steam/src/steam_utils.cpp
@@ -49,7 +49,7 @@ int CSteamProto::MirandaToSteamState(int status)
int CSteamProto::RsaEncrypt(const SteamWebApi::RsaKeyApi::RsaKey &rsaKey, const char *data, DWORD dataSize, BYTE *encryptedData, DWORD &encryptedSize)
{
const char *pszModulus = rsaKey.GetModulus();
- DWORD cchModulus = strlen(pszModulus);
+ DWORD cchModulus = (DWORD)strlen(pszModulus);
// convert hex string to byte array
DWORD cbLen = 0, dwSkip = 0, dwFlags = 0;
@@ -62,7 +62,7 @@ int CSteamProto::RsaEncrypt(const SteamWebApi::RsaKeyApi::RsaKey &rsaKey, const
return GetLastError();
// reverse byte array, because of microsoft
- for (int i = 0; i < cbLen / 2; ++i)
+ for (int i = 0; i < (int)(cbLen / 2); ++i)
{
BYTE temp = pbBuffer[cbLen - i - 1];
pbBuffer[cbLen - i - 1] = pbBuffer[i];
@@ -117,7 +117,7 @@ int CSteamProto::RsaEncrypt(const SteamWebApi::RsaKeyApi::RsaKey &rsaKey, const
return GetLastError();
// reverse byte array again
- for (int i = 0; i < encryptedSize / 2; ++i)
+ for (int i = 0; i < (int)(encryptedSize / 2); ++i)
{
BYTE temp = encryptedData[encryptedSize - i - 1];
encryptedData[encryptedSize - i - 1] = encryptedData[i];