diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-13 22:18:51 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-13 22:18:51 +0000 |
commit | fc5bf903988ed773e8fc0199fb5a427ced6b01d9 (patch) | |
tree | e5b1fd80d870ef9692cbb0796581a60883628ace /src/core | |
parent | a04043571f2d04ff9d117f921115f97f7bf42870 (diff) |
roadmap milestone #1
git-svn-id: http://svn.miranda-ng.org/main/trunk@402 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/miranda.cpp | 2 | ||||
-rw-r--r-- | src/core/miranda.h | 2 | ||||
-rw-r--r-- | src/core/modules.cpp | 38 |
3 files changed, 38 insertions, 4 deletions
diff --git a/src/core/miranda.cpp b/src/core/miranda.cpp index f20bfe9810..e2335b27a9 100644 --- a/src/core/miranda.cpp +++ b/src/core/miranda.cpp @@ -87,7 +87,7 @@ ITaskbarList3 * pTaskbarInterface; static DWORD MsgWaitForMultipleObjectsExWorkaround(DWORD nCount, const HANDLE *pHandles,
DWORD dwMsecs, DWORD dwWakeMask, DWORD dwFlags);
-static HANDLE hOkToExitEvent,hModulesLoadedEvent;
+HANDLE hOkToExitEvent,hModulesLoadedEvent;
static HANDLE hShutdownEvent,hPreShutdownEvent;
static HANDLE hWaitObjects[MAXIMUM_WAIT_OBJECTS-1];
static char *pszWaitServices[MAXIMUM_WAIT_OBJECTS-1];
diff --git a/src/core/miranda.h b/src/core/miranda.h index 4bb79bc57b..3596dd3e13 100644 --- a/src/core/miranda.h +++ b/src/core/miranda.h @@ -142,10 +142,12 @@ char* mir_u2a( const wchar_t* src); /**** miranda.c ************************************************************************/
extern HINSTANCE hMirandaInst;
+extern HANDLE hOkToExitEvent,hModulesLoadedEvent;
extern pfnExceptionFilter pMirandaExceptFilter;
/**** modules.c ************************************************************************/
+int CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam);
void KillModuleEventHooks( HINSTANCE );
void KillModuleServices( HINSTANCE );
diff --git a/src/core/modules.cpp b/src/core/modules.cpp index 7b2a833c32..a24d554a29 100644 --- a/src/core/modules.cpp +++ b/src/core/modules.cpp @@ -344,9 +344,41 @@ int SetHookDefaultForHookableEvent(HANDLE hEvent, MIRANDAHOOK pfnHook) return 0;
}
-int CallHookSubscribers( HANDLE hEvent, WPARAM wParam, LPARAM lParam )
+int CallPluginEventHook(HINSTANCE hInst, HANDLE hEvent, WPARAM wParam, LPARAM lParam)
{
- int i, returnVal = 0;
+ int returnVal = 0;
+ THook* p = ( THook* )hEvent;
+ if ( p == NULL )
+ return -1;
+
+ EnterCriticalSection( &p->csHook );
+ for ( int i = 0; i < p->subscriberCount; i++ ) {
+ THookSubscriber* s = &p->subscriber[i];
+ if ( s->hOwner != hInst )
+ continue;
+
+ switch ( s->type ) {
+ case 1: returnVal = s->pfnHook( wParam, lParam ); break;
+ case 2: returnVal = s->pfnHookParam( wParam, lParam, s->lParam ); break;
+ case 3: returnVal = s->pfnHookObj( s->object, wParam, lParam ); break;
+ case 4: returnVal = s->pfnHookObjParam( s->object, wParam, lParam, s->lParam ); break;
+ case 5: returnVal = SendMessage( s->hwnd, s->message, wParam, lParam ); break;
+ default: continue;
+ }
+ if ( returnVal )
+ break;
+ }
+
+ if ( p->subscriberCount == 0 && p->pfnHook != 0 )
+ returnVal = p->pfnHook( wParam, lParam );
+
+ LeaveCriticalSection( &p->csHook );
+ return returnVal;
+}
+
+int CallHookSubscribers(HANDLE hEvent, WPARAM wParam, LPARAM lParam)
+{
+ int returnVal = 0;
THook* p = ( THook* )hEvent;
if ( p == NULL )
return -1;
@@ -354,7 +386,7 @@ int CallHookSubscribers( HANDLE hEvent, WPARAM wParam, LPARAM lParam ) EnterCriticalSection( &p->csHook );
// NOTE: We've got the critical section while all this lot are called. That's mostly safe, though.
- for ( i = 0; i < p->subscriberCount; i++ ) {
+ for ( int i = 0; i < p->subscriberCount; i++ ) {
THookSubscriber* s = &p->subscriber[i];
switch ( s->type ) {
case 1: returnVal = s->pfnHook( wParam, lParam ); break;
|