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/Twitter | |
parent | 6461f17159c83bfaeba1ecbd124ab53551f3e22d (diff) |
Netlib_FreeHttpRequest() instead of MS_NETLIB_FREEHTTPREQUESTSTRUCT
Diffstat (limited to 'protocols/Twitter')
-rw-r--r-- | protocols/Twitter/src/proto.h | 2 | ||||
-rw-r--r-- | protocols/Twitter/src/utility.cpp | 13 | ||||
-rw-r--r-- | protocols/Twitter/src/utility.h | 6 |
3 files changed, 9 insertions, 12 deletions
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);
|