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 --- protocols/Twitter/src/proto.h | 2 +- protocols/Twitter/src/utility.cpp | 13 +++++-------- protocols/Twitter/src/utility.h | 6 +++--- 3 files changed, 9 insertions(+), 12 deletions(-) (limited to 'protocols/Twitter') 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(CallService(MS_NETLIB_HTTPTRANSACTION, - reinterpret_cast(handle_), reinterpret_cast(&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(url.c_str()); - NETLIBHTTPREQUEST *resp = reinterpret_cast(CallService(MS_NETLIB_HTTPTRANSACTION, - reinterpret_cast(hNetlib), reinterpret_cast(&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); -- cgit v1.2.3