From 2ba65d614cd595945f310b6821ba426d35c18348 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 31 Jul 2015 18:54:53 +0000 Subject: unified project for New_GPG git-svn-id: http://svn.miranda-ng.org/main/trunk@14770 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/New_GPG/new_gpg.vcxproj | 34 +++ plugins/New_GPG/new_gpg.vcxproj.filters | 4 + plugins/New_GPG/new_gpg_10.vcxproj | 208 --------------- plugins/New_GPG/new_gpg_10.vcxproj.filters | 98 ------- plugins/New_GPG/new_gpg_12.vcxproj | 211 --------------- plugins/New_GPG/new_gpg_12.vcxproj.filters | 98 ------- plugins/New_GPG/new_gpg_14.vcxproj | 211 --------------- plugins/New_GPG/new_gpg_14.vcxproj.filters | 98 ------- plugins/New_GPG/src/clist.cpp | 2 +- plugins/New_GPG/src/commonheaders.h | 86 ------- plugins/New_GPG/src/gpg_wrapper.cpp | 9 +- plugins/New_GPG/src/gpg_wrapper.h | 1 - plugins/New_GPG/src/icons.cpp | 2 +- plugins/New_GPG/src/init.cpp | 8 +- plugins/New_GPG/src/jabber_account.cpp | 2 +- plugins/New_GPG/src/log.cpp | 2 +- plugins/New_GPG/src/main.cpp | 23 +- plugins/New_GPG/src/messages.cpp | 20 +- plugins/New_GPG/src/metacontacts.cpp | 2 +- plugins/New_GPG/src/options.cpp | 5 +- plugins/New_GPG/src/srmm.cpp | 8 +- plugins/New_GPG/src/stdafx.cpp | 18 -- plugins/New_GPG/src/stdafx.cxx | 18 ++ plugins/New_GPG/src/stdafx.h | 87 +++++++ plugins/New_GPG/src/utilities.cpp | 398 ++++++++++++----------------- 25 files changed, 345 insertions(+), 1308 deletions(-) create mode 100644 plugins/New_GPG/new_gpg.vcxproj create mode 100644 plugins/New_GPG/new_gpg.vcxproj.filters delete mode 100644 plugins/New_GPG/new_gpg_10.vcxproj delete mode 100644 plugins/New_GPG/new_gpg_10.vcxproj.filters delete mode 100644 plugins/New_GPG/new_gpg_12.vcxproj delete mode 100644 plugins/New_GPG/new_gpg_12.vcxproj.filters delete mode 100644 plugins/New_GPG/new_gpg_14.vcxproj delete mode 100644 plugins/New_GPG/new_gpg_14.vcxproj.filters delete mode 100644 plugins/New_GPG/src/commonheaders.h delete mode 100644 plugins/New_GPG/src/stdafx.cpp create mode 100644 plugins/New_GPG/src/stdafx.cxx create mode 100644 plugins/New_GPG/src/stdafx.h (limited to 'plugins/New_GPG') diff --git a/plugins/New_GPG/new_gpg.vcxproj b/plugins/New_GPG/new_gpg.vcxproj new file mode 100644 index 0000000000..836e1d2712 --- /dev/null +++ b/plugins/New_GPG/new_gpg.vcxproj @@ -0,0 +1,34 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {F29D0C8D-141A-43CF-86B2-34A04653F8D4} + New_GPG + + + + + + + .\src\include\;%(AdditionalIncludeDirectories) + Sync + + + \ No newline at end of file diff --git a/plugins/New_GPG/new_gpg.vcxproj.filters b/plugins/New_GPG/new_gpg.vcxproj.filters new file mode 100644 index 0000000000..de5ad9f66c --- /dev/null +++ b/plugins/New_GPG/new_gpg.vcxproj.filters @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/plugins/New_GPG/new_gpg_10.vcxproj b/plugins/New_GPG/new_gpg_10.vcxproj deleted file mode 100644 index fa36364a91..0000000000 --- a/plugins/New_GPG/new_gpg_10.vcxproj +++ /dev/null @@ -1,208 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {F29D0C8D-141A-43CF-86B2-34A04653F8D4} - New_GPG - - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - true - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - true - - - - Full - OnlyExplicitInline - Size - true - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - true - Fast - Level3 - Use - commonheaders.h - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin10\lib;..\..\..\boost\stage\lib - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - /PDBALTPATH:%_PDB% - - - - - Full - OnlyExplicitInline - Size - true - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - true - Fast - Level3 - Use - commonheaders.h - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin10\lib;..\..\..\boost\stage64\lib - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - /PDBALTPATH:%_PDB% - - - - - Disabled - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Use - commonheaders.h - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin10\lib;..\..\..\boost\stage\lib - true - false - $(IntDir)$(TargetName).lib - Windows - - - - - Disabled - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Use - commonheaders.h - Level3 - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin10\lib;..\..\..\boost\stage64\lib - true - false - $(IntDir)$(TargetName).lib - Windows - - - - - - - - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/New_GPG/new_gpg_10.vcxproj.filters b/plugins/New_GPG/new_gpg_10.vcxproj.filters deleted file mode 100644 index 1634a25bfe..0000000000 --- a/plugins/New_GPG/new_gpg_10.vcxproj.filters +++ /dev/null @@ -1,98 +0,0 @@ - - - - - {56a6d5fd-c491-4d42-95e0-d0e98979acff} - - - {8159144c-7020-4568-8bb4-53f4699faac6} - - - {65abe24a-f835-47f5-9ebf-fbd3f55f993c} - - - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - - - Resources - - - Resources - - - \ No newline at end of file diff --git a/plugins/New_GPG/new_gpg_12.vcxproj b/plugins/New_GPG/new_gpg_12.vcxproj deleted file mode 100644 index 12dfab0738..0000000000 --- a/plugins/New_GPG/new_gpg_12.vcxproj +++ /dev/null @@ -1,211 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {F29D0C8D-141A-43CF-86B2-34A04653F8D4} - New_GPG - - - - DynamicLibrary - Unicode - v120_xp - - - DynamicLibrary - Unicode - v120_xp - - - DynamicLibrary - Unicode - true - v120_xp - - - DynamicLibrary - Unicode - true - v120_xp - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - true - - - - Full - OnlyExplicitInline - Size - true - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - true - Fast - Level3 - Use - commonheaders.h - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin12\lib;..\..\..\boost\stage\lib - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - - - - - Full - OnlyExplicitInline - Size - true - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - true - Fast - Level3 - Use - commonheaders.h - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin12\lib;..\..\..\boost\stage64\lib - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - - - - - Disabled - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Use - commonheaders.h - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin12\lib;..\..\..\boost\stage\lib - true - false - $(IntDir)$(TargetName).lib - Windows - false - - - - - Disabled - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Use - commonheaders.h - Level3 - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin12\lib;..\..\..\boost\stage64\lib - true - false - $(IntDir)$(TargetName).lib - Windows - - - - - - - - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/New_GPG/new_gpg_12.vcxproj.filters b/plugins/New_GPG/new_gpg_12.vcxproj.filters deleted file mode 100644 index 1634a25bfe..0000000000 --- a/plugins/New_GPG/new_gpg_12.vcxproj.filters +++ /dev/null @@ -1,98 +0,0 @@ - - - - - {56a6d5fd-c491-4d42-95e0-d0e98979acff} - - - {8159144c-7020-4568-8bb4-53f4699faac6} - - - {65abe24a-f835-47f5-9ebf-fbd3f55f993c} - - - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - - - Resources - - - Resources - - - \ No newline at end of file diff --git a/plugins/New_GPG/new_gpg_14.vcxproj b/plugins/New_GPG/new_gpg_14.vcxproj deleted file mode 100644 index a5fa15c27b..0000000000 --- a/plugins/New_GPG/new_gpg_14.vcxproj +++ /dev/null @@ -1,211 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {F29D0C8D-141A-43CF-86B2-34A04653F8D4} - New_GPG - - - - DynamicLibrary - Unicode - v140_xp - - - DynamicLibrary - Unicode - v140_xp - - - DynamicLibrary - Unicode - true - v140_xp - - - DynamicLibrary - Unicode - true - v140_xp - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Plugins\ - $(SolutionDir)$(Configuration)\Plugins\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)64\Obj\$(ProjectName)\ - $(SolutionDir)$(Configuration)\Obj\$(ProjectName)\ - true - - - - Full - OnlyExplicitInline - Size - true - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - true - Fast - Level3 - Use - commonheaders.h - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin14\lib;..\..\..\boost\stage\lib - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - - - - - Full - OnlyExplicitInline - Size - true - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - true - true - Fast - Level3 - Use - commonheaders.h - - - NDEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin14\lib;..\..\..\boost\stage64\lib - true - true - true - false - $(IntDir)$(TargetName).lib - Windows - - - - - Disabled - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Use - commonheaders.h - Level3 - EditAndContinue - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin14\lib;..\..\..\boost\stage\lib - true - false - $(IntDir)$(TargetName).lib - Windows - false - - - - - Disabled - src\include;..\..\..\boost;..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - _DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebugDLL - Use - commonheaders.h - Level3 - - - _DEBUG;%(PreprocessorDefinitions) - ..\..\include\msapi - - - shlwapi.lib;%(AdditionalDependencies) - $(ProfileDir)..\..\bin14\lib;..\..\..\boost\stage64\lib - true - false - $(IntDir)$(TargetName).lib - Windows - - - - - - - - - - - Create - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/New_GPG/new_gpg_14.vcxproj.filters b/plugins/New_GPG/new_gpg_14.vcxproj.filters deleted file mode 100644 index 1634a25bfe..0000000000 --- a/plugins/New_GPG/new_gpg_14.vcxproj.filters +++ /dev/null @@ -1,98 +0,0 @@ - - - - - {56a6d5fd-c491-4d42-95e0-d0e98979acff} - - - {8159144c-7020-4568-8bb4-53f4699faac6} - - - {65abe24a-f835-47f5-9ebf-fbd3f55f993c} - - - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - Sources - - - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - - - Resources - - - Resources - - - \ No newline at end of file diff --git a/plugins/New_GPG/src/clist.cpp b/plugins/New_GPG/src/clist.cpp index 7057db9813..0c27067479 100644 --- a/plugins/New_GPG/src/clist.cpp +++ b/plugins/New_GPG/src/clist.cpp @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" void RefreshContactListIcons(void); diff --git a/plugins/New_GPG/src/commonheaders.h b/plugins/New_GPG/src/commonheaders.h deleted file mode 100644 index 120f288341..0000000000 --- a/plugins/New_GPG/src/commonheaders.h +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright © 2010-2012 sss -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -#ifndef COMMONHEADERS_H -#define COMMONHEADERS_H - -#define _CRT_SECURE_NO_WARNINGS -#define _SCL_SECURE_NO_WARNINGS - -//windows -#include -#include -#include -#include - -//c++ -#include -using std::map; -#include -using std::list; -#include -using std::string; -using std::wstring; -#include -using std::wfstream; -using std::fstream; - -//boost -#include -#include -#include -#include -#include -#include -#include - -//boost process -#include - -//utf8cpp -#include - -//miranda -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -//internal -#include "resource.h" -#include "Version.h" -#include "constants.h" -#include "log.h" -#include "globals.h" -#include "utilities.h" -#include "main.h" -#include "gpg_wrapper.h" -#include "jabber_account.h" -#include "metacontacts.h" - -#endif diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp index 2c9c57fc92..626be8d6f8 100755 --- a/plugins/New_GPG/src/gpg_wrapper.cpp +++ b/plugins/New_GPG/src/gpg_wrapper.cpp @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" //thx gpg module from Harald Treder, Zakhar V. Bardymov @@ -168,9 +168,7 @@ bool gpg_launcher(gpg_execution_params ¶ms, boost::posix_time::time_duration return ret; } - - -pxResult pxExecute_passwd_change(std::vector &aargv, string *aoutput, LPDWORD aexitcode, pxResult *result, boost::process::child *_child, string &old_pass, string &new_pass) +pxResult pxExecute_passwd_change(std::vector &aargv, pxResult *result, boost::process::child *_child) { if(!gpg_valid) return pxNotConfigured; @@ -192,7 +190,6 @@ pxResult pxExecute_passwd_change(std::vector &aargv, string *aoutp using namespace boost::process::initializers; using namespace boost::iostreams; - std::vector argv; std::vector env; env.push_back(L"LANGUAGE=en@quot"); @@ -339,5 +336,5 @@ pxResult pxExecute_passwd_change(std::vector &aargv, string *aoutp void pxEexcute_passwd_change_thread(void *param) { gpg_execution_params_pass *params = (gpg_execution_params_pass*)param; - pxResult result = pxExecute_passwd_change(params->args, params->out, params->code, params->result, params->child, params->old_pass, params->new_pass); + pxExecute_passwd_change(params->args, params->result, params->child); } diff --git a/plugins/New_GPG/src/gpg_wrapper.h b/plugins/New_GPG/src/gpg_wrapper.h index 9ff09578b5..a867553462 100644 --- a/plugins/New_GPG/src/gpg_wrapper.h +++ b/plugins/New_GPG/src/gpg_wrapper.h @@ -33,7 +33,6 @@ typedef enum { pxResult; pxResult pxExecute(std::vector &aargv, string *aoutput, LPDWORD aexitcode, pxResult *result); -pxResult pxExecute_passwd_change(std::vector &aargv, string *aoutput, LPDWORD aexitcode, pxResult *result, string &old_pass, string &new_pass); struct gpg_execution_params { diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp index 6d89633710..4cb37750c5 100644 --- a/plugins/New_GPG/src/icons.cpp +++ b/plugins/New_GPG/src/icons.cpp @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" extern HINSTANCE hInst; diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index ad6ad927c4..2e30326e0f 100644 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" //global variables bool bAppendTags = false, bDebugLog = false, bJabberAPI = false, bPresenceSigning = false, bIsMiranda09 = false, bFileTransfers = false, bSameAction = false, bAutoExchange = false, bStripTags = false, tabsrmm_used = false; @@ -48,14 +48,14 @@ PLUGININFOEX pluginInfo={ { 0x4227c050, 0x8d97, 0x48d2, { 0x91, 0xec, 0x6a, 0x95, 0x2b, 0x3d, 0xab, 0x94 } } }; -BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD, LPVOID) { hInst = hinstDLL; return TRUE; } -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD) { return &pluginInfo; } @@ -105,7 +105,7 @@ void init_vars() bold_font = CreateFont(14, 0, 0, 0, 600, 0, 0, 0, DEFAULT_CHARSET, 0, 0, 0, 0, _T("Arial")); } -static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) +static int OnModulesLoaded(WPARAM, LPARAM) { int GpgOptInit(WPARAM wParam,LPARAM lParam); int OnPreBuildContactMenu(WPARAM w, LPARAM l); diff --git a/plugins/New_GPG/src/jabber_account.cpp b/plugins/New_GPG/src/jabber_account.cpp index 6a264a490d..879e6c7a48 100644 --- a/plugins/New_GPG/src/jabber_account.cpp +++ b/plugins/New_GPG/src/jabber_account.cpp @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" void JabberAccount::setAccountName(TCHAR *Name) { diff --git a/plugins/New_GPG/src/log.cpp b/plugins/New_GPG/src/log.cpp index 29f80a1d5e..e9daf7d1df 100644 --- a/plugins/New_GPG/src/log.cpp +++ b/plugins/New_GPG/src/log.cpp @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" logtofile& logtofile::operator<<(TCHAR *buf) diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index 261b622407..9aab074d5a 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -14,7 +14,9 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" + +#pragma comment(lib, "shlwapi.lib") extern HFONT bold_font; extern bool bAutoExchange; @@ -317,7 +319,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR } if(result == pxNotFound) break; - string::size_type s = 0; + boost::algorithm::erase_all(out, "\r"); { char buf[64]; @@ -768,12 +770,10 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR break; case IDC_CHANGE_PASSWD: ListView_GetItemText(hwndList, itemnum, 0, key_id_global, _countof(key_id_global)); -// extern void ShowChangePasswdDlg(); -// ShowChangePasswdDlg(); + //temporary code follows std::vector cmd; std::string old_pass, new_pass; - TCHAR tmp2[MAX_PATH] = {0}; string output; DWORD exitcode; cmd.push_back(L"--edit-key"); @@ -845,7 +845,7 @@ static INT_PTR CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPAR return FALSE; } -static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { TCHAR *tmp = NULL; switch (msg) @@ -1279,11 +1279,11 @@ static INT_PTR CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, return FALSE; } -static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { static MCONTACT hContact = INVALID_CONTACT_ID; void ImportKey(); - TCHAR *tmp = NULL; + switch (msg) { case WM_INITDIALOG: @@ -1342,7 +1342,7 @@ static INT_PTR CALLBACK DlgProcNewKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara return FALSE; } -static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcKeyGenDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { switch (msg) { @@ -1895,7 +1895,7 @@ static INT_PTR CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wPar return FALSE; } -static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { MCONTACT hContact = INVALID_CONTACT_ID; @@ -2006,7 +2006,6 @@ void ShowImportKeyDialog() void FirstRun() { - DWORD pid = 0; if(!db_get_b(NULL, szGPGModuleName, "FirstRun", 1)) return; ShowSetDirsDialog(); @@ -2065,7 +2064,7 @@ void InitCheck() string out; DWORD code; pxResult result; - wstring::size_type p = 0, p2 = 0, stop = 0; + wstring::size_type p = 0, p2 = 0; { std::vector cmd; cmd.push_back(L"--batch"); diff --git a/plugins/New_GPG/src/messages.cpp b/plugins/New_GPG/src/messages.cpp index 036cb60fd1..3890e57e45 100755 --- a/plugins/New_GPG/src/messages.cpp +++ b/plugins/New_GPG/src/messages.cpp @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" wstring new_key; MCONTACT new_key_hcnt = NULL; @@ -24,7 +24,7 @@ int returnNoError(MCONTACT hContact); std::list sent_msgs; -void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD flags, DWORD timestamp) +void RecvMsgSvc_func(MCONTACT hContact, std::wstring str, char *msg, DWORD, DWORD timestamp) { DWORD dbflags = DBEF_UTF; { //check for gpg related data @@ -578,14 +578,13 @@ INT_PTR RecvMsgSvc(WPARAM w, LPARAM l) } if(!strstr(msg, "-----BEGIN PGP MESSAGE-----")) return Proto_ChainRecv(w, ccs); - boost::thread *thr = new boost::thread(boost::bind(RecvMsgSvc_func, ccs->hContact, str, msg, (DWORD)ccs->wParam, pre->timestamp)); + + new boost::thread(boost::bind(RecvMsgSvc_func, ccs->hContact, str, msg, (DWORD)ccs->wParam, pre->timestamp)); return 0; } void SendMsgSvc_func(MCONTACT hContact, char *msg, DWORD flags) { - bool isansi = false; - DWORD dbflags = DBEF_UTF; wstring str = toUTF16(msg); if(bStripTags && bAppendTags) { @@ -840,8 +839,7 @@ int HookSendMsg(WPARAM w, LPARAM l) debuglog<pfnGetContactDisplayName(hContact, 0))); CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----"); hcontact_data[hContact].msgs_to_send.push_back((char*)dbei->pBlob); - boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact)); - //TODO: wait for message + new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact)); return 0; } } @@ -875,9 +873,7 @@ int HookSendMsg(WPARAM w, LPARAM l) debuglog<pfnGetContactDisplayName(hContact, 0))); CallContactService(hContact, PSS_MESSAGE, 0, (LPARAM)"-----PGP KEY REQUEST-----"); hcontact_data[hContact].msgs_to_send.push_back((char*)dbei->pBlob); - boost::thread *thr = new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact)); - //mir_free((char*)dbei->pBlob); - //TODO: wait for message + new boost::thread(boost::bind(send_encrypted_msgs_thread, (void*)hContact)); return 0; } } @@ -928,8 +924,7 @@ int HookSendMsg(WPARAM w, LPARAM l) return 0; } - -static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { char *inkeyid = NULL; switch (msg) @@ -938,7 +933,6 @@ static INT_PTR CALLBACK DlgProcKeyPassword(HWND hwndDlg, UINT msg, WPARAM wParam { inkeyid = UniGetContactSettingUtf(new_key_hcnt, szGPGModuleName, "InKeyID", ""); new_key_hcnt_mutex.unlock(); - TCHAR *tmp = NULL; SetWindowPos(hwndDlg, 0, key_password_rect.left, key_password_rect.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW); TranslateDialogDefault(hwndDlg); diff --git a/plugins/New_GPG/src/metacontacts.cpp b/plugins/New_GPG/src/metacontacts.cpp index 5a7fa5a031..5de14098b4 100644 --- a/plugins/New_GPG/src/metacontacts.cpp +++ b/plugins/New_GPG/src/metacontacts.cpp @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" bool metaIsDefaultSubContact(MCONTACT hContact) { diff --git a/plugins/New_GPG/src/options.cpp b/plugins/New_GPG/src/options.cpp index bed5aaa640..79c5d5773b 100755 --- a/plugins/New_GPG/src/options.cpp +++ b/plugins/New_GPG/src/options.cpp @@ -14,7 +14,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" extern HINSTANCE hInst; @@ -37,7 +37,7 @@ BOOL CheckStateStoreDB(HWND hwndDlg, int idCtrl, const char* szSetting) return state; } -int GpgOptInit(WPARAM wParam,LPARAM lParam) +int GpgOptInit(WPARAM wParam, LPARAM) { OPTIONSDIALOGPAGE odp = { 0 }; odp.hInstance = hInst; @@ -195,7 +195,6 @@ static INT_PTR CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP void setClistIcon(MCONTACT hContact); void setSrmmIcon(MCONTACT hContact); { //gpg execute block - TCHAR tmp2[MAX_PATH] = {0}; TCHAR *ptmp; char *tmp; bool keep = false; diff --git a/plugins/New_GPG/src/srmm.cpp b/plugins/New_GPG/src/srmm.cpp index f1b646ff06..5dd57c2b11 100644 --- a/plugins/New_GPG/src/srmm.cpp +++ b/plugins/New_GPG/src/srmm.cpp @@ -16,18 +16,16 @@ -#include "commonheaders.h" +#include "stdafx.h" void ShowStatusIcon(MCONTACT hContact); void setSrmmIcon(MCONTACT hContact); -int __cdecl onWindowEvent(WPARAM wParam, LPARAM lParam) { - +int __cdecl onWindowEvent(WPARAM, LPARAM lParam) +{ MessageWindowEventData *mwd = (MessageWindowEventData *)lParam; if(mwd->uType == MSG_WINDOW_EVT_OPEN || mwd->uType == MSG_WINDOW_EVT_OPENING) - { setSrmmIcon(mwd->hContact); - } return 0; } diff --git a/plugins/New_GPG/src/stdafx.cpp b/plugins/New_GPG/src/stdafx.cpp deleted file mode 100644 index 048b14e9d2..0000000000 --- a/plugins/New_GPG/src/stdafx.cpp +++ /dev/null @@ -1,18 +0,0 @@ -/* -Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation version 2 -of the License. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - -#include "commonheaders.h" \ No newline at end of file diff --git a/plugins/New_GPG/src/stdafx.cxx b/plugins/New_GPG/src/stdafx.cxx new file mode 100644 index 0000000000..0c766ea07f --- /dev/null +++ b/plugins/New_GPG/src/stdafx.cxx @@ -0,0 +1,18 @@ +/* +Copyright (C) 2012-15 Miranda NG project (http://miranda-ng.org) + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation version 2 +of the License. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + +#include "stdafx.h" diff --git a/plugins/New_GPG/src/stdafx.h b/plugins/New_GPG/src/stdafx.h new file mode 100644 index 0000000000..eb5e6ba6a3 --- /dev/null +++ b/plugins/New_GPG/src/stdafx.h @@ -0,0 +1,87 @@ +// Copyright © 2010-2012 sss +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef COMMONHEADERS_H +#define COMMONHEADERS_H + +#pragma warning(disable:4512 4267 4127) + +#define _SCL_SECURE_NO_WARNINGS + +//windows +#include +#include +#include +#include + +//c++ +#include +using std::map; +#include +using std::list; +#include +using std::string; +using std::wstring; +#include +using std::wfstream; +using std::fstream; + +//boost +#include +#include +#include +#include +#include +#include +#include + +//boost process +#include + +//utf8cpp +#include + +//miranda +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +//internal +#include "resource.h" +#include "Version.h" +#include "constants.h" +#include "log.h" +#include "globals.h" +#include "utilities.h" +#include "main.h" +#include "gpg_wrapper.h" +#include "jabber_account.h" +#include "metacontacts.h" + +#endif diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index a3fceecef4..891a8b16cc 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -15,7 +15,7 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -#include "commonheaders.h" +#include "stdafx.h" void ShowExportKeysDlg(); void ShowLoadPublicKeyDialog(); @@ -119,7 +119,7 @@ TCHAR *GetFilePath(TCHAR *WindowTittle, TCHAR *szExt, TCHAR *szExtDesc, bool sav return str; } -void GetFolderPath(TCHAR *WindowTittle, char *szSetting) +void GetFolderPath(TCHAR *WindowTittle, char*) { BROWSEINFO pbi = {0}; pbi.lpszTitle = WindowTittle; @@ -148,7 +148,7 @@ INT_PTR LoadKey(WPARAM w, LPARAM) return 0; } -INT_PTR SendKey(WPARAM w, LPARAM l) +INT_PTR SendKey(WPARAM w, LPARAM) { MCONTACT hContact = db_mc_tryMeta(w); char *szMessage; @@ -199,7 +199,7 @@ INT_PTR SendKey(WPARAM w, LPARAM l) return 0; } -INT_PTR ToggleEncryption(WPARAM w, LPARAM l) +INT_PTR ToggleEncryption(WPARAM w, LPARAM) { MCONTACT hContact = (MCONTACT)w; BYTE enc; @@ -231,7 +231,7 @@ INT_PTR ToggleEncryption(WPARAM w, LPARAM l) return 0; } -int OnPreBuildContactMenu(WPARAM w, LPARAM l) +int OnPreBuildContactMenu(WPARAM w, LPARAM) { MCONTACT hContact = db_mc_tryMeta(w); { @@ -280,11 +280,9 @@ list transfers; DWORD file_msg_state = -1; -int onProtoAck(WPARAM w, LPARAM l) +int onProtoAck(WPARAM, LPARAM l) { ACKDATA *ack=(ACKDATA*)l; - CCSDATA *ccs=(CCSDATA*)ack->lParam; - if(ack->type == ACKTYPE_FILE) { switch(ack->result) @@ -586,13 +584,10 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) return Proto_ChainSend(w, ccs); } HistoryLog(ccs->hContact, db_event(Translate("encrypting file for transfer"), 0, 0, DBEF_SENT)); - DWORD flags = (DWORD)ccs->wParam; //check for PFTS_UNICODE here - int i; -// if(flags & PFTS_UNICODE) //this does not work .... if(StriStr(ccs->szProtoService, "/sendfilew")) { TCHAR **file=(TCHAR **)ccs->lParam; - for(i = 0; file[i]; i++) + for(int i = 0; file[i]; i++) { if(!boost::filesystem::exists(file[i])) return 0; //we do not want to send file unencrypted (sometimes ack have wrong info) @@ -607,7 +602,7 @@ INT_PTR onSendFile(WPARAM w, LPARAM l) else { char **file = (char**) ccs->lParam; - for(i = 0; file[i]; i++) + for(int i = 0; file[i]; i++) { if(!boost::filesystem::exists(file[i])) return 0; //we do not want to send file unencrypted (sometimes ack have wrong info) @@ -659,7 +654,7 @@ int ComboBoxAddStringUtf(HWND hCombo, const TCHAR *szString, DWORD data) } -int GetJabberInterface(WPARAM w, LPARAM l) //get interface for all jabber accounts, options later +int GetJabberInterface(WPARAM, LPARAM) //get interface for all jabber accounts, options later { extern list Accounts; void AddHandlers(); @@ -699,7 +694,7 @@ int GetJabberInterface(WPARAM w, LPARAM l) //get interface for all jabber accoun return 0; } -static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pUserData) +static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void*) { HXML local_node = node; for(int n = 0; n <= xmlGetChildCount(node); n++) @@ -903,12 +898,11 @@ static JABBER_HANDLER_FUNC SendHandler(IJabberInterface *ji, HXML node, void *pU //boost::mutex sign_file_mutex; -static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, void *pUserData) +static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface*, HXML node, void*) { HXML local_node = node; for(int n = 0; n <= xmlGetChildCount(node); n++) { - LPCTSTR str = xmlGetText(local_node); LPCTSTR nodename = xmlGetName(local_node); if(nodename) { @@ -1024,7 +1018,7 @@ static JABBER_HANDLER_FUNC PrescenseHandler(IJabberInterface *ji, HXML node, voi return FALSE; } -static JABBER_HANDLER_FUNC MessageHandler(IJabberInterface *ji, HXML node, void *pUserData) +static JABBER_HANDLER_FUNC MessageHandler(IJabberInterface*, HXML, void*) { return FALSE; } @@ -1146,7 +1140,7 @@ bool isGPGValid() tmp = mir_tstrdup(path); mir_free(path); } - DWORD len = MAX_PATH; + if(gpg_exists) { db_set_ts(NULL, szGPGModuleName, "szGpgBinPath", tmp); @@ -1551,7 +1545,7 @@ INT_PTR ExportGpGKeys(WPARAM, LPARAM) return 0; } -INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) +INT_PTR ImportGpGKeys(WPARAM, LPARAM) { TCHAR *p = GetFilePath(_T("Choose file to import keys from"), _T("*"), _T("Any file")); if(!p || !p[0]) @@ -1742,7 +1736,6 @@ INT_PTR ImportGpGKeys(WPARAM w, LPARAM l) string output; DWORD exitcode; { - MCONTACT hcnt = hContact; ptmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); path = ptmp; mir_free(ptmp); @@ -1933,66 +1926,45 @@ void strip_tags(std::wstring &str) boost::algorithm::erase_all(str, outclosetag); } - -static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcEncryptedFileMsgBox(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { - char *inkeyid = NULL; - switch (msg) - { - case WM_INITDIALOG: - { + switch (msg) { + case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); file_msg_state = -1; - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_IGNORE: - if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER)) - { - db_set_b(NULL, szGPGModuleName, "bSameAction", 1); - bSameAction = true; - } - DestroyWindow(hwndDlg); - break; - - case IDC_DECRYPT: - file_msg_state = 1; - if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER)) - { - db_set_b(NULL, szGPGModuleName, "bFileTransfers", 1); - bFileTransfers = true; - db_set_b(NULL, szGPGModuleName, "bSameAction", 0); - bSameAction = false; - } - - DestroyWindow(hwndDlg); - break; - - default: + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_IGNORE: + if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER)) + { + db_set_b(NULL, szGPGModuleName, "bSameAction", 1); + bSameAction = true; + } + DestroyWindow(hwndDlg); + break; + + case IDC_DECRYPT: + file_msg_state = 1; + if(IsDlgButtonChecked(hwndDlg, IDC_REMEMBER)) + { + db_set_b(NULL, szGPGModuleName, "bFileTransfers", 1); + bFileTransfers = true; + db_set_b(NULL, szGPGModuleName, "bSameAction", 0); + bSameAction = false; + } + + DestroyWindow(hwndDlg); + break; + } + break; + + case WM_CLOSE: + DestroyWindow(hwndDlg); break; - } - - break; - } - - case WM_NOTIFY: - { } - break; - case WM_CLOSE: - DestroyWindow(hwndDlg); - break; - case WM_DESTROY: - { - } - break; - } - return FALSE; + return FALSE; } @@ -2002,56 +1974,37 @@ void ShowEncryptedFileMsgBox() DialogBox(hInst, MAKEINTRESOURCE(IDD_ENCRYPTED_FILE_MSG_BOX), NULL, DlgProcEncryptedFileMsgBox); } - -static INT_PTR CALLBACK DlgProcExportKeys(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcExportKeys(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { - switch (msg) - { - case WM_INITDIALOG: - { + switch (msg) { + case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_OK: - if(IsDlgButtonChecked(hwndDlg, IDC_PUBLIC)) - ExportGpGKeysFunc(0); - else if(IsDlgButtonChecked(hwndDlg, IDC_PRIVATE)) - ExportGpGKeysFunc(1); - else if(IsDlgButtonChecked(hwndDlg, IDC_ALL)) - ExportGpGKeysFunc(2); - DestroyWindow(hwndDlg); - break; - - case IDC_CANCEL: - DestroyWindow(hwndDlg); - break; - - default: + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_OK: + if(IsDlgButtonChecked(hwndDlg, IDC_PUBLIC)) + ExportGpGKeysFunc(0); + else if(IsDlgButtonChecked(hwndDlg, IDC_PRIVATE)) + ExportGpGKeysFunc(1); + else if(IsDlgButtonChecked(hwndDlg, IDC_ALL)) + ExportGpGKeysFunc(2); + DestroyWindow(hwndDlg); + break; + + case IDC_CANCEL: + DestroyWindow(hwndDlg); + break; + } + + break; + + case WM_CLOSE: + DestroyWindow(hwndDlg); break; - } - - break; - } - - case WM_NOTIFY: - { } - break; - case WM_CLOSE: - DestroyWindow(hwndDlg); - break; - case WM_DESTROY: - { - } - break; - } - return FALSE; + return FALSE; } void ShowExportKeysDlg() @@ -2059,118 +2012,102 @@ void ShowExportKeysDlg() DialogBox(hInst, MAKEINTRESOURCE(IDD_EXPORT_TYPE), NULL, DlgProcExportKeys); } -static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +static INT_PTR CALLBACK DlgProcChangePasswd(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM) { - switch (msg) - { - case WM_INITDIALOG: - { + switch (msg) { + case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); - return TRUE; - } - - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_OK: - //TODO: show some prgress - { - std::string old_pass, new_pass; - extern TCHAR key_id_global[17]; - TCHAR buf[256] = {0}; - GetDlgItemText(hwndDlg, IDC_NEW_PASSWD1, buf, _countof(buf)); - new_pass = toUTF8(buf); - GetDlgItemText(hwndDlg, IDC_NEW_PASSWD2, buf, _countof(buf)); - if(new_pass != toUTF8(buf)) - { - MessageBox(hwndDlg, TranslateT("New passwords do not match"), TranslateT("Error"), MB_OK); - //key_id_global[0] = 0; - break; - } - GetDlgItemText(hwndDlg, IDC_OLD_PASSWD, buf, _countof(buf)); - old_pass = toUTF8(buf); - bool old_pass_match = false; - TCHAR *pass = UniGetContactSettingUtf(NULL, szGPGModuleName, "szKeyPassword", _T("")); - if(!mir_tstrcmp(pass,buf)) - old_pass_match = true; - mir_free(pass); - if(!old_pass_match) - { - if(key_id_global[0]) - { - string dbsetting = "szKey_"; - dbsetting += toUTF8(key_id_global); - dbsetting += "_Password"; - pass = UniGetContactSettingUtf(NULL, szGPGModuleName, dbsetting.c_str(), _T("")); - if(!mir_tstrcmp(pass,buf)) - old_pass_match = true; - mir_free(pass); - } - } - if(!old_pass_match) - { - if(MessageBox(hwndDlg, TranslateT("Old password does not match, you can continue, but GPG will reject wrong password.\nDo you want to continue?"), TranslateT("Error"), MB_YESNO) == IDNO) - { - //key_id_global[0] = 0; - break; - } - } - std::vector cmd; - TCHAR tmp2[MAX_PATH] = {0}; - string output; - DWORD exitcode; - cmd.push_back(L"--edit-key"); - cmd.push_back(key_id_global); - cmd.push_back(L"passwd"); - gpg_execution_params_pass params(cmd, old_pass, new_pass); - pxResult result; - params.out = &output; - params.code = &exitcode; - params.result = &result; - boost::thread gpg_thread(boost::bind(&pxEexcute_passwd_change_thread, ¶ms)); - if(!gpg_thread.timed_join(boost::posix_time::minutes(10))) - { - gpg_thread.~thread(); - if(params.child) - boost::process::terminate(*(params.child)); - if(bDebugLog) - debuglog< cmd; + string output; + DWORD exitcode; + cmd.push_back(L"--edit-key"); + cmd.push_back(key_id_global); + cmd.push_back(L"passwd"); + gpg_execution_params_pass params(cmd, old_pass, new_pass); + pxResult result; + params.out = &output; + params.code = &exitcode; + params.result = &result; + boost::thread gpg_thread(boost::bind(&pxEexcute_passwd_change_thread, ¶ms)); + if(!gpg_thread.timed_join(boost::posix_time::minutes(10))) + { + gpg_thread.~thread(); + if(params.child) + boost::process::terminate(*(params.child)); + if(bDebugLog) + debuglog<