From 3cb3883908e3168e5f955be3143771721614307a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 12 Jan 2017 21:27:03 +0300 Subject: Netlib_FreeHttpRequest() instead of MS_NETLIB_FREEHTTPREQUESTSTRUCT --- plugins/CrashDumper/src/upload.cpp | 6 ++--- plugins/Dropbox/src/http_request.h | 4 ++-- plugins/HTTPServer/src/GuiElements.cpp | 4 ++-- plugins/NewsAggregator/Src/Utils.cpp | 8 +++---- plugins/Non-IM Contact/src/http.cpp | 4 ++-- plugins/PackUpdater/Src/Utils.cpp | 7 +++--- plugins/PasteIt/src/PasteToWeb.cpp | 4 ++-- plugins/PluginUpdater/src/Utils.cpp | 10 ++++----- plugins/Quotes/src/HTTPSession.cpp | 11 +++++---- .../src/CSendHost_ImageShack.cpp | 6 ++--- plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp | 6 ++--- .../SendScreenshotPlus/src/CSendHost_uploadpie.cpp | 6 ++--- plugins/SmileyAdd/src/download.cpp | 4 ++-- plugins/Utils.pas/mirutils.pas | 26 +++++----------------- plugins/Watrack/myshows/i_cookies.inc | 4 ++-- plugins/Weather/src/weather_http.cpp | 4 ++-- plugins/WebView/src/webview_getdata.cpp | 4 ++-- 17 files changed, 52 insertions(+), 66 deletions(-) (limited to 'plugins') diff --git a/plugins/CrashDumper/src/upload.cpp b/plugins/CrashDumper/src/upload.cpp index dc95363449..26359b0b74 100644 --- a/plugins/CrashDumper/src/upload.cpp +++ b/plugins/CrashDumper/src/upload.cpp @@ -18,7 +18,7 @@ along with this program. If not, see . #include "stdafx.h" -HANDLE hNetlibUser; +HNETLIBUSER hNetlibUser; static void arrayToHex(BYTE* data, size_t datasz, char* res) { @@ -122,7 +122,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) while (result == 0xBADBAD) { // download the page - NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (nlhrReply) { int i; @@ -189,7 +189,7 @@ bool InternetDownloadFile(const char *szUrl, VerTrnsfr* szReq) ShowMessage(0, TranslateT("Cannot upload Version Info. Host unreachable.")); } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); } mir_free(szRedirUrl); diff --git a/plugins/Dropbox/src/http_request.h b/plugins/Dropbox/src/http_request.h index 3c11f99b17..9d11ee4742 100644 --- a/plugins/Dropbox/src/http_request.h +++ b/plugins/Dropbox/src/http_request.h @@ -155,11 +155,11 @@ public: mir_free(pData); } - 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/plugins/HTTPServer/src/GuiElements.cpp b/plugins/HTTPServer/src/GuiElements.cpp index f9d8c2c126..3335b489a2 100644 --- a/plugins/HTTPServer/src/GuiElements.cpp +++ b/plugins/HTTPServer/src/GuiElements.cpp @@ -158,7 +158,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) IN_ADDR externIP; externIP.s_addr = 0; - NETLIBHTTPREQUEST *nlreply = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)& nlhr); + NETLIBHTTPREQUEST *nlreply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (nlreply) { if (nlreply->resultCode >= 200 && nlreply->resultCode < 300) { nlreply->pData[nlreply->dataLength] = 0;// make sure its null terminated @@ -178,7 +178,7 @@ unsigned long GetExternIP(const char *szURL, const char *szPattern) if ((externIP.s_addr = inet_addr(pszIp)) == INADDR_NONE) externIP.s_addr = 0; } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlreply); + Netlib_FreeHttpRequest(nlreply); } ::SetCursor(hPrevCursor); return ntohl(externIP.s_addr); diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index 0f16b5664e..d2d02635dc 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -81,7 +81,7 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg } // download the page - NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (nlhrReply) { // if the recieved code is 200 OK if (nlhrReply->resultCode == 200 && nlhrReply->dataLength > 0) { @@ -101,7 +101,7 @@ void GetNewsData(wchar_t *tszUrl, char **szData, MCONTACT hContact, HWND hwndDlg } else Netlib_LogfW(hNetlibUser, L"Code %d: Failed getting feed data %s.", nlhrReply->resultCode, tszUrl); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); } else Netlib_LogfW(hNetlibUser, L"Failed getting feed data %s, no response.", tszUrl); @@ -305,7 +305,7 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) nlhr.headers[3].szValue = "no-cache"; bool ret = false; - NETLIBHTTPREQUEST *pReply = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *pReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (pReply) { if ((200 == pReply->resultCode) && (pReply->dataLength > 0)) { char *date = NULL, *size = NULL; @@ -359,7 +359,7 @@ bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) CloseHandle(hFile); } } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pReply); + Netlib_FreeHttpRequest(pReply); } mir_free(szUrl); diff --git a/plugins/Non-IM Contact/src/http.cpp b/plugins/Non-IM Contact/src/http.cpp index e63521df09..38eb3c510d 100644 --- a/plugins/Non-IM Contact/src/http.cpp +++ b/plugins/Non-IM Contact/src/http.cpp @@ -48,7 +48,7 @@ int InternetDownloadFile(char *szUrl) nlhr.headers[nlhr.headersCount - 1].szValue = NETLIB_USER_AGENT; // download the page - NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (nlhrReply) { // return error code if the recieved code is neither 200 OK or 302 Moved if (nlhrReply->resultCode != 200 && nlhrReply->resultCode != 302) @@ -81,7 +81,7 @@ int InternetDownloadFile(char *szUrl) // make a copy of the retrieved data, then free the memory of the http reply szInfo = szData; - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); // the recieved data is empty, data was not recieved, so return an error code of 1 if (!mir_strcmp(szInfo, "")) return 1; diff --git a/plugins/PackUpdater/Src/Utils.cpp b/plugins/PackUpdater/Src/Utils.cpp index 84827faa0b..9396d59be2 100644 --- a/plugins/PackUpdater/Src/Utils.cpp +++ b/plugins/PackUpdater/Src/Utils.cpp @@ -28,7 +28,8 @@ INT Period; wchar_t tszDialogMsg[2048] = { 0 }; FILEINFO* pFileInfo = NULL; FILEURL* pFileUrl = NULL; -HANDLE hCheckThread = NULL, hNetlibUser = NULL; +HANDLE hCheckThread = NULL; +HNETLIBUSER hNetlibUser = NULL; MYOPTIONS MyOptions = { 0 }; aPopups PopupsList[POPUPS]; LPCTSTR Title = { 0 }, Text = { 0 }; @@ -125,7 +126,7 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) nlhr.headers[3].szValue = "no-cache"; bool ret = false; - NETLIBHTTPREQUEST *pReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *pReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (pReply) { if (200 == pReply->resultCode && pReply->dataLength > 0) { @@ -136,7 +137,7 @@ BOOL DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal) if (hFile) CloseHandle(hFile); } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pReply); + Netlib_FreeHttpRequest(pReply); } mir_free(szUrl); diff --git a/plugins/PasteIt/src/PasteToWeb.cpp b/plugins/PasteIt/src/PasteToWeb.cpp index ec6cdd9878..1307a2fabd 100644 --- a/plugins/PasteIt/src/PasteToWeb.cpp +++ b/plugins/PasteIt/src/PasteToWeb.cpp @@ -542,7 +542,7 @@ wchar_t* PasteToWeb::SendToWeb(char* url, std::map& he } nlhr.headersCount = nHeaders; - NETLIBHTTPREQUEST* nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST* nlhrReply = Netlib_HttpTransaction(g_hNetlibUser, &nlhr); if (nlhrReply != NULL) { if (nlhrReply->resultCode == 200) @@ -557,7 +557,7 @@ wchar_t* PasteToWeb::SendToWeb(char* url, std::map& he } } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); } delete[] httpHeaders; for (std::list::iterator it = mallBuf.begin(); it != mallBuf.end(); ++it) diff --git a/plugins/PluginUpdater/src/Utils.cpp b/plugins/PluginUpdater/src/Utils.cpp index 7e2555d86e..186cf9dc34 100644 --- a/plugins/PluginUpdater/src/Utils.cpp +++ b/plugins/PluginUpdater/src/Utils.cpp @@ -259,7 +259,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) bool ret = false; for (int i = 0; !ret && i < MAX_RETRIES; i++) { Netlib_LogfW(hNetlibUser,L"Downloading file %s to %s (attempt %d)",pFileURL->tszDownloadURL,pFileURL->tszDiskPath, i+1); - NETLIBHTTPREQUEST *pReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *pReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (pReply) { nlc = pReply->nlc; if ((200 == pReply->resultCode) && (pReply->dataLength > 0)) { @@ -270,7 +270,7 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) if (crc != pFileURL->CRCsum) { // crc check failed, try again Netlib_LogfW(hNetlibUser,L"crc check failed for file %s",pFileURL->tszDiskPath); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pReply); + Netlib_FreeHttpRequest(pReply); continue; } } @@ -296,9 +296,9 @@ bool DownloadFile(FILEURL *pFileURL, HANDLE &nlc) } ret = true; } - else - Netlib_LogfW(hNetlibUser,L"Downloading file %s failed with error %d",pFileURL->tszDownloadURL,pReply->resultCode); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pReply); + else Netlib_LogfW(hNetlibUser,L"Downloading file %s failed with error %d",pFileURL->tszDownloadURL,pReply->resultCode); + + Netlib_FreeHttpRequest(pReply); } else { Netlib_LogfW(hNetlibUser,L"Downloading file %s failed, host is propably temporary down.",pFileURL->tszDownloadURL); diff --git a/plugins/Quotes/src/HTTPSession.cpp b/plugins/Quotes/src/HTTPSession.cpp index ae0679b758..345b3d0cec 100644 --- a/plugins/Quotes/src/HTTPSession.cpp +++ b/plugins/Quotes/src/HTTPSession.cpp @@ -36,7 +36,7 @@ public: nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_NOHTTPSOPTION | NUF_UNICODE; nlu.szSettingsModule = QUOTES_PROTOCOL_NAME; nlu.ptszDescriptiveName = TranslateT("Quotes HTTP connections"); - g_hNetLib = reinterpret_cast(Netlib_RegisterUser(&nlu)); + g_hNetLib = Netlib_RegisterUser(&nlu); return (NULL != g_hNetLib); } @@ -83,8 +83,7 @@ public: NETLIBHTTPREQUEST* pReply = NULL; { mir_cslock lck(m_mx); - pReply = reinterpret_cast(CallService(MS_NETLIB_HTTPTRANSACTION, - reinterpret_cast(g_hNetLib), reinterpret_cast(&nlhr))); + pReply = Netlib_HttpTransaction(g_hNetLib, &nlhr); } if (pReply) { @@ -109,7 +108,7 @@ public: bResult = true; } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, reinterpret_cast(pReply)); + Netlib_FreeHttpRequest(pReply); } mir_free(nlhr.headers); @@ -118,13 +117,13 @@ public: } private: - static HANDLE g_hNetLib; + static HNETLIBUSER g_hNetLib; typedef std::vector TBuffer; mutable TBuffer m_aURL; mutable mir_cs m_mx; }; -HANDLE CImplMI::g_hNetLib = NULL; +HNETLIBUSER CImplMI::g_hNetLib = NULL; CHTTPSession::CHTTPSession() : m_pImpl(new CImplMI) diff --git a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp index bc52a13db7..143606a096 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_ImageShack.cpp @@ -74,7 +74,7 @@ int CSendHost_ImageShack::Send() void CSendHost_ImageShack::SendThread() { /// send DATA and wait for m_nlreply - NETLIBHTTPREQUEST* reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&m_nlhr); + NETLIBHTTPREQUEST* reply = Netlib_HttpTransaction(g_hNetlibUser, &m_nlhr); HTTPFormDestroy(&m_nlhr); if (reply) { if (reply->resultCode >= 200 && reply->resultCode < 300 && reply->dataLength) { @@ -95,7 +95,7 @@ void CSendHost_ImageShack::SendThread() } else mir_freeAndNil(m_URLthumb); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply); + Netlib_FreeHttpRequest(reply); svcSendMsgExit(url); return; } else {/// check error mess from server @@ -112,7 +112,7 @@ void CSendHost_ImageShack::SendThread() } else Error(SS_ERR_RESPONSE, m_pszSendTyp, reply->resultCode); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply); + Netlib_FreeHttpRequest(reply); } else Error(SS_ERR_NORESPONSE, m_pszSendTyp, m_nlhr.resultCode); diff --git a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp index e87cc78e3f..b9738687e3 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_imgur.cpp @@ -60,7 +60,7 @@ void CSendHost_Imgur::SendThread(void* obj) { CSendHost_Imgur* self = (CSendHost_Imgur*)obj; /// send DATA and wait for m_nlreply - NETLIBHTTPREQUEST* reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&self->m_nlhr); + NETLIBHTTPREQUEST* reply = Netlib_HttpTransaction(g_hNetlibUser, &self->m_nlhr); self->HTTPFormDestroy(&self->m_nlhr); if (reply) { if (reply->dataLength) { @@ -79,14 +79,14 @@ void CSendHost_Imgur::SendThread(void* obj) self->m_URLthumb[thumblen] = 'm'; // 320x320, see http://api.imgur.com/models/image mir_strcpy(self->m_URLthumb + thumblen + 1, self->m_URL + thumblen); } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply); + Netlib_FreeHttpRequest(reply); self->svcSendMsgExit(self->m_URL); return; } else self->Error(SS_ERR_RESPONSE, self->m_pszSendTyp, GetJSONInteger(reply->pData, reply->dataLength, "status", 0)); } else self->Error(SS_ERR_RESPONSE, self->m_pszSendTyp, reply->resultCode); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply); + Netlib_FreeHttpRequest(reply); } else self->Error(SS_ERR_NORESPONSE, self->m_pszSendTyp, self->m_nlhr.resultCode); diff --git a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp index d354b0aaa1..eeaf4a9b89 100644 --- a/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp +++ b/plugins/SendScreenshotPlus/src/CSendHost_uploadpie.cpp @@ -66,7 +66,7 @@ void CSendHost_UploadPie::SendThread(void* obj) { CSendHost_UploadPie* self = (CSendHost_UploadPie*)obj; /// send DATA and wait for m_nlreply - NETLIBHTTPREQUEST* reply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)g_hNetlibUser, (LPARAM)&self->m_nlhr); + NETLIBHTTPREQUEST* reply = Netlib_HttpTransaction(g_hNetlibUser, &self->m_nlhr); self->HTTPFormDestroy(&self->m_nlhr); if (reply) { if (reply->resultCode >= 200 && reply->resultCode < 300 && reply->dataLength) { @@ -88,7 +88,7 @@ void CSendHost_UploadPie::SendThread(void* obj) if (url) { mir_free(self->m_URL), self->m_URL = mir_strdup(url); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply); + Netlib_FreeHttpRequest(reply); self->svcSendMsgExit(url); return; } else {/// check error mess from server @@ -102,7 +102,7 @@ void CSendHost_UploadPie::SendThread(void* obj) } else self->Error(SS_ERR_RESPONSE, self->m_pszSendTyp, reply->resultCode); - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply); + Netlib_FreeHttpRequest(reply); } else self->Error(SS_ERR_NORESPONSE, self->m_pszSendTyp, self->m_nlhr.resultCode); diff --git a/plugins/SmileyAdd/src/download.cpp b/plugins/SmileyAdd/src/download.cpp index dd5e1e05a2..66d938a506 100644 --- a/plugins/SmileyAdd/src/download.cpp +++ b/plugins/SmileyAdd/src/download.cpp @@ -62,7 +62,7 @@ bool InternetDownloadFile(const char *szUrl, char *szDest, HANDLE &hHttpDwnl) while (result == 0xBADBAD) { // download the page - NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (nlhrReply) { hHttpDwnl = nlhrReply->nlc; // if the recieved code is 200 OK @@ -114,7 +114,7 @@ bool InternetDownloadFile(const char *szUrl, char *szDest, HANDLE &hHttpDwnl) result = 1; } - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); } mir_free(szRedirUrl); diff --git a/plugins/Utils.pas/mirutils.pas b/plugins/Utils.pas/mirutils.pas index 5b3e87a33b..46cc56aa94 100644 --- a/plugins/Utils.pas/mirutils.pas +++ b/plugins/Utils.pas/mirutils.pas @@ -441,8 +441,7 @@ begin else hTmpNetLib:=hNetLib; - resp:=pointer(CallService(MS_NETLIB_HTTPTRANSACTION,hTmpNetLib,lparam(@req))); - + resp:=Netlib_HttpTransaction(hTmpNetLib,@req); if resp<>nil then begin if resp^.resultCode=200 then @@ -453,7 +452,7 @@ begin begin result:=PAnsiChar(int_ptr(resp^.resultCode and $0FFF)); end; - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,lparam(resp)); + Netlib_FreeHttpRequest(resp); end; if (hNetLib=0) and (nlu.flags<>0) then @@ -494,8 +493,7 @@ begin hNetLib:=Netlib_RegisterUser(@nlu); end; - resp:=pointer(CallService(MS_NETLIB_HTTPTRANSACTION,hNetLib,lparam(@req))); - + resp:=Netlib_HttpTransaction(hNetLib,@req); if resp<>nil then begin if resp^.resultCode=200 then @@ -513,25 +511,14 @@ begin // get new location for i:=0 to resp^.headersCount-1 do begin - //MessageBox(0,resp^.headers[i].szValue, resp^.headers[i].szName,MB_OK); if StrCmp(resp^.headers^[i].szName,'Location')=0 then begin result:=GetFile(resp^.headers^[i].szValue,save_file,hNetLib,recurse_count+1); break; end end; - end - else - begin -{ - _stprintf(buff, TranslateT("Failed to download \"%s\" - Invalid response, code %d"), plugin_name, resp->resultCode); - - ShowError(buff); - AnsiChar *ts = GetAString(buff); - NLog(ts); -} end; - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,lparam(resp)); + Netlib_FreeHttpRequest(resp); if nlu.flags<>0 then Netlib_CloseHandle(hNetLib); @@ -620,8 +607,7 @@ begin nlu.szSettingsModule:='dummy'; hNetLib:=Netlib_RegisterUser(@nlu); - resp:=pointer(CallService(MS_NETLIB_HTTPTRANSACTION,hNetLib,lparam(@req))); - + resp:=Netlib_HttpTransaction(hNetLib,@req); if resp<>nil then begin if resp^.resultCode=200 then @@ -634,7 +620,7 @@ begin // if result<>0 then // DeleteObject(SendMessage(wnd,STM_SETIMAGE,IMAGE_BITMAP,result)); //!! end; - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,lparam(resp)); + Netlib_FreeHttpRequest(resp); end; Netlib_CloseHandle(hNetLib); end; diff --git a/plugins/Watrack/myshows/i_cookies.inc b/plugins/Watrack/myshows/i_cookies.inc index 62563e7afc..24c90216b9 100644 --- a/plugins/Watrack/myshows/i_cookies.inc +++ b/plugins/Watrack/myshows/i_cookies.inc @@ -66,7 +66,7 @@ begin nlu.szSettingsModule:='dummy'; hTmpNetLib:=Netlib_RegisterUser(@nlu); - resp:=pointer(CallService(MS_NETLIB_HTTPTRANSACTION,hTmpNetLib,lparam(@req))); + resp:=Netlib_HttpTransaction(hTmpNetLib,@req); if resp<>nil then begin if resp^.resultCode=200 then @@ -82,7 +82,7 @@ begin begin result:=pAnsiChar(int_ptr(resp^.resultCode and $0FFF)); end; - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT,0,lparam(resp)); + Netlib_FreeHttpRequest(resp); end; Netlib_CloseHandle(hTmpNetLib); diff --git a/plugins/Weather/src/weather_http.cpp b/plugins/Weather/src/weather_http.cpp index 5fdf2cb22f..cdc9656082 100644 --- a/plugins/Weather/src/weather_http.cpp +++ b/plugins/Weather/src/weather_http.cpp @@ -75,7 +75,7 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s --nlhr.headersCount; // download the page - NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr); + NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (nlhrReply == 0) { // if the data does not downloaded successfully (ie. disconnected), then return 1000 as error code *szData = (wchar_t*)mir_alloc(512); @@ -144,7 +144,7 @@ int InternetDownloadFile(char *szUrl, char *cookie, char *userAgent, wchar_t **s hNetlibHttp = nlhrReply->nlc; // make a copy of the retrieved data, then free the memory of the http reply - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); return result; } diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index 75fca2a20f..3e0c656a0a 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -134,7 +134,7 @@ void GetData(void *param) db_set_ws(hContact, "CList", "StatusMsg", TranslateT("Updating...")); db_set_w(hContact, MODULENAME, "Status", ID_STATUS_DND); // download - NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST *) CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM) hNetlibUser, (LPARAM) & nlhr); + NETLIBHTTPREQUEST *nlhrReply = Netlib_HttpTransaction(hNetlibUser, &nlhr); if (nlhrReply) { if (nlhrReply->resultCode < 200 || nlhrReply->resultCode >= 300) { db_set_w(hContact, MODULENAME, "Status", ID_STATUS_AWAY); @@ -169,7 +169,7 @@ void GetData(void *param) else if (nlhrReply) DownloadSuccess = 1; - CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM) nlhrReply); + Netlib_FreeHttpRequest(nlhrReply); if (DownloadSuccess) SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Download successful; about to process data...")); -- cgit v1.2.3