diff options
author | George Hazan <ghazan@miranda.im> | 2020-01-13 16:48:55 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-01-13 16:48:55 +0300 |
commit | 87a2660299edd64cbb6f6c92c33683e91a6d187c (patch) | |
tree | a1b0777ec5b8afc0c49fbb66cf6a122b5ac82c6d /protocols/Discord/src/server.cpp | |
parent | 21f52dbfa251d171b4cc9dc315e8736da2e2be08 (diff) |
Netlib_GetHeader() - handful utility to avoid writing cycles
Diffstat (limited to 'protocols/Discord/src/server.cpp')
-rw-r--r-- | protocols/Discord/src/server.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
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(); |