summaryrefslogtreecommitdiff
path: root/plugins/KeyboardNotify/src
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2021-04-28 20:11:05 +0300
committerGeorge Hazan <ghazan@miranda.im>2021-04-28 20:11:05 +0300
commitb4429a2c9b6ac37b263c16c3a7e6d0314031b60f (patch)
tree75563b64caec84090c23c900abc1788eb7ddfbc1 /plugins/KeyboardNotify/src
parent31a64b25521f2c96e88b7238343d9c05832d1eda (diff)
more logs for hangout in KeyboardNotify
Diffstat (limited to 'plugins/KeyboardNotify/src')
-rw-r--r--plugins/KeyboardNotify/src/main.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/plugins/KeyboardNotify/src/main.cpp b/plugins/KeyboardNotify/src/main.cpp
index 02621dac3e..6b7da1d96e 100644
--- a/plugins/KeyboardNotify/src/main.cpp
+++ b/plugins/KeyboardNotify/src/main.cpp
@@ -297,8 +297,10 @@ static void __cdecl FlashThreadFunction(void*)
ToggleKeyboardLights((BYTE)(data | unchangedLeds));
// Wait for exit event
- if (WaitForSingleObject(hExitEvent, nWaitDelay) == WAIT_OBJECT_0)
+ if (WaitForSingleObject(hExitEvent, nWaitDelay) == WAIT_OBJECT_0) {
+ g_plugin.debugLogA("%s: got exit signal1", g_plugin.getModule());
return;
+ }
}
RestoreLEDState();
@@ -309,8 +311,10 @@ static void __cdecl FlashThreadFunction(void*)
HANDLE Objects[2];
Objects[0] = hFlashEvent;
Objects[1] = hExitEvent;
- if (WaitForMultipleObjects(2, Objects, FALSE, INFINITE) == WAIT_OBJECT_0 + 1)
+ if (WaitForMultipleObjects(_countof(Objects), Objects, FALSE, INFINITE) != WAIT_OBJECT_0) {
+ g_plugin.debugLogA("%s: got exit signal2", g_plugin.getModule());
return;
+ }
bEvent = TRUE;
bReminderDisabled = TRUE;
@@ -397,7 +401,6 @@ static int PluginMessageEventHook(WPARAM hContact, LPARAM hEvent)
(einfo.eventType != EVENTTYPE_MESSAGE && einfo.eventType != EVENTTYPE_FILE && bFlashOnOther)) {
if (contactCheckProtocol(einfo.szModule, hContact, einfo.eventType) && checkNotifyOptions() && checkStatus(einfo.szModule) && checkXstatus(einfo.szModule))
-
SetEvent(hFlashEvent);
}
@@ -408,12 +411,10 @@ static int PluginMessageEventHook(WPARAM hContact, LPARAM hEvent)
static int OnGcEvent(WPARAM, LPARAM lParam)
{
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 (gce->iType == GC_EVENT_MESSAGE && bFlashOnGC)
+ if (SESSION_INFO *si = g_chatApi.SM_FindSession(gce->pszID.w, gce->pszModule))
if (contactCheckProtocol(si->pszModule, si->hContact, EVENTTYPE_MESSAGE) && checkNotifyOptions() && checkStatus(si->pszModule))
SetEvent(hFlashEvent);
- }
return 0;
}
@@ -882,6 +883,7 @@ static int OnMetaChanged(WPARAM wParam, LPARAM)
static int OnPreshutdown(WPARAM, LPARAM)
{
+ g_plugin.debugLogA("%s: got ME_SYSTEM_PRESHUTDOWN", g_plugin.getModule());
SetEvent(hExitEvent);
return 0;
}
@@ -934,6 +936,11 @@ int CMPlugin::Unload()
// Wait for thread to exit
WaitForSingleObject(hThread, INFINITE);
+ if (hExitEvent)
+ CloseHandle(hExitEvent);
+ if (hFlashEvent)
+ CloseHandle(hFlashEvent);
+
RestoreLEDState();
CloseKeyboardDevice();