From e8ab5643c369d9c01b3aafe43628d9f1953c5384 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 24 May 2020 17:23:34 +0300 Subject: =?UTF-8?q?fixes=20#2398=20(Steam=20=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4?= =?UTF-8?q?=D0=B8=D1=82=20=D0=B4=D0=B8=D0=B0=D0=BB=D0=BE=D0=B3=20=D0=B2?= =?UTF-8?q?=D0=B2=D0=BE=D0=B4=D0=B0=20=D0=BA=D0=BE=D0=B4=D0=B0=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=BC=D0=BD=D0=BE?= =?UTF-8?q?=D0=B3=D0=BE=20=D1=80=D0=B0=D0=B7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- protocols/Steam/src/steam_dialogs.cpp | 3 ++ protocols/Steam/src/steam_login.cpp | 3 ++ protocols/Steam/src/steam_proto.h | 60 +++++++++++++++++++---------------- 3 files changed, 38 insertions(+), 28 deletions(-) (limited to 'protocols/Steam/src') diff --git a/protocols/Steam/src/steam_dialogs.cpp b/protocols/Steam/src/steam_dialogs.cpp index 04be9594d7..604db1e3e2 100644 --- a/protocols/Steam/src/steam_dialogs.cpp +++ b/protocols/Steam/src/steam_dialogs.cpp @@ -47,6 +47,8 @@ CSteamGuardDialog::CSteamGuardDialog(CSteamProto *proto, const char *domain) : bool CSteamGuardDialog::OnInitDialog() { + m_proto->m_hwndGuard = m_hwnd; + char iconName[100]; mir_snprintf(iconName, "%s_%s", MODULE, "main"); Window_SetIcon_IcoLib(m_hwnd, IcoLib_GetIconHandle(iconName)); @@ -65,6 +67,7 @@ bool CSteamGuardDialog::OnApply() bool CSteamGuardDialog::OnClose() { + m_proto->m_hwndGuard = nullptr; Utils_SaveWindowPosition(m_hwnd, NULL, m_proto->m_szModuleName, "GuardWindow"); return true; } diff --git a/protocols/Steam/src/steam_login.cpp b/protocols/Steam/src/steam_login.cpp index 80dee8a4f3..a0d716aa3f 100644 --- a/protocols/Steam/src/steam_login.cpp +++ b/protocols/Steam/src/steam_login.cpp @@ -217,6 +217,9 @@ void CSteamProto::OnAuthorizationError(const JSONNode &root) if (domain.find("://") == std::string::npos) domain = "http://" + domain; + if (m_hwndGuard != nullptr) + return; + CSteamGuardDialog guardDialog(this, domain.c_str()); if (guardDialog.DoModal() != DIALOG_RESULT_OK) { DeleteAuthSettings(); diff --git a/protocols/Steam/src/steam_proto.h b/protocols/Steam/src/steam_proto.h index 2fe4b12f36..3df953c975 100644 --- a/protocols/Steam/src/steam_proto.h +++ b/protocols/Steam/src/steam_proto.h @@ -51,9 +51,38 @@ struct RequestQueueItem class CSteamProto : public PROTO { - friend CSteamPasswordEditor; - friend CSteamOptionsMain; - friend CSteamOptionsBlockList; + friend class CSteamGuardDialog; + friend class CSteamPasswordEditor; + friend class CSteamOptionsMain; + friend class CSteamOptionsBlockList; + + ptrW m_password; + ptrW m_defaultGroup; + bool isLoginAgain; + time_t m_idleTS; + HWND m_hwndGuard; + + // requests + bool m_isTerminated; + mir_cs m_requestQueueLock; + HANDLE m_hRequestsQueueEvent; + HANDLE m_hRequestQueueThread; + LIST m_requestQueue; + + // pooling + HANDLE m_hPollingThread; + ULONG hAuthProcess; + ULONG hMessageProcess; + mir_cs m_addContactLock; + mir_cs m_setStatusLock; + std::map m_mpOutMessages; + std::map m_typingTimestamps; + + /** + * Used only to compare in steam_history.cpp, others should write such value directly to db profile, because PollingThread + * may start sooner than steam_history requests so it could possibly break getting history messages from server + */ + time_t m_lastMessageTS; public: // PROTO_INTERFACE @@ -87,31 +116,6 @@ public: static void InitMenus(); protected: - ptrW m_password; - ptrW m_defaultGroup; - bool isLoginAgain; - time_t m_idleTS; - // requests - bool m_isTerminated; - mir_cs m_requestQueueLock; - HANDLE m_hRequestsQueueEvent; - HANDLE m_hRequestQueueThread; - LIST m_requestQueue; - // pooling - HANDLE m_hPollingThread; - ULONG hAuthProcess; - ULONG hMessageProcess; - mir_cs m_addContactLock; - mir_cs m_setStatusLock; - std::map m_mpOutMessages; - std::map m_typingTimestamps; - - /** - * Used only to compare in steam_history.cpp, others should write such value directly to db profile, because PollingThread - * may start sooner than steam_history requests so it could possibly break getting history messages from server - */ - time_t m_lastMessageTS; - // requests void SendRequest(HttpRequest *request); void SendRequest(HttpRequest *request, HttpCallback callback, void *param = nullptr); -- cgit v1.2.3