summaryrefslogtreecommitdiff
path: root/protocols/Discord/src
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/Discord/src
parente63471b9885d040b9e6db3255432f6cea36144e9 (diff)
Netlib: pascal code is completely isolated from C++ core using helpers
Diffstat (limited to 'protocols/Discord/src')
-rw-r--r--protocols/Discord/src/gateway.cpp7
-rw-r--r--protocols/Discord/src/server.cpp13
2 files changed, 2 insertions, 18 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())