summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat.h4
-rw-r--r--src/modules/chat/chat_svc.cpp33
2 files changed, 21 insertions, 16 deletions
diff --git a/include/m_chat.h b/include/m_chat.h
index b93a9c9ed1..ae034350be 100644
--- a/include/m_chat.h
+++ b/include/m_chat.h
@@ -464,6 +464,10 @@ struct GCEVENT
#define MS_GC_EVENT "GChat/NewEvent"
+// This hook is fired when MS_GC_EVENT is called, with the same wParam and lParam as above.
+// It allows external plugins to intercept chat events and display then in other ways
+#define ME_GC_HOOK_EVENT "GChat/HookEvent"
+
#define GCEF_ADDTOLOG 0x0001
#define GCEF_REMOVECONTACT 0x0002
// Added in Miranda NG 0.94.4+
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);
}