From 84fb545f1ee85924b1c51971e0d69dcaa49f6fe0 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 21 Feb 2014 17:47:56 +0000 Subject: ME_GC_HOOK_EVENT - hook for the incoming chat events git-svn-id: http://svn.miranda-ng.org/main/trunk@8202 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/chat/chat_svc.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/modules/chat/chat_svc.cpp b/src/modules/chat/chat_svc.cpp index f69a06b75c..a7573a4647 100644 --- a/src/modules/chat/chat_svc.cpp +++ b/src/modules/chat/chat_svc.cpp @@ -39,7 +39,8 @@ static HANDLE hEventPrebuildMenu = NULL, hEventDoubleclicked = NULL, hEventJoinChat = NULL, - hEventLeaveChat = NULL; + hEventLeaveChat = NULL, + hHookEvent = NULL; ///////////////////////////////////////////////////////////////////////////////////////// // Post-load event hooks @@ -70,7 +71,7 @@ void LoadChatIcons(void) LoadMsgLogBitmaps(); } -static int FontsChanged(WPARAM wParam, LPARAM lParam) +static int FontsChanged(WPARAM, LPARAM) { LoadGlobalSettings(); LoadLogFonts(); @@ -87,7 +88,7 @@ static int FontsChanged(WPARAM wParam, LPARAM lParam) return 0; } -static int IconsChanged(WPARAM wParam, LPARAM lParam) +static int IconsChanged(WPARAM, LPARAM) { FreeMsgLogBitmaps(); LoadMsgLogBitmaps(); @@ -97,7 +98,7 @@ static int IconsChanged(WPARAM wParam, LPARAM lParam) return 0; } -static int PreShutdown(WPARAM wParam, LPARAM lParam) +static int PreShutdown(WPARAM, LPARAM) { ci.SM_BroadcastMessage(NULL, GC_CLOSEWINDOW, 0, 1, FALSE); @@ -109,13 +110,13 @@ static int PreShutdown(WPARAM wParam, LPARAM lParam) return 0; } -static int SmileyOptionsChanged(WPARAM wParam, LPARAM lParam) +static int SmileyOptionsChanged(WPARAM, LPARAM) { ci.SM_BroadcastMessage(NULL, GC_REDRAWLOG, 0, 1, FALSE); return 0; } -static INT_PTR Service_GetCount(WPARAM wParam, LPARAM lParam) +static INT_PTR Service_GetCount(WPARAM, LPARAM lParam) { if (!lParam) return -1; @@ -124,7 +125,7 @@ static INT_PTR Service_GetCount(WPARAM wParam, LPARAM lParam) return ci.SM_GetCount((char *)lParam); } -static INT_PTR Service_GetInfo(WPARAM wParam, LPARAM lParam) +static INT_PTR Service_GetInfo(WPARAM, LPARAM lParam) { GC_INFO *gci = (GC_INFO *)lParam; if (!gci || !gci->pszModule) @@ -150,7 +151,7 @@ static INT_PTR Service_GetInfo(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) +static INT_PTR Service_Register(WPARAM, LPARAM lParam) { GCREGISTER *gcr = (GCREGISTER *)lParam; if (gcr == NULL) @@ -188,7 +189,7 @@ static INT_PTR Service_Register(WPARAM wParam, LPARAM lParam) return 0; } -static INT_PTR Service_NewChat(WPARAM wParam, LPARAM lParam) +static INT_PTR Service_NewChat(WPARAM, LPARAM lParam) { GCSESSION *gcw = (GCSESSION *)lParam; if (gcw == NULL) @@ -392,14 +393,13 @@ static void AddUser(GCEVENT *gce) static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) { GCEVENT *gce = (GCEVENT*)lParam; - GCDEST *gcd = NULL; BOOL bIsHighlighted = FALSE; BOOL bRemoveFlag = FALSE; if (gce == NULL) return GC_EVENT_ERROR; - gcd = gce->pDest; + GCDEST *gcd = gce->pDest; if (gcd == NULL) return GC_EVENT_ERROR; @@ -409,6 +409,8 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) if (!IsEventSupported(gcd->iType)) return GC_EVENT_ERROR; + NotifyEventHooks(hHookEvent,wParam,lParam); + SESSION_INFO *si; mir_cslock lck(cs); @@ -538,7 +540,7 @@ static INT_PTR Service_AddEvent(WPARAM wParam, LPARAM lParam) return GC_EVENT_ERROR; } -static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam) +static INT_PTR Service_GetAddEventPtr(WPARAM, LPARAM lParam) { GCPTRS *gp = (GCPTRS *)lParam; @@ -547,16 +549,13 @@ static INT_PTR Service_GetAddEventPtr(WPARAM wParam, LPARAM lParam) return 0; } -static int ModulesLoaded(WPARAM wParam, LPARAM lParam) +static int ModulesLoaded(WPARAM, LPARAM) { LoadChatIcons(); HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyOptionsChanged); HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu); - char* mods[3] = { CHAT_MODULE, CHATFONT_MODULE }; - CallService("DBEditorpp/RegisterModule", (WPARAM)mods, 2); - CLISTMENUITEM mi = { sizeof(mi) }; mi.position = -2000090001; mi.flags = CMIF_DEFAULT; @@ -602,6 +601,7 @@ int LoadChatModule(void) ci.hSendEvent = CreateHookableEvent(ME_GC_EVENT); ci.hBuildMenuEvent = CreateHookableEvent(ME_GC_BUILDMENU); + hHookEvent = CreateHookableEvent(ME_GC_HOOK_EVENT); HookEvent(ME_FONT_RELOAD, FontsChanged); HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged); @@ -616,4 +616,5 @@ void UnloadChatModule(void) DestroyHookableEvent(ci.hSendEvent); DestroyHookableEvent(ci.hBuildMenuEvent); + DestroyHookableEvent(hHookEvent); } -- cgit v1.2.3