summaryrefslogtreecommitdiff
path: root/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'init.cpp')
-rw-r--r--init.cpp32
1 files changed, 30 insertions, 2 deletions
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;
}