summaryrefslogtreecommitdiff
path: root/src/mir_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir_core')
-rw-r--r--src/mir_core/src/mir_core.def1
-rw-r--r--src/mir_core/src/mir_core64.def1
-rw-r--r--src/mir_core/src/modules.cpp24
3 files changed, 26 insertions, 0 deletions
diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def
index f5037de864..8a8e4df230 100644
--- a/src/mir_core/src/mir_core.def
+++ b/src/mir_core/src/mir_core.def
@@ -1050,3 +1050,4 @@ CallFunctionSync @1170
?Hide@CDlgBase@@QAEXXZ @1238 NONAME
?Resize@CDlgBase@@QAEXXZ @1239 NONAME
Utils_IsRtl @1240
+HookTemporaryEvent @1241
diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def
index 31edd2dbea..f188b5b51d 100644
--- a/src/mir_core/src/mir_core64.def
+++ b/src/mir_core/src/mir_core64.def
@@ -1050,3 +1050,4 @@ CallFunctionSync @1170
?Hide@CDlgBase@@QEAAXXZ @1238 NONAME
?Resize@CDlgBase@@QEAAXXZ @1239 NONAME
Utils_IsRtl @1240
+HookTemporaryEvent @1241
diff --git a/src/mir_core/src/modules.cpp b/src/mir_core/src/modules.cpp
index c6908e723d..ae7cd45f1e 100644
--- a/src/mir_core/src/modules.cpp
+++ b/src/mir_core/src/modules.cpp
@@ -332,6 +332,30 @@ MIR_CORE_DLL(HANDLE) HookEventObjParam(const char *name, MIRANDAHOOKOBJPARAM hoo
return HookEventInt(4, name, (MIRANDAHOOK)hookProc, object, lParam);
}
+MIR_CORE_DLL(HANDLE) HookTemporaryEvent(const char *name, MIRANDAHOOK hookProc)
+{
+ mir_cslockfull lck(csHooks);
+
+ int idx;
+ if ((idx = hooks.getIndex((THook*)name)) == -1) {
+ lck.unlock();
+ hookProc(0, 0);
+ return NULL;
+ }
+
+ THook *p = hooks[idx];
+ p->subscriber = (THookSubscriber*)mir_realloc(p->subscriber, sizeof(THookSubscriber)*(p->subscriberCount + 1));
+
+ THookSubscriber &s = p->subscriber[p->subscriberCount];
+ memset(&s, 0, sizeof(THookSubscriber));
+ s.type = 1;
+ s.pfnHook = hookProc;
+ s.hOwner = GetInstByAddress(hookProc);
+
+ p->subscriberCount++;
+ return (HANDLE)((p->id << 16) | p->subscriberCount);
+}
+
MIR_CORE_DLL(HANDLE) HookEventMessage(const char *name, HWND hwnd, UINT message)
{
mir_cslock lck(csHooks);