From e8e794f67af810a895de3fb1b4bfbeda52b19429 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@4f64403b-2f21-0410-a795-97e2b3489a10> Date: Tue, 15 Jul 2008 05:17:55 +0000 Subject: suggested changes by Drugwash added patch to create service override service in core git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@423 4f64403b-2f21-0410-a795-97e2b3489a10 --- meta2/miranda-svn.patch | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 meta2/miranda-svn.patch (limited to 'meta2/miranda-svn.patch') diff --git a/meta2/miranda-svn.patch b/meta2/miranda-svn.patch new file mode 100644 index 0000000..f5e4a6b --- /dev/null +++ b/meta2/miranda-svn.patch @@ -0,0 +1,78 @@ +Index: include/m_plugins.h +=================================================================== +--- include/m_plugins.h (revision 8019) ++++ include/m_plugins.h (working copy) +@@ -79,6 +79,12 @@ + //feature-dependent + #define MS_PLUGINS_GETDISABLEDEFAULTARRAY "Plugins/GetDisableDefaultArray" + ++// plugins/hookservice ++// replaces a service function pointer and returns the old value ++// wPararm = (char *)service name ++// lParam = MIRANDASERVICE ++#define MS_PLUGINS_HOOKSERVICE "Plugins/HookService" ++ + #endif // M_PLUGINS_H__ + + +Index: src/core/modules.c +=================================================================== +--- src/core/modules.c (revision 8019) ++++ src/core/modules.c (working copy) +@@ -722,6 +722,23 @@ + return ret; + } + ++MIRANDASERVICE ModulesReplaceService(char *name, MIRANDASERVICE pfnNewService) { ++ TService *pService; ++ MIRANDASERVICE pfnService; ++ if (pfnNewService==NULL || name==NULL) return 0; ++ ++ EnterCriticalSection(&csServices); ++ pService=FindServiceByName(name); ++ if (pService==NULL) { ++ LeaveCriticalSection(&csServices); ++ return 0; ++ } ++ pfnService = pService->pfnService; ++ pService->pfnService = pfnNewService; ++ LeaveCriticalSection(&csServices); ++ return pfnService; ++} ++ + int CallService(const char *name,WPARAM wParam,LPARAM lParam) + { + TService *pService; +Index: src/modules/plugins/newplugins.c +=================================================================== +--- src/modules/plugins/newplugins.c (revision 8019) ++++ src/modules/plugins/newplugins.c (working copy) +@@ -100,6 +100,7 @@ + #define PLUGINDISABLELIST "PluginDisable" + + int CallHookSubscribers( HANDLE hEvent, WPARAM wParam, LPARAM lParam ); ++MIRANDASERVICE ModulesReplaceService(char *name, MIRANDASERVICE pfnNewService); + + int LoadDatabaseModule(void); + void ListView_SetItemTextA( HWND hwndLV, int i, int iSubItem, char* pszText ); +@@ -437,6 +438,11 @@ + return (int) &pluginDefModList; + } + ++static int PluginsHookService(WPARAM wParam, LPARAM lParam) ++{ ++ return (int)ModulesReplaceService((char *)wParam, (MIRANDASERVICE)lParam); ++} ++ + // called in the first pass to create pluginEntry* structures and validate database plugins + static BOOL scanPluginsDir (WIN32_FIND_DATAA * fd, char * path, WPARAM wParam, LPARAM lParam ) + { +@@ -1040,6 +1046,8 @@ + // + CreateServiceFunction(MS_PLUGINS_ENUMDBPLUGINS, PluginsEnum); + CreateServiceFunction(MS_PLUGINS_GETDISABLEDEFAULTARRAY, PluginsGetDefaultArray); ++ CreateServiceFunction(MS_PLUGINS_HOOKSERVICE, PluginsHookService); ++ + // make sure plugins can get internal core APIs + pluginCoreLink.CallService = CallService; + pluginCoreLink.ServiceExists = ServiceExists; -- cgit v1.2.3