From e70028aeff4dad25c97226f6faeeb995ab99e9b1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 28 Feb 2021 11:25:23 +0300 Subject: Discord doesn't like expired cookies --- protocols/Discord/src/gateway.cpp | 7 +++---- protocols/Discord/src/proto.h | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'protocols/Discord/src') diff --git a/protocols/Discord/src/gateway.cpp b/protocols/Discord/src/gateway.cpp index 89ab8fdcbe..56d2b9ccf5 100644 --- a/protocols/Discord/src/gateway.cpp +++ b/protocols/Discord/src/gateway.cpp @@ -49,10 +49,9 @@ bool CDiscordProto::GatewayThreadWorker() { 0, 0 }, }; - CMStringA szCookie(getMStringA("WSCookie")); - if (!szCookie.IsEmpty()) { + if (!m_szWSCookie.IsEmpty()) { hdrs[1].szName = "Cookie"; - hdrs[1].szValue = szCookie.GetBuffer(); + hdrs[1].szValue = m_szWSCookie.GetBuffer(); } NLHR_PTR pReply(WebSocket_Connect(m_hGatewayNetlibUser, m_szGateway + "/?encoding=json&v=8", hdrs)); @@ -65,7 +64,7 @@ bool CDiscordProto::GatewayThreadWorker() char *p = strchr(pszNewCookie, ';'); if (p) *p = 0; - setString("WSCookie", pszNewCookie); + m_szWSCookie = pszNewCookie; } if (pReply->resultCode != 101) diff --git a/protocols/Discord/src/proto.h b/protocols/Discord/src/proto.h index fb7a95be86..9dc5f19e35 100644 --- a/protocols/Discord/src/proto.h +++ b/protocols/Discord/src/proto.h @@ -224,7 +224,8 @@ class CDiscordProto : public PROTO CMStringA m_szGateway, // gateway url m_szGatewaySessionId, // current session id - m_szCookie; // cookie used for all http queries + m_szCookie, // cookie used for all http queries + m_szWSCookie; // cookie used for establishing websocket connection HNETLIBUSER m_hGatewayNetlibUser; // the separate netlib user handle for gateways HNETLIBCONN m_hGatewayConnection; // gateway connection -- cgit v1.2.3