From 01eb4872eaf6872af11e72aa8b3b88f82f677732 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 9 Mar 2021 21:25:27 +0300 Subject: to #2574 - fixes sounds for highlights in default mode --- src/mir_app/src/chat_manager.cpp | 3 +++ src/mir_app/src/chat_tools.cpp | 19 +++++-------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index 56418a4393..d0d06eb3b0 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -159,6 +159,9 @@ const char *GCSessionInfoBase::getSoundName(int iEventType) const if (db_get_b(hContact, "SRMM", "MuteMode", CHATMODE_NORMAL) == CHATMODE_MUTE) return nullptr; + if (iEventType & GC_EVENT_HIGHLIGHT) + return "ChatHighlight"; + switch (iEventType) { case GC_EVENT_JOIN: return "ChatJoin"; case GC_EVENT_PART: return "ChatPart"; diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index ae9fec2d5f..dab4d080ce 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -377,22 +377,10 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight BOOL bInactive = si->pDlg == nullptr || !si->pDlg->IsActive(); - int iEvent = gce->iType; - bool bMute = db_get_b(si->hContact, "SRMM", "MuteMode", CHATMODE_NORMAL) == CHATMODE_MUTE; - if (bHighlight) { gce->iType |= GC_EVENT_HIGHLIGHT; - if (!bMute && (bInactive || !g_Settings->bSoundsFocus)) - Skin_PlaySound("ChatHighlight"); if (Contact_IsHidden(si->hContact)) Contact_Hide(si->hContact, false); - if (bInactive) - g_chatApi.DoTrayIcon(si, gce); - if (bInactive || !g_Settings->bPopupInactiveOnly) - g_chatApi.DoPopup(si, gce); - if (g_chatApi.OnFlashHighlight) - g_chatApi.OnFlashHighlight(si, bInactive); - return TRUE; } // do blinking icons in tray @@ -406,7 +394,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight g_chatApi.DoPopup(si, gce); // do sounds and flashing - if (iEvent == GC_EVENT_MESSAGE) { + if (gce->iType & GC_EVENT_MESSAGE) { if (bInactive && !(si->wState & STATE_TALK)) { si->wState |= STATE_TALK; db_set_w(si->hContact, si->pszModule, "ApparentMode", ID_STATUS_OFFLINE); @@ -416,10 +404,13 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight } if (bInactive || !g_Settings->bSoundsFocus) - if (auto szSound = si->getSoundName(iEvent)) + if (auto szSound = si->getSoundName(gce->iType)) Skin_PlaySound(szSound); } + if (bHighlight) + if (g_chatApi.OnFlashHighlight) + g_chatApi.OnFlashHighlight(si, bInactive); return TRUE; } -- cgit v1.2.3