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/common.h | 6 +++- meta2/m_metacontacts.h | 12 +++++++- meta2/miranda-svn.patch | 78 +++++++++++++++++++++++++++++++++++++++++++++++++ meta2/proto.cpp | 4 +-- 4 files changed, 96 insertions(+), 4 deletions(-) create mode 100644 meta2/miranda-svn.patch diff --git a/meta2/common.h b/meta2/common.h index c0c9110..59378c9 100644 --- a/meta2/common.h +++ b/meta2/common.h @@ -49,10 +49,14 @@ #include #include -#include #include #include +#ifndef PF4_IMSENDOFFLINE +#define PF4_IMSENDOFFLINE 0x00000100 // protocol is able to send offline messages (v.0.8.0+ 2007/10/3) +#endif + +#include "m_metacontacts.h" #include "collection.h" //////////// diff --git a/meta2/m_metacontacts.h b/meta2/m_metacontacts.h index 9f348bd..925b998 100644 --- a/meta2/m_metacontacts.h +++ b/meta2/m_metacontacts.h @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifndef M_METACONTACTS_H__ #define M_METACONTACTS_H__ 1 +// UUID for the MetaContact API #ifndef MIID_METACONTACTS #define MIID_METACONTACTS {0xc0325019, 0xc1a7, 0x40f5, { 0x83, 0x65, 0x4f, 0x46, 0xbe, 0x21, 0x86, 0x3e}} #endif @@ -51,10 +52,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. //returns a handle to the 'most online' contact #define MS_MC_GETMOSTONLINECONTACT "MetaContacts/GetMostOnline" +//gets the handle for the 'active' messaging contact (the one new messages will be sent to, +//taking into account temporary conversation settings and 'force state' below) +//wParam=(HANDLE)hMetaContact +//lParam=0 +//returns a handle to the 'most online' contact +//added with meta2 (2007/10/4) +#define MS_MC_GETACTIVECONTACT "MetaContacts/GetActiveContact" + //gets the number of subcontacts for a metacontact //wParam=(HANDLE)hMetaContact //lParam=0 -//returns a DWORD representing the number of subcontacts for the given metacontact +//returns an int representing the number of subcontacts for the given metacontact, or -1 on failure #define MS_MC_GETNUMCONTACTS "MetaContacts/GetNumContacts" //gets the handle of a subcontact, using the subcontact's number @@ -140,6 +149,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // wParam=(HANDLE)hContact // lParam=0 // convert a given contact into a metacontact +// returns a HANDLE to the newly created metacontact #define MS_MC_CONVERTTOMETA "MetaContacts/ConvertToMetacontact" // added 0.9.5.0 (22/3/05) 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; diff --git a/meta2/proto.cpp b/meta2/proto.cpp index 8cf504a..a6f81f7 100644 --- a/meta2/proto.cpp +++ b/meta2/proto.cpp @@ -523,7 +523,7 @@ void InitProto() { void DeinitProto() { for(int i = 0; i < NUM_SERVICES; i++) DestroyServiceFunction(hServices[i]); - for(int i = 0; i < NUM_HOOKS_INTERNAL; i++) - UnhookEvent(hHooksInternal[i]); + for(int j = 0; j < NUM_HOOKS_INTERNAL; j++) + UnhookEvent(hHooksInternal[j]); } \ No newline at end of file -- cgit v1.2.3