summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-01-04 13:38:02 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-01-04 13:38:02 +0300
commit94667140aeb3886d22e4c1301423fe99aaf3fba4 (patch)
tree88bc46dfa6a3dba117905f7994b5e5f6ae09fa2a /protocols
parente63471b9885d040b9e6db3255432f6cea36144e9 (diff)
Netlib: pascal code is completely isolated from C++ core using helpers
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/gateway.cpp7
-rw-r--r--protocols/Discord/src/server.cpp13
-rw-r--r--protocols/ICQ-WIM/src/mra.cpp13
-rw-r--r--protocols/Tox/src/http_request.h1
4 files changed, 3 insertions, 31 deletions
diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp
index 543020f105..e76de2848a 100644
--- a/protocols/Discord/src/gateway.cpp
+++ b/protocols/Discord/src/gateway.cpp
@@ -61,12 +61,7 @@ bool CDiscordProto::GatewayThreadWorker()
return false;
}
- if (auto *pszNewCookie = Netlib_GetHeader(pReply, "Set-Cookie")) {
- char *p = strchr(pszNewCookie, ';');
- if (p) *p = 0;
-
- m_szWSCookie = pszNewCookie;
- }
+ m_szWSCookie = pReply->GetCookies();
if (pReply->resultCode != 101) {
// if there's no cookie & Miranda is bounced with error 404, simply apply the cookie and try again
diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp
index 243e80d2b2..1ef3517822 100644
--- a/protocols/Discord/src/server.cpp
+++ b/protocols/Discord/src/server.cpp
@@ -165,18 +165,7 @@ void CDiscordProto::OnReceiveMyInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*
m_wszEmail = data["email"].as_mstring();
m_ownId = id;
-
- m_szCookie.Empty();
- for (int i=0; i < pReply->headersCount; i++) {
- if (!mir_strcmpi(pReply->headers[i].szName, "Set-Cookie")) {
- char *p = strchr(pReply->headers[i].szValue, ';');
- if (p) *p = 0;
- if (!m_szCookie.IsEmpty())
- m_szCookie.Append("; ");
-
- m_szCookie.Append(pReply->headers[i].szValue);
- }
- }
+ m_szCookie = pReply->GetCookies();
// launch gateway thread
if (m_szGateway.IsEmpty())
diff --git a/protocols/ICQ-WIM/src/mra.cpp b/protocols/ICQ-WIM/src/mra.cpp
index cfe427a136..b65ae238dc 100644
--- a/protocols/ICQ-WIM/src/mra.cpp
+++ b/protocols/ICQ-WIM/src/mra.cpp
@@ -19,18 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void CIcqProto::SendMrimLogin(NETLIBHTTPREQUEST *pReply)
{
- if (pReply) {
- for (int i=0; i < pReply->headersCount; i++) {
- if (!mir_strcmpi(pReply->headers[i].szName, "Set-Cookie")) {
- char *p = strchr(pReply->headers[i].szValue, ';');
- if (p) *p = 0;
- if (!m_szMraCookie.IsEmpty())
- m_szMraCookie.Append("; ");
-
- m_szMraCookie.Append(pReply->headers[i].szValue);
- }
- }
- }
+ m_szMraCookie = pReply->GetCookies();
auto *pReq = new AsyncHttpRequest(CONN_NONE, REQUEST_POST, "https://icqapilogin.mail.ru/auth/mrimLogin", &CIcqProto::OnCheckMrimLogin);
pReq->AddHeader("User-Agent", NETLIB_USER_AGENT);
diff --git a/protocols/Tox/src/http_request.h b/protocols/Tox/src/http_request.h
index d51aab289f..bba9f0591c 100644
--- a/protocols/Tox/src/http_request.h
+++ b/protocols/Tox/src/http_request.h
@@ -24,7 +24,6 @@ private:
void Init(int type)
{
- cbSize = sizeof(NETLIBHTTPREQUEST);
requestType = type;
flags = NLHRF_HTTP11 | NLHRF_SSL | NLHRF_NODUMPSEND | NLHRF_DUMPASTEXT;
szUrl = nullptr;