From 4fdc401d4e5f91aa55f4ea4214ea484c25ac6ce3 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 4 Jun 2021 22:40:23 +0300 Subject: fixes #2900 (Discord: implement popup if login/password are incorrect) --- protocols/Discord/src/server.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'protocols') diff --git a/protocols/Discord/src/server.cpp b/protocols/Discord/src/server.cpp index ec2e5e816c..2b4882ed37 100644 --- a/protocols/Discord/src/server.cpp +++ b/protocols/Discord/src/server.cpp @@ -271,6 +271,18 @@ void CDiscordProto::OnReceiveToken(NETLIBHTTPREQUEST *pReply, AsyncHttpRequest*) } } } + + for (auto &err: root["errors"]["email"]["_errors"]) { + CMStringW code(err["code"].as_mstring()); + CMStringW message(err["message"].as_mstring()); + if (!code.IsEmpty() || !message.IsEmpty()) { + POPUPDATAW popup; + popup.lchIcon = IcoLib_GetIconByHandle(Skin_GetIconHandle(SKINICON_ERROR), true); + wcscpy_s(popup.lpwzContactName, m_tszUserName); + mir_snwprintf(popup.lpwzText, TranslateT("Connection failed.\n%s (%s)."), message.c_str(), code.c_str()); + PUAddPopupW(&popup); + } + } } ConnectionFailed(LOGINERR_WRONGPASSWORD); return; -- cgit v1.2.3