From 94667140aeb3886d22e4c1301423fe99aaf3fba4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 4 Jan 2024 13:38:02 +0300 Subject: Netlib: pascal code is completely isolated from C++ core using helpers --- protocols/Discord/src/gateway.cpp | 7 +------ protocols/Discord/src/server.cpp | 13 +------------ 2 files changed, 2 insertions(+), 18 deletions(-) (limited to 'protocols/Discord/src') 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()) -- cgit v1.2.3