From 79bb3a95b667c34c046f00672467bc4604269d1b Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Sun, 2 Feb 2020 18:06:21 +0300
Subject: fixes #2190 (KeyboardNotify: blinking in group chats doesn't work)

---
 plugins/KeyboardNotify/src/main.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index d5c9e650ca..02621dac3e 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -407,10 +407,13 @@ static int PluginMessageEventHook(WPARAM hContact, LPARAM hEvent)
 // monitors group chat events
 static int OnGcEvent(WPARAM, LPARAM lParam)
 {
-	GCHOOK *gc = (GCHOOK *)lParam;
-	if (gc->iType == GC_USER_MESSAGE && bFlashOnGC)
-		if (contactCheckProtocol(gc->si->pszModule, gc->si->hContact, EVENTTYPE_MESSAGE) && checkNotifyOptions() && checkStatus(gc->si->pszModule))
-			SetEvent(hFlashEvent);
+	auto *gce = (GCEVENT *)lParam;
+	if (gce->iType == GC_EVENT_MESSAGE && bFlashOnGC) {
+		SESSION_INFO *si = g_chatApi.SM_FindSession(gce->pszID.w, gce->pszModule);
+		if (si)
+			if (contactCheckProtocol(si->pszModule, si->hContact, EVENTTYPE_MESSAGE) && checkNotifyOptions() && checkStatus(si->pszModule))
+				SetEvent(hFlashEvent);
+	}
 
 	return 0;
 }
@@ -913,7 +916,7 @@ int CMPlugin::Load()
 	OpenKeyboardDevice();
 
 	HookEvent(ME_MC_ENABLED, OnMetaChanged);
-	HookEvent(ME_GC_EVENT, OnGcEvent);
+	HookEvent(ME_GC_HOOK_EVENT, OnGcEvent);
 	HookEvent(ME_DB_EVENT_ADDED, PluginMessageEventHook);
 	HookEvent(ME_OPT_INITIALISE, InitializeOptions);
 	HookEvent(ME_SYSTEM_MODULESLOADED, ModulesLoaded);
-- 
cgit v1.2.3