Skip to content

Commit

Permalink
to #2574 - fixes sounds for highlights in default mode
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehazan committed Mar 9, 2021
1 parent 0fde8f0 commit 01eb487
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
3 changes: 3 additions & 0 deletions src/mir_app/src/chat_manager.cpp
Expand Up @@ -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";
Expand Down
19 changes: 5 additions & 14 deletions src/mir_app/src/chat_tools.cpp
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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;
}

Expand Down

0 comments on commit 01eb487

Please sign in to comment.