summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-13 07:47:08 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-13 07:47:08 +0000
commit7ee4e8dc6a95e14c5d565f6172be02ea5ee1f4d9 (patch)
treebd94d553ddb796e58da365c93e13f6d0a3307b9e /protocols
parent2224b7cfa5a1adb17fcec0e14fa3c5e507446291 (diff)
userid became LONG everywhere
git-svn-id: http://svn.miranda-ng.org/main/trunk@6475 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/VKontakte/src/vk_avatars.cpp4
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp6
-rw-r--r--protocols/VKontakte/src/vk_proto.h7
-rw-r--r--protocols/VKontakte/src/vk_queue.cpp20
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp14
5 files changed, 17 insertions, 34 deletions
diff --git a/protocols/VKontakte/src/vk_avatars.cpp b/protocols/VKontakte/src/vk_avatars.cpp
index 53d583b657..a939cd2820 100644
--- a/protocols/VKontakte/src/vk_avatars.cpp
+++ b/protocols/VKontakte/src/vk_avatars.cpp
@@ -109,7 +109,7 @@ void CVkProto::GetAvatarFileName(HANDLE hContact, TCHAR* pszDest, size_t cbLen)
szFileType = p;
}
- ptrA id( getStringA(hContact, "ID"));
- mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%S%s"), id, szFileType);
+ LONG id = getDword(hContact, "ID", -1);
+ mir_sntprintf(pszDest + tPathLen, MAX_PATH - tPathLen, _T("%d%s"), id, szFileType);
}
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 07740f4725..47bc8171d1 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -129,8 +129,8 @@ void CVkProto::SendMsgAck(void *param)
int CVkProto::SendMsg(HANDLE hContact, int flags, const char *msg)
{
- ptrA szID( getStringA(hContact, "ID"));
- if (szID == NULL)
+ LONG userID = getDword(hContact, "ID", -1);
+ if (userID == -1)
return 0;
ptrA szMsg;
@@ -141,6 +141,8 @@ int CVkProto::SendMsg(HANDLE hContact, int flags, const char *msg)
else
msg = mir_utf8encode(msg);
+ char szID[40];
+ _itoa(userID, szID, 10);
HttpParam params[] = {
{ "type", "0" },
{ "uid", szID },
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index a1f3347ac7..5ce0b55980 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -92,7 +92,7 @@ struct CVkProto : public PROTO<CVkProto>
TCHAR* GetUserStoredPassword(void);
- void RetrieveUserInfo(LPCSTR szUserId);
+ void RetrieveUserInfo(LONG userId);
void OnReceiveUserInfo(NETLIBHTTPREQUEST*, void*);
void RetrieveFriends();
@@ -138,7 +138,6 @@ private:
void ExecuteRequest(AsyncHttpRequest*);
bool PushAsyncHttpRequest(int iRequestType, LPCSTR szUrl, bool bSecure, VK_REQUEST_HANDLER pFunc, int nParams = 0, HttpParam *pParams = 0, int iTimeout = 10000);
bool PushAsyncHttpRequest(AsyncHttpRequest*, int iTimeout = 10000);
- int SetupConnection(void);
void __cdecl WorkerThread(void*);
CMStringA RunCaptchaForm(LPCSTR szUrl);
@@ -160,8 +159,8 @@ private:
bool m_bOnline;
- HANDLE m_hNetlibConn;
- ptrA m_szAccessToken, m_myUserId;
+ LONG m_myUserId;
+ ptrA m_szAccessToken;
ptrT m_defaultGroup;
UINT_PTR m_timer;
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp
index 6efc4d29ea..8ccb048df3 100644
--- a/protocols/VKontakte/src/vk_queue.cpp
+++ b/protocols/VKontakte/src/vk_queue.cpp
@@ -32,22 +32,6 @@ void CVkProto::UninitQueue()
/////////////////////////////////////////////////////////////////////////////////////////
-int CVkProto::SetupConnection()
-{
- if (m_hNetlibConn != NULL)
- return TRUE;
-
- NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
- nloc.flags = NLOCF_SSL | NLOCF_HTTP | NLOCF_V2;
- nloc.szHost = VK_API_URL;
- nloc.wPort = 443;
- nloc.timeout = 5000;
- m_hNetlibConn = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&nloc);
- return m_hNetlibConn != NULL;
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq)
{
NETLIBHTTPREQUEST *reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)pReq);
@@ -63,9 +47,6 @@ void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq)
bool CVkProto::PushAsyncHttpRequest(int iRequestType, LPCSTR szUrl, bool bSecure, VK_REQUEST_HANDLER pFunc, int nParams, HttpParam *pParams, int iTimeout)
{
- if ( !SetupConnection())
- return false;
-
AsyncHttpRequest *pReq = new AsyncHttpRequest();
pReq->flags = NLHRF_NODUMPHEADERS | NLHRF_DUMPASTEXT | NLHRF_PERSISTENT | NLHRF_HTTP11 | NLHRF_REDIRECT;
if (bSecure)
@@ -75,7 +56,6 @@ bool CVkProto::PushAsyncHttpRequest(int iRequestType, LPCSTR szUrl, bool bSecure
if (*szUrl == '/') {
url = VK_API_URL;
url += szUrl;
- pReq->nlc = m_hNetlibConn;
}
else url = szUrl;
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index 43f495756f..50bb8df30e 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -184,9 +184,8 @@ void CVkProto::OnReceiveMyInfo(NETLIBHTTPREQUEST *reply, void*)
JSONNODE *it = json_at(pResponse, i);
LPCSTR id = json_name(it);
if ( !_stricmp(id, "user_id")) {
- ptrT userid( json_as_string(it));
- m_myUserId = mir_t2a(userid);
- setTString("ID", userid);
+ m_myUserId = json_as_int(it);
+ setDword("ID", m_myUserId);
}
else if ( !_stricmp(id, "user_name"))
setTString("Nick", ptrT( json_as_string(it)));
@@ -212,8 +211,11 @@ void CVkProto::OnReceiveMyInfo(NETLIBHTTPREQUEST *reply, void*)
/////////////////////////////////////////////////////////////////////////////////////////
-void CVkProto::RetrieveUserInfo(LPCSTR szUserId)
+void CVkProto::RetrieveUserInfo(LONG userID)
{
+ char szUserId[40];
+ _itoa(userID, szUserId, 10);
+
HttpParam params[] = {
{ "fields", "uid,first_name,last_name,photo,sex,bdate,city,relation" },
{ "uids", szUserId },
@@ -241,8 +243,8 @@ void CVkProto::OnReceiveUserInfo(NETLIBHTTPREQUEST *reply, void*)
JSONNODE *it = json_at(pResponse, i);
LPCSTR id = json_name(it);
if ( !_stricmp(id, "user_id")) {
- ptrA userid( _T2A( json_as_string(it)));
- if ( !lstrcmpA(userid, m_myUserId))
+ LONG userid = json_as_int(it);
+ if (userid == m_myUserId)
hContact = NULL;
else if ((hContact = FindUser(userid, false)) == NULL)
return;