From acbe9c08e949be95b5549d716232ff7a58785528 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 22 Oct 2024 20:16:42 +0300 Subject: fixes #4751 (Mute:Always blocks popups, sounds & blinking) --- plugins/TabSRMM/src/chat_tools.cpp | 22 ++++++++++++---------- src/mir_app/src/chat_tools.cpp | 16 +++++++++------- src/mir_app/src/srmm_log_rtf.cpp | 2 +- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/plugins/TabSRMM/src/chat_tools.cpp b/plugins/TabSRMM/src/chat_tools.cpp index 166468ab11..f9686fa2da 100644 --- a/plugins/TabSRMM/src/chat_tools.cpp +++ b/plugins/TabSRMM/src/chat_tools.cpp @@ -265,18 +265,20 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (dat->m_pWnd) dat->m_pWnd->Invalidate(); } - - if (iMuteMode != CHATMODE_MUTE) { - auto sound = si->getSoundName(gce->iType); - if (dat) { - bInactive = dat->m_pContainer->m_hwnd != GetForegroundWindow(); - bActiveTab = (dat->m_pContainer->m_hwndActive == dat->GetHwnd()); - if (sound && dat->m_pContainer->MustPlaySound(dat)) - Skin_PlaySound(sound); - } - else if (sound) + + // if group chat is always muted, we don't play sounds & flash window + if (iMuteMode == CHATMODE_MUTE) + return; + + auto sound = si->getSoundName(gce->iType); + if (dat) { + bInactive = dat->m_pContainer->m_hwnd != GetForegroundWindow(); + bActiveTab = (dat->m_pContainer->m_hwndActive == dat->GetHwnd()); + if (sound && dat->m_pContainer->MustPlaySound(dat)) Skin_PlaySound(sound); } + else if (sound) + Skin_PlaySound(sound); // dialog event processing if (dat) { diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 2c4ba34ddc..6c1f17c8c8 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -320,7 +320,6 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight return FALSE; BOOL bInactive = si->pDlg == nullptr || !si->pDlg->IsActive(); - int iMuteMode = Chat_IsMuted(si->hContact); if (bHighlight) { gce->iType |= GC_EVENT_HIGHLIGHT; @@ -328,6 +327,10 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight Contact::Hide(si->hContact, false); } + // if group chat is always muted, we don't play sounds & flash window + if (Chat_IsMuted(si->hContact) == CHATMODE_MUTE) + return true; + // do blinking icons in tray if (bInactive || !g_Settings->bTrayIconInactiveOnly) g_chatApi.DoTrayIcon(si, gce); @@ -335,9 +338,8 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight // stupid thing to not create multiple popups for a QUIT event for instance if (bManyFix == 0) { // do popups - if (iMuteMode != CHATMODE_MUTE) - if (bInactive || !g_Settings->bPopupInactiveOnly) - g_chatApi.DoPopup(si, gce); + if (bInactive || !g_Settings->bPopupInactiveOnly) + g_chatApi.DoPopup(si, gce); // do tray icon flashing if (gce->iType & GC_EVENT_MESSAGE) { @@ -349,8 +351,8 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight g_chatApi.OnFlashWindow(si, bInactive); } - // no sounds in the Mute mode - if ((bInactive || !g_Settings->bSoundsFocus) && iMuteMode != CHATMODE_MUTE) + // sounds + if ((bInactive || !g_Settings->bSoundsFocus)) if (auto szSound = si->getSoundName(gce->iType)) Skin_PlaySound(szSound); } @@ -358,7 +360,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight if (bHighlight) if (g_chatApi.OnFlashHighlight) g_chatApi.OnFlashHighlight(si, bInactive); - return TRUE; + return true; } static wchar_t szTrimString[] = L":,.!?;\'>)"; diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp index a639264ab7..fe1282d773 100644 --- a/src/mir_app/src/srmm_log_rtf.cpp +++ b/src/mir_app/src/srmm_log_rtf.cpp @@ -532,7 +532,7 @@ INT_PTR CRtfLogWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam) pszWord[iLen--] = '\0'; } - if (iLen) { + if (iLen > 0) { CMStringW wszText(FORMAT, TranslateT("Look up '%s"), pszWord); if (wszText.GetLength() > 30) { wszText.Truncate(30); -- cgit v1.2.3