From e344eae02ec47553fb1eec9fb2e9e6f975c72bc7 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Wed, 16 Mar 2011 16:23:30 +0200 Subject: fixing outgoung encrypted filetransfer... --- new_gpg.vcxproj | 10 +++++----- utilities.cpp | 31 +++++++++++++++++++++++++++---- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/new_gpg.vcxproj b/new_gpg.vcxproj index 39bdf92..21ee00c 100644 --- a/new_gpg.vcxproj +++ b/new_gpg.vcxproj @@ -477,7 +477,7 @@ Disabled - x:\temp\windows\libs\utf8cpp\include;C:\Boost\include\boost-1_45;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) + x:\temp\windows\libs\utf8cpp\include;C:\Boost\include\boost-1_46;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTPLUG_EXPORTS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -499,7 +499,7 @@ 0x0809 - shlwapi.lib;%(AdditionalDependencies) libboost_thread-vc100-mt-sgd-1_45.lib + shlwapi.lib;%(AdditionalDependencies) libboost_thread-vc100-mt-sgd-1_46_1.lib true C:\Boost\lib-debug;%(AdditionalLibraryDirectories) true @@ -527,7 +527,7 @@ Disabled - x:\temp\windows\libs\utf8cpp\include;C:\Boost\include\boost-1_45;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) + x:\temp\windows\libs\utf8cpp\include;C:\Boost\include\boost-1_46;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTPLUG_EXPORTS;_CRT_SECURE_NO_WARNINGS;_UNICODE;UNICODE;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -685,7 +685,7 @@ Size true true - x:\temp\windows\libs\utf8cpp\include;C:\Boost\include\boost-1_45;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include + x:\temp\windows\libs\utf8cpp\include;C:\Boost\include\boost-1_46;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_UNICODE;%(PreprocessorDefinitions) true MultiThreaded @@ -739,7 +739,7 @@ Size true true - x:\temp\windows\libs\utf8cpp\include;C:\Boost\include\boost-1_45;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) + x:\temp\windows\libs\utf8cpp\include;C:\Boost\include\boost-1_46;x:\install\git\miranda\miranda-im\miranda\include;x:\install\git\miranda\mim_plugs;../../include;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;_UNICODE;%(PreprocessorDefinitions) true MultiThreaded diff --git a/utilities.cpp b/utilities.cpp index d59a7cb..28bb51e 100644 --- a/utilities.cpp +++ b/utilities.cpp @@ -375,7 +375,9 @@ int onSendFile(WPARAM w, LPARAM l) DWORD code; pxResult result; char *keyid = UniGetContactSettingUtf(ccs->hContact, szGPGModuleName, "KeyID", ""); - wstring cmd = _T("-r "); + wstring cmd = _T("--batch --yes -r "); + if(DBGetContactSettingByte(ccs->hContact, szGPGModuleName, "bAlwaysTrust", 0)) + cmd += _T("--trust-model always "); TCHAR *szKeyid = mir_a2t(keyid); cmd += szKeyid; mir_free(szKeyid); @@ -401,19 +403,40 @@ int onSendFile(WPARAM w, LPARAM l) params.code = &code; params.result = &result; boost::thread *gpg_thread = new boost::thread(boost::bind(&pxEexcute_thread, ¶ms)); - if(!gpg_thread->timed_join(boost::posix_time::minutes(10))) + if(!gpg_thread->timed_join(boost::posix_time::seconds(180))) { delete gpg_thread; debuglog<hContact, szGPGModuleName, "bAlwaysTrust", 1); + cmd.insert(0, _T("--trust-model always ")); + gpg_execution_params params; + pxResult result; + params.cmd = &cmd; + params.useless = ""; + params.out = &out; + params.code = &code; + params.result = &result; + boost::thread gpg_thread(boost::bind(&pxEexcute_thread, ¶ms)); + if(!gpg_thread.timed_join(boost::posix_time::seconds(180))) + { + gpg_thread.~thread(); + debuglog<szProtoService, w, l); } void storeOutput(HANDLE ahandle, string *output) -- cgit v1.2.3