summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-12 11:59:23 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-12 11:59:23 +0000
commite528a508b7e307bd35b142b269a0bbd1b6813e89 (patch)
treee7e0a45738745420c563b141398e60d51558b46c /protocols/VKontakte/src/misc.cpp
parent484267e90233bcef4ed9bda249053f5657b3974d (diff)
VKontakte:
- completely rewritten schema of pushing requests; - typed http parameters insted of old strings git-svn-id: http://svn.miranda-ng.org/main/trunk@7613 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r--protocols/VKontakte/src/misc.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
index b687f7fd16..1a3195812b 100644
--- a/protocols/VKontakte/src/misc.cpp
+++ b/protocols/VKontakte/src/misc.cpp
@@ -55,10 +55,10 @@ HANDLE CVkProto::FindUser(LONG dwUserid, bool bCreate)
return hNewContact;
}
-bool CVkProto::CheckMid(int msgid)
+bool CVkProto::CheckMid(int guid)
{
for (int i=m_sendIds.getCount()-1; i >= 0; i--)
- if (m_sendIds[i] == (HANDLE)msgid) {
+ if ((int)m_sendIds[i] == guid) {
m_sendIds.remove(i);
return true;
}
@@ -216,6 +216,31 @@ AsyncHttpRequest::AsyncHttpRequest()
AddHeader("Accept-Encoding", "booo");
}
+AsyncHttpRequest::AsyncHttpRequest(CVkProto *ppro, int iRequestType, LPCSTR _url, bool bSecure, VK_REQUEST_HANDLER pFunc)
+{
+ cbSize = sizeof(NETLIBHTTPREQUEST);
+
+ AddHeader("Connection", "keep-alive");
+ AddHeader("Accept-Encoding", "booo");
+
+ flags = VK_NODUMPHEADERS | NLHRF_DUMPASTEXT | NLHRF_HTTP11 | NLHRF_REDIRECT;
+ if (bSecure)
+ flags |= NLHRF_SSL;
+
+ if (*_url == '/') { // relative url leads to a site
+ m_szUrl = ((bSecure) ? "https://" : "http://") + CMStringA("api.vk.com");
+ m_szUrl += _url;
+ bIsMainConn = true;
+ }
+ else m_szUrl = _url;
+
+ if (bSecure)
+ this << CHAR_PARAM("access_token", ppro->m_szAccessToken);
+
+ requestType = iRequestType;
+ m_pFunc = pFunc;
+}
+
AsyncHttpRequest::~AsyncHttpRequest()
{
for (int i=0; i < headersCount; i++) {
@@ -223,7 +248,6 @@ AsyncHttpRequest::~AsyncHttpRequest()
mir_free(headers[i].szValue);
}
mir_free(headers);
- mir_free(szUrl);
mir_free(pData);
}
@@ -240,7 +264,7 @@ void AsyncHttpRequest::Redirect(NETLIBHTTPREQUEST *nhr)
for (int i=0; i < nhr->headersCount; i++) {
LPCSTR szValue = nhr->headers[i].szValue;
if (!_stricmp(nhr->headers[i].szName, "Location"))
- replaceStr(szUrl, szValue);
+ m_szUrl = szValue;
}
}
@@ -286,7 +310,7 @@ void CVkProto::ApplyCookies(AsyncHttpRequest *pReq)
CMStringA szCookie;
for (int i=0; i < m_cookies.getCount(); i++) {
- if ( !strstr(pReq->szUrl, m_cookies[i].m_domain))
+ if (!strstr(pReq->m_szUrl, m_cookies[i].m_domain))
continue;
if (!szCookie.IsEmpty())