From ff34af8edad99fae99b59def8a3d5cce92085a9c Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 11 Aug 2010 02:52:42 +0300 Subject: modified: commonheaders.h modified: gpg_wrapper.cpp modified: gpg_wrapper.h modified: init.cpp modified: main.cpp modified: messages.cpp modified: options.cpp modified: utilities.cpp modified: utilities.h --- init.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'init.cpp') diff --git a/init.cpp b/init.cpp index 5b07200..5bc53ff 100644 --- a/init.cpp +++ b/init.cpp @@ -97,15 +97,43 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) return 0; } +int AddContact(WPARAM w, LPARAM l) +{ + CallService(MS_PROTO_ADDTOCONTACT,w,(LPARAM)szModuleName); + return 0; +} + static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) { - void test(); + int GpgOptInit(WPARAM wParam,LPARAM lParam); int OnPreBuildContactMenu(WPARAM w, LPARAM l); - test(); + int RecvMsgSvc(WPARAM w, LPARAM l); + int SendMsgSvc(WPARAM w, LPARAM l); + HookEvent(ME_OPT_INITIALISE, GpgOptInit); hOnPreBuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu); + + PROTOCOLDESCRIPTOR pd = {0}; + pd.cbSize=sizeof(PROTOCOLDESCRIPTOR); + pd.szName=szModuleName; + pd.type=PROTOTYPE_ENCRYPTION; + CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); + + CreateProtoServiceFunction(szModuleName,PSR_MESSAGE,RecvMsgSvc); + CreateProtoServiceFunction(szModuleName,PSS_MESSAGE,SendMsgSvc); + CreateProtoServiceFunction(szModuleName,PSR_MESSAGE"W",RecvMsgSvc); + CreateProtoServiceFunction(szModuleName,PSS_MESSAGE"W",SendMsgSvc); + + for (HANDLE hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST, 0, 0); hContact; hContact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT, (WPARAM)hContact, 0)) + if (!CallService(MS_PROTO_ISPROTOONCONTACT, (WPARAM)hContact, (LPARAM)szModuleName)) + CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)szModuleName); + + HookEvent(ME_DB_CONTACT_ADDED,AddContact); + + + return 0; } -- cgit v1.2.3