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 | |
parent | 6461f17159c83bfaeba1ecbd124ab53551f3e22d (diff) |
Netlib_FreeHttpRequest() instead of MS_NETLIB_FREEHTTPREQUESTSTRUCT
Diffstat (limited to 'protocols')
38 files changed, 150 insertions, 151 deletions
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index cb4fbf092f..15e88e87af 100755 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -280,7 +280,7 @@ void CAimProto::aim_connection_clientlogin(void) req.pData = buf.GetBuffer();
req.dataLength = buf.GetLength();
- NLHR_PTR resp(CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req));
+ NLHR_PTR resp(Netlib_HttpTransaction(m_hNetlibUser, &req));
if (!resp || !resp->dataLength) {
broadcast_status(ID_STATUS_OFFLINE);
return;
@@ -312,7 +312,7 @@ void CAimProto::aim_connection_clientlogin(void) };
req.headers = headers2;
- resp = CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
}
if (!resp || !resp->dataLength) {
diff --git a/protocols/Discord/src/connection.cpp b/protocols/Discord/src/connection.cpp index 969e85fb05..287beca884 100644 --- a/protocols/Discord/src/connection.cpp +++ b/protocols/Discord/src/connection.cpp @@ -39,14 +39,14 @@ void CDiscordProto::ExecuteRequest(AsyncHttpRequest *pReq) } debugLogA("Executing request #%d:\n%s", pReq->m_iReqNum, pReq->szUrl); - NETLIBHTTPREQUEST *reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)pReq); + NETLIBHTTPREQUEST *reply = Netlib_HttpTransaction(m_hNetlibUser, pReq); if (reply != NULL) { if (pReq->m_pCallback != NULL) (this->*(pReq->m_pCallback))(reply, pReq); m_hAPIConnection = reply->nlc; - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply); + Netlib_FreeHttpRequest(reply); } else { debugLogA("Request %d failed", pReq->m_iReqNum); diff --git a/protocols/FacebookRM/src/captcha.cpp b/protocols/FacebookRM/src/captcha.cpp index 5060d2c913..8e65cf6374 100644 --- a/protocols/FacebookRM/src/captcha.cpp +++ b/protocols/FacebookRM/src/captcha.cpp @@ -110,7 +110,7 @@ bool FacebookProto::RunCaptchaForm(std::string captchaUrl, std::string &result) req.szUrl = (char*)captchaUrl.c_str(); req.flags = NLHRF_NODUMPHEADERS; - NETLIBHTTPREQUEST *reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)facy.handle_, (LPARAM)&req); + NETLIBHTTPREQUEST *reply = Netlib_HttpTransaction(facy.handle_, &req); if (reply == NULL) return false; diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index 2e228719f3..c36c064994 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -108,7 +108,7 @@ http::response facebook_client::sendRequest(HttpRequest *request) resp.code = pnlhr->resultCode; resp.data = pnlhr->pData ? pnlhr->pData : ""; - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pnlhr); + Netlib_FreeHttpRequest(pnlhr); } else { parent->debugLogA("!!! No response from server (time-out)"); @@ -1192,8 +1192,7 @@ bool facebook_client::save_url(const std::string &url, const std::wstring &filen req.flags = NLHRF_HTTP11 | NLHRF_REDIRECT | NLHRF_PERSISTENT | NLHRF_NODUMP; req.nlc = nlc; - resp = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION, - reinterpret_cast<WPARAM>(handle_), reinterpret_cast<LPARAM>(&req))); + resp = Netlib_HttpTransaction(handle_, &req); bool ret = false; @@ -1215,7 +1214,7 @@ bool facebook_client::save_url(const std::string &url, const std::wstring &filen ret = _waccess(filename.c_str(), 0) == 0; } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp); + Netlib_FreeHttpRequest(resp); } else { nlc = NULL; diff --git a/protocols/FacebookRM/src/http_request.h b/protocols/FacebookRM/src/http_request.h index 64750eef39..9e3a578f56 100644 --- a/protocols/FacebookRM/src/http_request.h +++ b/protocols/FacebookRM/src/http_request.h @@ -289,7 +289,7 @@ public: Netlib_Logf(nlu, "Send request to %s", szUrl); - return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)nlu, (LPARAM)(NETLIBHTTPREQUEST*)this); + return Netlib_HttpTransaction(nlu, this); } }; diff --git a/protocols/GTalkExt/src/inbox.cpp b/protocols/GTalkExt/src/inbox.cpp index fb317bd2f8..b49d0e3854 100644 --- a/protocols/GTalkExt/src/inbox.cpp +++ b/protocols/GTalkExt/src/inbox.cpp @@ -51,7 +51,7 @@ const NETLIBHTTPHEADER HEADER_URL_ENCODED = { "Content-Type", "application/x-www #define NLH_INVALID 0
#define NLH_USER 'USER'
-LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams)
+LPSTR HttpPost(HNETLIBUSER hUser, LPSTR reqUrl, LPSTR reqParams)
{
NETLIBHTTPREQUEST nlhr = { sizeof(nlhr) };
nlhr.requestType = REQUEST_POST;
@@ -62,11 +62,11 @@ LPSTR HttpPost(HANDLE hUser, LPSTR reqUrl, LPSTR reqParams) nlhr.pData = reqParams;
nlhr.dataLength = (int)mir_strlen(reqParams);
- NLHR_PTR pResp((NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hUser, (LPARAM)&nlhr));
+ NLHR_PTR pResp(Netlib_HttpTransaction(hUser, &nlhr));
return ((pResp && pResp->resultCode == HTTP_OK) ? mir_strdup(pResp->pData) : nullptr);
}
-LPSTR MakeRequest(HANDLE hUser, LPSTR reqUrl, LPSTR reqParamsFormat, LPSTR p1, LPSTR p2)
+LPSTR MakeRequest(HNETLIBUSER hUser, LPSTR reqUrl, LPSTR reqParamsFormat, LPSTR p1, LPSTR p2)
{
ptrA encodedP1(mir_urlEncode(p1)), encodedP2(mir_urlEncode(p2));
size_t size = mir_strlen(reqParamsFormat) + 1 + mir_strlen(encodedP1) + mir_strlen(encodedP2);
@@ -104,7 +104,7 @@ void DoOpenUrl(LPSTR tokenResp, LPSTR url) Utils_OpenUrl(composedUrl);
}
-BOOL AuthAndOpen(HANDLE hUser, LPSTR url, LPSTR mailbox, LPSTR pwd)
+BOOL AuthAndOpen(HNETLIBUSER hUser, LPSTR url, LPSTR mailbox, LPSTR pwd)
{
ptrA authResp(MakeRequest(hUser, AUTH_REQUEST_URL, AUTH_REQUEST_PARAMS, mailbox, pwd));
if (!authResp)
@@ -127,7 +127,7 @@ struct OPEN_URL_HEADER { LPCSTR acc;
};
-HANDLE FindNetUserHandle(LPCSTR acc)
+HNETLIBUSER FindNetUserHandle(LPCSTR acc)
{
IJabberInterface *ji = getJabberApi(acc);
if (!ji)
@@ -140,7 +140,7 @@ void OpenUrlThread(void *param) {
OPEN_URL_HEADER* data = (OPEN_URL_HEADER*)param;
- HANDLE hUser = FindNetUserHandle(data->acc);
+ HNETLIBUSER hUser = FindNetUserHandle(data->acc);
if (!hUser || !AuthAndOpen(hUser, data->url, data->mailbox, data->pwd))
Utils_OpenUrl(data->url);
free(data);
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");
diff --git a/protocols/JabberG/src/jabber_api.cpp b/protocols/JabberG/src/jabber_api.cpp index 8d9e0a5a03..49b36cbb2a 100644 --- a/protocols/JabberG/src/jabber_api.cpp +++ b/protocols/JabberG/src/jabber_api.cpp @@ -353,7 +353,7 @@ LPTSTR CJabberProto::GetResourceFeatures(LPCTSTR jid) return str;
}
-HANDLE CJabberProto::GetHandle()
+HNETLIBUSER CJabberProto::GetHandle()
{
return m_hNetlibUser;
}
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp index 844436fc45..a604cd30fa 100755 --- a/protocols/JabberG/src/jabber_opt.cpp +++ b/protocols/JabberG/src/jabber_opt.cpp @@ -726,7 +726,7 @@ private: request.flags = NLHRF_REDIRECT | NLHRF_HTTP11;
request.szUrl = JABBER_SERVER_URL;
- NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
+ NETLIBHTTPREQUEST *result = Netlib_HttpTransaction(wnd->GetProto()->m_hNetlibUser, &request);
if (result) {
if (result->resultCode == 200 && result->dataLength && result->pData) {
wchar_t *buf = mir_a2u(result->pData);
@@ -738,7 +738,7 @@ private: }
mir_free(buf);
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)result);
+ Netlib_FreeHttpRequest(result);
}
if (bIsError)
@@ -2188,7 +2188,7 @@ void CJabberDlgAccMgrUI::QueryServerListThread(void *arg) request.flags = NLHRF_HTTP11;
request.szUrl = JABBER_SERVER_URL;
- NETLIBHTTPREQUEST *result = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)wnd->GetProto()->m_hNetlibUser, (LPARAM)&request);
+ NETLIBHTTPREQUEST *result = Netlib_HttpTransaction(wnd->GetProto()->m_hNetlibUser, &request);
if (result && IsWindow(hwnd)) {
if ((result->resultCode == 200) && result->dataLength && result->pData) {
wchar_t *ptszText = mir_a2u(result->pData);
@@ -2205,7 +2205,7 @@ void CJabberDlgAccMgrUI::QueryServerListThread(void *arg) }
if (result)
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)result);
+ Netlib_FreeHttpRequest(result);
if (bIsError)
SendMessage(hwnd, WM_JABBER_REFRESH, 0, 0);
}
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h index e9f721af67..9eb9640ea6 100644 --- a/protocols/JabberG/src/jabber_proto.h +++ b/protocols/JabberG/src/jabber_proto.h @@ -849,7 +849,8 @@ public: int STDMETHODCALLTYPE AddFeatures(LPCTSTR szFeatures); // Adds features to the list of features returned by the client.
int STDMETHODCALLTYPE RemoveFeatures(LPCTSTR szFeatures); // Removes features from the list of features returned by the client.
LPTSTR STDMETHODCALLTYPE GetResourceFeatures(LPCTSTR jid); // Returns all features supported by JID in format "feature1\0feature2\0...\0featureN\0\0". You must free returned string using mir_free().
- HANDLE STDMETHODCALLTYPE GetHandle(); // Returns connection handle
+
+ HNETLIBUSER STDMETHODCALLTYPE GetHandle(); // Returns connection handle
private:
JabberFeatCapPairDynamic *FindFeature(LPCTSTR szFeature);
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp index 54dc784587..4820aafc0d 100644 --- a/protocols/JabberG/src/jabber_util.cpp +++ b/protocols/JabberG/src/jabber_util.cpp @@ -898,7 +898,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) nlhr.szUrl = avs[i].Url;
nlhr.nlc = hHttpCon;
- NETLIBHTTPREQUEST * res = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST * res = Netlib_HttpTransaction(m_hNetlibUser, &nlhr);
if (res) {
hHttpCon = res->nlc;
if (res->resultCode == 200 && res->dataLength) {
@@ -941,7 +941,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param) }
}
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)res);
+ Netlib_FreeHttpRequest(res);
}
else hHttpCon = NULL;
}
diff --git a/protocols/MRA/src/MraAvatars.cpp b/protocols/MRA/src/MraAvatars.cpp index 6fb91f4131..a14c976c64 100644 --- a/protocols/MRA/src/MraAvatars.cpp +++ b/protocols/MRA/src/MraAvatars.cpp @@ -397,7 +397,7 @@ DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR if (dwSent == SOCKET_ERROR || !dwSent)
return GetLastError();
- NETLIBHTTPREQUEST *pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_RECVHTTPHEADERS, (WPARAM)hConnection, 0);
+ NETLIBHTTPREQUEST *pnlhr = Netlib_RecvHttpHeaders(hConnection);
if (!pnlhr)
return GetLastError();
@@ -428,7 +428,7 @@ DWORD MraAvatarsHttpTransaction(HANDLE hConnection, DWORD dwRequestType, LPCSTR if (pdwResultCode)
*pdwResultCode = pnlhr->resultCode;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pnlhr);
+ Netlib_FreeHttpRequest(pnlhr);
return 0;
}
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index 5e6631e242..5501cc4b51 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -286,7 +286,7 @@ bool SkypeToken::Refresh(bool bForce) }
m_proto->mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_proto->hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(m_proto->hNetlibUserHttps, &nlhr);
m_proto->mHttpsTS = clock();
if (nlhrReply) {
@@ -312,7 +312,7 @@ bool SkypeToken::Refresh(bool bForce) bRet=true;
}
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
} else m_proto->hHttpsConnection = NULL;
return bRet;
}
@@ -795,7 +795,7 @@ bool CMsnProto::RefreshOAuth(const char *pszRefreshToken, const char *pszService // Query
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
@@ -816,7 +816,7 @@ bool CMsnProto::RefreshOAuth(const char *pszRefreshToken, const char *pszService }
}
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
} else hHttpsConnection = NULL;
return bRet;
}
@@ -1117,7 +1117,7 @@ int CMsnProto::MSN_AuthOAuth(void) // Get oauth20 login data
nlhr.szUrl = AUTH_URL;
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
@@ -1142,7 +1142,7 @@ int CMsnProto::MSN_AuthOAuth(void) nlhr.flags &= (~NLHRF_REDIRECT);
mHttpsTS = clock();
nlhr.nlc = hHttpsConnection;
- NETLIBHTTPREQUEST *nlhrReply2 = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply2 = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply2) {
char *pszURL=NULL, *pAccessToken, *pEnd;
@@ -1171,14 +1171,14 @@ int CMsnProto::MSN_AuthOAuth(void) pszURL = param.pszURL;
mir_free(authCookies);
authCookies = nlhr.headers[1].szValue = param.pszCookies;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply2);
+ Netlib_FreeHttpRequest(nlhrReply2);
nlhrReply2 = NULL;
bAskingForAuth = false;
bPassportAuth = false;
}
}
setByte("PassportAuth", bPassportAuth);
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
nlhrReply = nlhrReply2;
if (pszURL &&
@@ -1245,8 +1245,9 @@ int CMsnProto::MSN_AuthOAuth(void) /* Request MappingContainer */
mHttpsTS = clock();
- if (nlhrReply) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ if (nlhrReply)
+ Netlib_FreeHttpRequest(nlhrReply);
+ nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
@@ -1275,8 +1276,10 @@ int CMsnProto::MSN_AuthOAuth(void) else hHttpsConnection = NULL;
}
}
- if (nlhrReply) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- } else hHttpsConnection = NULL;
+ if (nlhrReply)
+ Netlib_FreeHttpRequest(nlhrReply);
+ }
+ else hHttpsConnection = NULL;
if (retVal<=0) authSkypeComToken.Clear(); else {
if (bPassportAuth) {
diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index 8b1e6e0d46..88491305fd 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -61,13 +61,13 @@ bool CMsnProto::loadHttpAvatar(AvatarQueueEntry *p) nlhr.headers = (NETLIBHTTPHEADER*)&nlbhHeaders;
nlhr.headersCount = 1;
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(m_hNetlibUser, &nlhr);
if (nlhrReply == NULL)
return false;
if (nlhrReply->resultCode != 200 || nlhrReply->dataLength == 0) {
LBL_Error:
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return false;
}
@@ -90,7 +90,7 @@ LBL_Error: _close(fileId);
ProtoBroadcastAck(p->hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &ai, 0);
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
return true;
}
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 9e148547fb..cdea188a44 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -476,7 +476,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) nlhr.nlc = hHttpsConnection;
mHttpsTS = clock();
- nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
@@ -491,7 +491,7 @@ void CMsnProto::MSN_ProcessURIObject(MCONTACT hContact, ezxml_t xmli) }
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
} else hHttpsConnection = NULL;
if (fileSize) {
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 61eab09889..0f1a20f5fd 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -541,26 +541,24 @@ void __cdecl CMsnProto::MsnFileAckThread(void* arg) if (nloc.flags & NLOCF_SSL) nlhr.flags |= NLHRF_SSL;
HANDLE nlc = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&nloc);
- if (nlc && CallService(MS_NETLIB_SENDHTTPREQUEST, (WPARAM)nlc, (LPARAM)&nlhr) != SOCKET_ERROR &&
- (nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_RECVHTTPHEADERS, (WPARAM)nlc, 0)))
- {
- if (nlhrReply->resultCode == 200 || nlhrReply->resultCode == 206) {
- INT_PTR dw;
- char buf[1024];
-
- ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, ft, 0);
- while (!ft->bCanceled && ft->std.currentFileProgress < ft->std.currentFileSize &&
- (dw = Netlib_Recv(nlc, buf, sizeof(buf), MSG_NODUMP))>0 && dw!=SOCKET_ERROR)
- {
- _write(ft->fileId, buf, dw);
- ft->std.totalProgress += dw;
- ft->std.currentFileProgress += dw;
- ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->std);
- }
- if (ft->std.currentFileProgress == ft->std.currentFileSize) ft->std.currentFileNumber++;
-
+ if (nlc && CallService(MS_NETLIB_SENDHTTPREQUEST, (WPARAM)nlc, (LPARAM)&nlhr) != SOCKET_ERROR && (nlhrReply = Netlib_RecvHttpHeaders(nlc))) {
+ if (nlhrReply->resultCode == 200 || nlhrReply->resultCode == 206) {
+ INT_PTR dw;
+ char buf[1024];
+
+ ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_CONNECTED, ft, 0);
+ while (!ft->bCanceled && ft->std.currentFileProgress < ft->std.currentFileSize &&
+ (dw = Netlib_Recv(nlc, buf, sizeof(buf), MSG_NODUMP))>0 && dw!=SOCKET_ERROR)
+ {
+ _write(ft->fileId, buf, dw);
+ ft->std.totalProgress += dw;
+ ft->std.currentFileProgress += dw;
+ ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->std);
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ if (ft->std.currentFileProgress == ft->std.currentFileSize) ft->std.currentFileNumber++;
+
+ }
+ Netlib_FreeHttpRequest(nlhrReply);
}
Netlib_CloseHandle(nlc);
mir_free((char*)nloc.szHost);
diff --git a/protocols/MSN/src/msn_skypeab.cpp b/protocols/MSN/src/msn_skypeab.cpp index 604219b292..1a34f71ec0 100644 --- a/protocols/MSN/src/msn_skypeab.cpp +++ b/protocols/MSN/src/msn_skypeab.cpp @@ -68,7 +68,7 @@ bool CMsnProto::MSN_SKYABRefreshClist(void) // Query addressbook
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
@@ -101,7 +101,7 @@ bool CMsnProto::MSN_SKYABRefreshClist(void) json_delete(items);
MSN_SKYABGetProfiles((const char*)post);
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
}
else hHttpsConnection = NULL;
return bRet;
@@ -122,7 +122,7 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST) nlhr.pData = (char*)pszPOST;
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
@@ -155,7 +155,7 @@ bool CMsnProto::MSN_SKYABGetProfiles(const char *pszPOST) json_delete(items);
bRet = true;
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
}
else hHttpsConnection = NULL;
return bRet;
@@ -175,7 +175,7 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) nlhr.szUrl = szURL;
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
@@ -227,7 +227,7 @@ bool CMsnProto::MSN_SKYABGetProfile(const char *wlid) }
bRet = true;
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
}
else hHttpsConnection = NULL;
return bRet;
@@ -253,11 +253,11 @@ bool CMsnProto::MSN_SKYABBlockContact(const char *wlid, const char *pszAction) nlhr.pData = szPOST;
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
bRet = true;
}
else hHttpsConnection = NULL;
@@ -281,11 +281,11 @@ bool CMsnProto::MSN_SKYABDeleteContact(const char *wlid) nlhr.headersCount++;
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
bRet = true;
}
else hHttpsConnection = NULL;
@@ -307,11 +307,11 @@ bool CMsnProto::MSN_SKYABAuthRsp(const char *wlid, const char *pszAction) nlhr.szUrl = szURL;
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
bRet = true;
}
else hHttpsConnection = NULL;
@@ -339,11 +339,11 @@ bool CMsnProto::MSN_SKYABAuthRq(const char *wlid, const char *pszGreeting) nlhr.pData = (char*)(const char*)post;
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
bRet = true;
}
else hHttpsConnection = NULL;
@@ -370,7 +370,7 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch) nlhr.headersCount++;
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
@@ -400,7 +400,7 @@ bool CMsnProto::MSN_SKYABSearch(const char *keyWord, HANDLE hSearch) ProtoBroadcastAck(0, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, hSearch, 0);
bRet = true;
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
}
else hHttpsConnection = NULL;
return bRet;
diff --git a/protocols/MSN/src/msn_soapab.cpp b/protocols/MSN/src/msn_soapab.cpp index e8c28d2cb6..084f63bcea 100644 --- a/protocols/MSN/src/msn_soapab.cpp +++ b/protocols/MSN/src/msn_soapab.cpp @@ -862,7 +862,7 @@ bool CMsnProto::MSN_ABRefreshClist(unsigned int nTry) // Query addressbook
mHttpsTS = clock();
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
mHttpsTS = clock();
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
@@ -946,8 +946,9 @@ bool CMsnProto::MSN_ABRefreshClist(unsigned int nTry) authSkypeComToken.Clear();
if (MSN_AuthOAuth() > 0) return MSN_ABRefreshClist(1);
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
- } else hHttpsConnection = NULL;
+ Netlib_FreeHttpRequest(nlhrReply);
+ }
+ else hHttpsConnection = NULL;
return bRet;
}
diff --git a/protocols/MSN/src/msn_ssl.cpp b/protocols/MSN/src/msn_ssl.cpp index 6bcfcffeb8..7e8541ab7c 100644 --- a/protocols/MSN/src/msn_ssl.cpp +++ b/protocols/MSN/src/msn_ssl.cpp @@ -76,7 +76,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char }
// download the page
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
if (nlhrReply) {
hHttpsConnection = nlhrReply->nlc;
@@ -93,7 +93,7 @@ char* CMsnProto::getSslResult(char** parUrl, const char* parAuthInfo, const char nlhrReply->dataLength = 0;
nlhrReply->pData = NULL;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
}
else
hHttpsConnection = NULL;
@@ -120,15 +120,14 @@ bool CMsnProto::getMyAvatarFile(char *url, wchar_t *fname) nlhr.headers[0].szValue = (char*)MSN_USER_AGENT;
// download the page
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUserHttps, (LPARAM)&nlhr);
-
+ NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUserHttps, &nlhr);
if (nlhrReply) {
if (nlhrReply->resultCode == 200 && nlhrReply->dataLength)
MSN_SetMyAvatar(fname, nlhrReply->pData, nlhrReply->dataLength);
else
result = false;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply);
+ Netlib_FreeHttpRequest(nlhrReply);
}
return result;
}
diff --git a/protocols/MinecraftDynmap/src/communication.cpp b/protocols/MinecraftDynmap/src/communication.cpp index f61bc9d5af..9962317773 100644 --- a/protocols/MinecraftDynmap/src/communication.cpp +++ b/protocols/MinecraftDynmap/src/communication.cpp @@ -81,7 +81,7 @@ http::response MinecraftDynmapProto::sendRequest(const int request_type, std::st debugLogA("@@@@@ Sending request to '%s'", nlhr.szUrl); // Send the request - NETLIBHTTPREQUEST *pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *pnlhr = Netlib_HttpTransaction(m_hNetlibUser, &nlhr); mir_free(nlhr.headers); @@ -111,7 +111,7 @@ http::response MinecraftDynmapProto::sendRequest(const int request_type, std::st // debugLogA("&&&&& Got response: %s", resp.data.c_str()); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pnlhr); + Netlib_FreeHttpRequest(pnlhr); } else { debugLogA("!!!!! No response from server (time-out)"); resp.code = HTTP_CODE_FAKE_DISCONNECTED; diff --git a/protocols/Omegle/src/client.h b/protocols/Omegle/src/client.h index d992333330..1f95e0c335 100644 --- a/protocols/Omegle/src/client.h +++ b/protocols/Omegle/src/client.h @@ -117,9 +117,9 @@ public: // Netlib handle
- HANDLE handle_;
+ HNETLIBUSER handle_;
- void set_handle(HANDLE h)
+ void set_handle(HNETLIBUSER h)
{
handle_ = h;
}
diff --git a/protocols/Omegle/src/communication.cpp b/protocols/Omegle/src/communication.cpp index 81d43c3242..827560e378 100644 --- a/protocols/Omegle/src/communication.cpp +++ b/protocols/Omegle/src/communication.cpp @@ -79,7 +79,7 @@ http::response Omegle_client::flap(const int request_type, std::string *post_dat parent->debugLogA("@@@@@ Sending request to '%s'", nlhr.szUrl); // Send the request - NETLIBHTTPREQUEST *pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)handle_, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *pnlhr = Netlib_HttpTransaction(handle_, &nlhr); mir_free(nlhr.headers); @@ -109,7 +109,7 @@ http::response Omegle_client::flap(const int request_type, std::string *post_dat parent->debugLogA("&&&&& Got response: %s", resp.data.c_str()); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pnlhr); + Netlib_FreeHttpRequest(pnlhr); } else { parent->debugLogA("!!!!! No response from server (time-out)"); diff --git a/protocols/SkypeWeb/src/http_request.h b/protocols/SkypeWeb/src/http_request.h index b7c8ef73be..bfc872ba68 100644 --- a/protocols/SkypeWeb/src/http_request.h +++ b/protocols/SkypeWeb/src/http_request.h @@ -276,7 +276,7 @@ public: Netlib_Logf(nlu, "Send request to %s", szUrl);
- return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)nlu, (LPARAM)(NETLIBHTTPREQUEST*)this);
+ return Netlib_HttpTransaction(nlu, this);
}
};
diff --git a/protocols/SkypeWeb/src/request_queue.cpp b/protocols/SkypeWeb/src/request_queue.cpp index 57c7cf40a4..db030aa10f 100644 --- a/protocols/SkypeWeb/src/request_queue.cpp +++ b/protocols/SkypeWeb/src/request_queue.cpp @@ -73,7 +73,7 @@ void RequestQueue::Execute(RequestQueueItem *item) NETLIBHTTPREQUEST *response = item->request->Send(nlu);
if (item->responseCallback != NULL)
item->responseCallback(response, item->arg);
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response);
+ Netlib_FreeHttpRequest(response);
requests.remove(item);
delete item;
}
diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h index 60d3c1b403..8016f2cf1d 100644 --- a/protocols/Steam/src/http_request.h +++ b/protocols/Steam/src/http_request.h @@ -146,9 +146,9 @@ public: Netlib_Logf(nlu, "Send request to %s", szUrl); - NETLIBHTTPREQUEST* response = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)nlu, (LPARAM)this); + NETLIBHTTPREQUEST* response = Netlib_HttpTransaction(nlu, this); HttpResponse* result = new HttpResponse(response, this); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)response); + Netlib_FreeHttpRequest(response); return result; } diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 1affd2da6e..34f6828abf 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -198,7 +198,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM, LPARAM) req.pData = form;
req.dataLength = (int)mir_strlen(form);
req.szUrl = "http://poczta.o2.pl/login.html";
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ resp = Netlib_HttpTransaction(m_hNetlibUser, &req);
if (resp != NULL) {
if (resp->resultCode / 100 == 2 || resp->resultCode == 302) {
int i;
@@ -217,7 +217,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM, LPARAM) }
}
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
}
}
mir_free(login);
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index f82d450634..bd9c031b3a 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -267,7 +267,7 @@ static void TlenGetAvatarThread(void *ptr) req.headers = NULL; req.dataLength = 0; req.szUrl = request; - NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->m_hNetlibUser, (LPARAM)&req); + NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(data->proto->m_hNetlibUser, &req); if (item != NULL) item->newAvatarDownloading = FALSE; @@ -297,7 +297,7 @@ static void TlenGetAvatarThread(void *ptr) } else RemoveAvatar(data->proto, hContact); } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp); + Netlib_FreeHttpRequest(resp); } mir_free(request); mir_free(login); @@ -334,13 +334,13 @@ struct TLENREMOVEAVATARTHREADDATA static void TlenRemoveAvatarRequestThread(void *ptr) { TLENREMOVEAVATARTHREADDATA *data = (TLENREMOVEAVATARTHREADDATA*)ptr; NETLIBHTTPREQUEST *req = (NETLIBHTTPREQUEST *)data->req; - NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->m_hNetlibUser, (LPARAM)req); + NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(data->proto->m_hNetlibUser, req); mir_free(req->szUrl); mir_free(req->headers); mir_free(req->pData); mir_free(req); if (resp != NULL) { - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp); + Netlib_FreeHttpRequest(resp); RemoveAvatar(data->proto, NULL); } mir_free(data); @@ -379,9 +379,9 @@ static void TlenUploadAvatarRequestThread(void *ptr) { TLENUPLOADAVATARTHREADDATA *data = (TLENUPLOADAVATARTHREADDATA *) ptr; NETLIBHTTPREQUEST *req = data->req; - NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->m_hNetlibUser, (LPARAM)req); + NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(data->proto->m_hNetlibUser, req); if (checkUploadAvatarResponse(data->proto, resp)) { - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp); + Netlib_FreeHttpRequest(resp); SetAvatar(data->proto, NULL, NULL, data->data, data->length, PA_FORMAT_PNG); } mir_free(req->szUrl); diff --git a/protocols/Tox/src/http_request.h b/protocols/Tox/src/http_request.h index 1ffa523775..18b8228f63 100644 --- a/protocols/Tox/src/http_request.h +++ b/protocols/Tox/src/http_request.h @@ -98,11 +98,11 @@ public: memcpy(pData, data, size);
}
- NETLIBHTTPREQUEST* Send(HANDLE hNetlibConnection)
+ NETLIBHTTPREQUEST* Send(HNETLIBUSER hNetlibConnection)
{
m_szUrl.Replace('\\', '/');
szUrl = m_szUrl.GetBuffer();
- return (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibConnection, (LPARAM)this);
+ return Netlib_HttpTransaction(hNetlibConnection, this);
}
};
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 952515d60d..d2afffc717 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -57,7 +57,7 @@ ToxHexAddress ResolveToxAddressFromDns(const char *dnsQuery) return address;
}
-ToxHexAddress ResolveToxAddressFromToxme(HANDLE hNetlib, const char *query)
+ToxHexAddress ResolveToxAddressFromToxme(HNETLIBUSER hNetlib, const char *query)
{
ToxHexAddress address = ToxHexAddress::Empty();
@@ -87,7 +87,7 @@ void CToxProto::SearchByNameAsync(void *arg) char *query = (char*)arg;
char *name = strtok(query, "@");
- char *domain = strtok(NULL, "");
+ // char *domain = strtok(NULL, "");
/*int resolved = 0;
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index a62c462045..d344bc1a9e 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -113,7 +113,7 @@ private: mir_cs avatar_lock_;
mir_cs twitter_lock_;
- HANDLE hAvatarNetlib_;
+ HNETLIBUSER hAvatarNetlib_;
HANDLE hMsgLoop_;
mir_twitter twit_;
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index f22e71de5b..6ac208279d 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -111,8 +111,7 @@ http::response mir_twitter::slurp(const std::string &url, http::method meth, OAu req.nlc = httpPOST_;
http::response resp_data;
ppro_->debugLogA("**SLURP - just before calling HTTPTRANSACTION");
- NETLIBHTTPREQUEST *resp = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
- reinterpret_cast<WPARAM>(handle_), reinterpret_cast<LPARAM>(&req)));
+ NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(handle_, &req);
ppro_->debugLogA("**SLURP - HTTPTRANSACTION complete.");
if (resp) {
ppro_->debugLogA("**SLURP - the server has responded!");
@@ -120,7 +119,7 @@ http::response mir_twitter::slurp(const std::string &url, http::method meth, OAu resp_data.code = resp->resultCode;
resp_data.data = resp->pData ? resp->pData : "";
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
}
else {
httpPOST_ = NULL;
@@ -130,16 +129,14 @@ http::response mir_twitter::slurp(const std::string &url, http::method meth, OAu return resp_data;
}
-bool save_url(HANDLE hNetlib, const std::string &url, const std::wstring &filename)
+bool save_url(HNETLIBUSER hNetlib, const std::string &url, const std::wstring &filename)
{
NETLIBHTTPREQUEST req = { sizeof(req) };
req.requestType = REQUEST_GET;
req.flags = NLHRF_HTTP11 | NLHRF_REDIRECT;
req.szUrl = const_cast<char*>(url.c_str());
- NETLIBHTTPREQUEST *resp = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
- reinterpret_cast<WPARAM>(hNetlib), reinterpret_cast<LPARAM>(&req)));
-
+ NETLIBHTTPREQUEST *resp = Netlib_HttpTransaction(hNetlib, &req);
if (resp) {
bool success = (resp->resultCode == 200);
if (success) {
@@ -154,7 +151,7 @@ bool save_url(HANDLE hNetlib, const std::string &url, const std::wstring &filena fclose(f);
}
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
+ Netlib_FreeHttpRequest(resp);
return success;
}
diff --git a/protocols/Twitter/src/utility.h b/protocols/Twitter/src/utility.h index ab778900f4..e7e14e084c 100644 --- a/protocols/Twitter/src/utility.h +++ b/protocols/Twitter/src/utility.h @@ -31,7 +31,7 @@ class mir_twitter : public twitter {
public:
mir_twitter() : twitter(), handle_(NULL), httpPOST_(NULL) {}
- void set_handle(PROTO_INTERFACE *ppro, HANDLE h)
+ void set_handle(PROTO_INTERFACE *ppro, HNETLIBUSER h)
{
ppro_ = ppro;
handle_ = h;
@@ -86,7 +86,7 @@ protected: http::response slurp(const std::string &,http::method, OAuthParameters );
HANDLE httpPOST_;
- HANDLE handle_;
+ HNETLIBUSER handle_;
PROTO_INTERFACE *ppro_;
};
@@ -95,4 +95,4 @@ inline void mbcs_to_tcs(UINT code_page, const char *mbstr, wchar_t *tstr, int tl MultiByteToWideChar(code_page, 0, mbstr, -1, tstr, tlen);
}
-bool save_url(HANDLE hNetlib,const std::string &url,const std::wstring &filename);
+bool save_url(HNETLIBUSER hNetlib,const std::string &url,const std::wstring &filename);
diff --git a/protocols/VKontakte/src/vk_captcha.cpp b/protocols/VKontakte/src/vk_captcha.cpp index 807e367453..98fa443e86 100644 --- a/protocols/VKontakte/src/vk_captcha.cpp +++ b/protocols/VKontakte/src/vk_captcha.cpp @@ -38,7 +38,7 @@ bool CVkProto::RunCaptchaForm(LPCSTR szUrl, CMStringA &result) req.szUrl = (LPSTR)szUrl;
req.flags = VK_NODUMPHEADERS;
- NETLIBHTTPREQUEST *reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
+ NETLIBHTTPREQUEST *reply = Netlib_HttpTransaction(m_hNetlibUser, &req);
if (reply == NULL)
return false;
diff --git a/protocols/VKontakte/src/vk_pollserver.cpp b/protocols/VKontakte/src/vk_pollserver.cpp index 9e108cdc66..e2931e62b4 100644 --- a/protocols/VKontakte/src/vk_pollserver.cpp +++ b/protocols/VKontakte/src/vk_pollserver.cpp @@ -201,7 +201,7 @@ int CVkProto::PollServer() req.timeout = 30000;
req.nlc = m_pollingConn;
- while ((reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req)) == NULL) {
+ while ((reply = Netlib_HttpTransaction(m_hNetlibUser, &req)) == NULL) {
debugLogA("CVkProto::PollServer is dead");
m_pollingConn = NULL;
if (iPollConnRetry && !m_bTerminated) {
@@ -239,14 +239,14 @@ int CVkProto::PollServer() || (reply->resultCode >= 500 && reply->resultCode <= 509)) {
debugLogA("CVkProto::PollServer is dead. Error code - %d", reply->resultCode);
m_pollingConn = NULL;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply);
+ Netlib_FreeHttpRequest(reply);
ShutdownSession();
return 0;
}
m_pollingConn = reply->nlc;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply);
+ Netlib_FreeHttpRequest(reply);
debugLogA("CVkProto::PollServer return %d", retVal);
return retVal;
}
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index 6bd1a3d583..870575837b 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -55,7 +55,7 @@ void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq) }
debugLogA("CVkProto::ExecuteRequest \n====\n%s\n====\n", pReq->szUrl);
- NETLIBHTTPREQUEST *reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)pReq);
+ NETLIBHTTPREQUEST *reply = Netlib_HttpTransaction(m_hNetlibUser, pReq);
if (reply != NULL) {
if (pReq->m_pFunc != NULL)
(this->*(pReq->m_pFunc))(reply, pReq); // may be set pReq->bNeedsRestart
@@ -63,7 +63,7 @@ void CVkProto::ExecuteRequest(AsyncHttpRequest *pReq) if (pReq->m_bApiReq)
m_hAPIConnection = reply->nlc;
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply);
+ Netlib_FreeHttpRequest(reply);
}
else if (pReq->bIsMainConn) {
if (IsStatusConnecting(m_iStatus))
diff --git a/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp b/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp index b2fa8ff091..34a99a9de4 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/MediaUploader.cpp @@ -55,7 +55,7 @@ namespace MediaUploader nlhr.pData = (char*)allVector.data();
nlhr.dataLength = (int)allVector.size();
- NETLIBHTTPREQUEST *pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *pnlhr = Netlib_HttpTransaction(g_hNetlibUser, &nlhr);
string data = pnlhr->pData;
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index 69b91de842..23246c783f 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -261,7 +261,7 @@ bool WhatsAppProto::Register(int state, const string &cc, const string &number, nlhr.headersCount = _countof(s_registerHeaders);
nlhr.flags = NLHRF_HTTP11 | NLHRF_SSL;
- NETLIBHTTPREQUEST* pnlhr = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST* pnlhr = Netlib_HttpTransaction(g_hNetlibUser, &nlhr);
const wchar_t *ptszTitle = TranslateT("Registration");
if (pnlhr == NULL) {
|