From 87a2660299edd64cbb6f6c92c33683e91a6d187c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 Jan 2020 16:48:55 +0300 Subject: Netlib_GetHeader() - handful utility to avoid writing cycles --- protocols/Discord/src/server.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'protocols/Discord/src/server.cpp') diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp index 94f87be530..2ce92b2281 100644 --- a/protocols/Discord/src/server.cpp +++ b/protocols/Discord/src/server.cpp @@ -173,12 +173,10 @@ void CDiscordProto::OnReceiveMyInfo(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest* m_wszEmail = root["email"].as_mstring(); m_ownId = id; - for (int i = 0; i < pReply->headersCount; i++) { - if (!strcmp(pReply->headers[i].szName, "Set-Cookie")) { - char *p = strchr(pReply->headers[i].szValue, ';'); - if (p) *p = 0; - m_szAccessCookie = mir_strdup(pReply->headers[i].szValue); - } + if (auto *pszHdr = Netlib_GetHeader(pReply, "Set-Cookie")) { + char *p = strchr(pszHdr, ';'); + if (p) *p = 0; + m_szAccessCookie = mir_strdup(pszHdr); } OnLoggedIn(); -- cgit v1.2.3