From f0bca208f1d668f0ad3d51afdafbb9d30ec8555b Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Mon, 11 Oct 2010 23:37:54 +0300 Subject: encrypted filetransfers //two paralell threads of more than one file will fail, miranda api lack of documentation, and ghaza does not remember how to edentify thread ) --- init.cpp | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'init.cpp') diff --git a/init.cpp b/init.cpp index 1530f82..768736c 100644 --- a/init.cpp +++ b/init.cpp @@ -136,6 +136,10 @@ int AddContact(WPARAM w, LPARAM l) return 0; } +void temp_cleaner_thread(); +boost::thread cleaner(boost::bind(temp_cleaner_thread)); + + static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) { @@ -152,6 +156,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) int onExtraImageListRebuilding(WPARAM, LPARAM); int onExtraImageApplying(WPARAM wParam, LPARAM); int onProtoAck(WPARAM, LPARAM); + int onSendFile(WPARAM, LPARAM); void InitIconLib(); void InitCheck(); @@ -192,7 +197,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) if(bJabberAPI && bIsMiranda09) HookEvent(ME_PROTO_ACCLISTCHANGED, GetJabberInterface); -// HookEvent(ME_PROTO_ACK, onProtoAck); //filetransfer unimplemented now + HookEvent(ME_PROTO_ACK, onProtoAck); //filetransfer unimplemented now HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu); @@ -210,10 +215,13 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) pd.type=PROTOTYPE_ENCRYPTION; CallService(MS_PROTO_REGISTERMODULE,0,(LPARAM)&pd); - CreateProtoServiceFunction(szGPGModuleName,PSR_MESSAGE,RecvMsgSvc); - CreateProtoServiceFunction(szGPGModuleName,PSS_MESSAGE,SendMsgSvc); - CreateProtoServiceFunction(szGPGModuleName,PSR_MESSAGE"W",RecvMsgSvc); - CreateProtoServiceFunction(szGPGModuleName,PSS_MESSAGE"W",SendMsgSvc); + CreateProtoServiceFunction(szGPGModuleName, PSR_MESSAGE, RecvMsgSvc); + CreateProtoServiceFunction(szGPGModuleName, PSS_MESSAGE, SendMsgSvc); + CreateProtoServiceFunction(szGPGModuleName, PSR_MESSAGE"W", RecvMsgSvc); + CreateProtoServiceFunction(szGPGModuleName, PSS_MESSAGE"W", SendMsgSvc); + + CreateProtoServiceFunction(szGPGModuleName, PSS_FILE, onSendFile); + CreateProtoServiceFunction(szGPGModuleName, PSS_FILE"W", onSendFile); 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)szGPGModuleName)) @@ -221,6 +229,8 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) HookEvent(ME_DB_CONTACT_ADDED,AddContact); + cleaner.detach(); + return 0; @@ -237,5 +247,6 @@ extern "C" int __declspec(dllexport) Unload(void) mir_free(outclosetag); if(password) delete [] password; + cleaner.~thread(); return 0; } -- cgit v1.2.3