diff options
author | George Hazan <ghazan@miranda.im> | 2017-01-12 21:27:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-01-12 21:27:03 +0300 |
commit | 3cb3883908e3168e5f955be3143771721614307a (patch) | |
tree | e160797994b28577e5fa71a4c790e1670e6f4035 /protocols/Gadu-Gadu/src | |
parent | 6461f17159c83bfaeba1ecbd124ab53551f3e22d (diff) |
Netlib_FreeHttpRequest() instead of MS_NETLIB_FREEHTTPREQUESTSTRUCT
Diffstat (limited to 'protocols/Gadu-Gadu/src')
-rw-r--r-- | protocols/Gadu-Gadu/src/avatar.cpp | 31 | ||||
-rw-r--r-- | protocols/Gadu-Gadu/src/oauth.cpp | 16 |
2 files changed, 24 insertions, 23 deletions
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index 9587cd11b0..24ac5b6e68 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -68,7 +68,7 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) req.szUrl = szUrl;
req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_REDIRECT;
- NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
if (resp == NULL) {
debugLogA("getAvatarFileInfo(): No response from HTTP request");
return false;
@@ -76,7 +76,7 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) if (resp->resultCode != 200 || !resp->dataLength || !resp->pData) {
debugLogA("getAvatarFileInfo(): Invalid response code from HTTP request");
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
return false;
}
@@ -118,14 +118,14 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) }
}
}
-
- } else {
+ }
+ else {
debugLogA("getAvatarFileInfo(): Invalid response code from HTTP request, unknown format");
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
return false;
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
return true;
}
@@ -250,7 +250,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) req.szUrl = data->szAvatarURL;
req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_REDIRECT;
- NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
int file_fd;
@@ -276,7 +276,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) }
}
else debugLogA("avatarrequestthread(): Invalid response code from HTTP request");
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
}
else debugLogA("avatarrequestthread(): No response from HTTP request");
@@ -436,7 +436,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) //send request
int resultSuccess = 0;
int needRepeat = 0;
- NETLIBHTTPREQUEST* resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ NETLIBHTTPREQUEST* resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
debugLogA("setavatarthread(): 1 resp.data= %s", resp->pData);
@@ -447,7 +447,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) needRepeat = 1;
}
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
} else {
debugLogA("setavatarthread(): No response from HTTP request");
}
@@ -471,18 +471,17 @@ void __cdecl GGPROTO::setavatarthread(void *param) req.pData = data;
req.dataLength = int(dataLen);
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
debugLogA("setavatarthread(): 2 resp.data= %s", resp->pData);
resultSuccess = 1;
- } else {
- debugLogA("setavatarthread(): Invalid response code from HTTP request [%d]", resp->resultCode);
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
- } else {
- debugLogA("setavatarthread(): No response from HTTP request");
+ else debugLogA("setavatarthread(): Invalid response code from HTTP request [%d]", resp->resultCode);
+
+ Netlib_FreeHttpRequest(resp);
}
+ else debugLogA("setavatarthread(): No response from HTTP request");
}
//clean and end thread
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 2a24e7e5c5..bf1bb81504 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -311,7 +311,7 @@ int GGPROTO::oauth_receivetoken() req.headersCount = 3;
req.headers = httpHeaders;
- NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
if (resp) {
nlc = resp->nlc;
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
@@ -329,7 +329,7 @@ int GGPROTO::oauth_receivetoken() mir_free(xmlAction);
}
else debugLogA("oauth_receivetoken(): Invalid response code from HTTP request");
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
}
else debugLogA("oauth_receivetoken(): No response from HTTP request");
@@ -356,9 +356,11 @@ int GGPROTO::oauth_receivetoken() req.pData = str;
req.dataLength = (int)mir_strlen(str);
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
- if (resp) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
- else debugLogA("oauth_receivetoken(): No response from HTTP request");
+ resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
+ if (resp)
+ Netlib_FreeHttpRequest(resp);
+ else
+ debugLogA("oauth_receivetoken(): No response from HTTP request");
// 3. Obtaining an Access Token
debugLogA("oauth_receivetoken(): Obtaining an Access Token...");
@@ -381,7 +383,7 @@ int GGPROTO::oauth_receivetoken() httpHeaders[1].szName = "Authorization";
httpHeaders[1].szValue = str;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
wchar_t *xmlAction = mir_a2u(resp->pData);
@@ -399,7 +401,7 @@ int GGPROTO::oauth_receivetoken() }
else debugLogA("oauth_receivetoken(): Invalid response code from HTTP request");
Netlib_CloseHandle(resp->nlc);
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
}
else debugLogA("oauth_receivetoken(): No response from HTTP request");
|