summaryrefslogtreecommitdiff
path: root/protocols/Twitter
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-01-05 15:54:03 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-01-05 15:54:03 +0300
commit14c4e44a0a91e1ad701d4ae3c58185d25118e64e (patch)
tree50f36035466f355c74373e757bc00b6610ce6267 /protocols/Twitter
parent94667140aeb3886d22e4c1301423fe99aaf3fba4 (diff)
Netlib:
- NETLIBHTTPHEADER & NETLIBHTTPREQUEST obsoleted; - NETLIBHTTPREQUEST divided into MHttpRequest & MHttpResponse; - MHttpHeaders now manager headers both for MHttpRequest & MHttpResponse;
Diffstat (limited to 'protocols/Twitter')
-rw-r--r--protocols/Twitter/src/http.cpp4
-rw-r--r--protocols/Twitter/src/oauth.cpp4
-rw-r--r--protocols/Twitter/src/proto.h4
-rw-r--r--protocols/Twitter/src/utility.cpp6
4 files changed, 7 insertions, 11 deletions
diff --git a/protocols/Twitter/src/http.cpp b/protocols/Twitter/src/http.cpp
index 888afdfa84..71aa265954 100644
--- a/protocols/Twitter/src/http.cpp
+++ b/protocols/Twitter/src/http.cpp
@@ -39,9 +39,6 @@ void CTwitterProto::Execute(AsyncHttpRequest *pReq)
}
else pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
pReq->AddHeader("Cache-Control", "no-cache");
-
- pReq->dataLength = (int)pReq->m_szParam.GetLength();
- pReq->pData = pReq->m_szParam.Detach();
}
else {
if (pReq->requestType == REQUEST_PATCH)
@@ -60,7 +57,6 @@ void CTwitterProto::Execute(AsyncHttpRequest *pReq)
// auth = OAuthWebRequestSubmit(pReq->m_szUrl, "POST", (bIsJson) ? "" : pReq->pData);
// pReq->AddHeader("Authorization", auth);
- pReq->szUrl = pReq->m_szUrl.GetBuffer();
pReq->flags = NLHRF_HTTP11 | NLHRF_PERSISTENT | NLHRF_REDIRECT;
pReq->nlc = m_hConnHttp;
diff --git a/protocols/Twitter/src/oauth.cpp b/protocols/Twitter/src/oauth.cpp
index 9ef2c9bf7c..6e919d3b47 100644
--- a/protocols/Twitter/src/oauth.cpp
+++ b/protocols/Twitter/src/oauth.cpp
@@ -163,7 +163,7 @@ CMStringA CTwitterProto::OAuthCreateSignature(const CMStringA &signatureBase, co
/////////////////////////////////////////////////////////////////////////////////////////
-void CTwitterProto::Oauth2RequestToken(NETLIBHTTPREQUEST *pResp, AsyncHttpRequest *)
+void CTwitterProto::Oauth2RequestToken(MHttpResponse *pResp, AsyncHttpRequest *)
{
if (pResp->resultCode != 200) {
OnLoggedFail();
@@ -196,7 +196,7 @@ void CTwitterProto::RequestOauthToken(const char *szPin)
/////////////////////////////////////////////////////////////////////////////////////////
-void CTwitterProto::Oauth2RequestAuth(NETLIBHTTPREQUEST *pResp, AsyncHttpRequest *)
+void CTwitterProto::Oauth2RequestAuth(MHttpResponse *pResp, AsyncHttpRequest *)
{
if (pResp->resultCode != 200) {
OnLoggedFail();
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h
index e3e5650b4d..fd09b49147 100644
--- a/protocols/Twitter/src/proto.h
+++ b/protocols/Twitter/src/proto.h
@@ -119,8 +119,8 @@ class CTwitterProto : public PROTO<CTwitterProto>
void RequestOauthToken(const char *szPin = nullptr);
void ResetOauthKeys();
- void Oauth2RequestAuth(NETLIBHTTPREQUEST *, AsyncHttpRequest *);
- void Oauth2RequestToken(NETLIBHTTPREQUEST *, AsyncHttpRequest *);
+ void Oauth2RequestAuth(MHttpResponse *, AsyncHttpRequest *);
+ void Oauth2RequestToken(MHttpResponse *, AsyncHttpRequest *);
CMStringA OAuthWebRequestSubmit(const CMStringA &url, const char *httpMethod, const char *postData);
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp
index d9031b51ce..737278bf0a 100644
--- a/protocols/Twitter/src/utility.cpp
+++ b/protocols/Twitter/src/utility.cpp
@@ -71,10 +71,10 @@ void CTwitterProto::ShowPopup(const char *text, int Error)
bool save_url(HNETLIBUSER hNetlib, const CMStringA &url, const CMStringW &filename)
{
- NETLIBHTTPREQUEST req = { sizeof(req) };
+ MHttpRequest req;
req.requestType = REQUEST_GET;
req.flags = NLHRF_HTTP11 | NLHRF_REDIRECT;
- req.szUrl = const_cast<char*>(url.c_str());
+ req.m_szUrl = const_cast<char*>(url.c_str());
NLHR_PTR resp(Netlib_HttpTransaction(hNetlib, &req));
if (!resp)
@@ -89,7 +89,7 @@ bool save_url(HNETLIBUSER hNetlib, const CMStringA &url, const CMStringW &filena
// Write to file
if (FILE *f = _wfopen(filename, L"wb")) {
- fwrite(resp->pData, 1, resp->dataLength, f);
+ fwrite(resp->body, 1, resp->body.GetLength(), f);
fclose(f);
}
else return false;