summaryrefslogtreecommitdiff
path: root/options.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'options.cpp')
-rw-r--r--options.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/options.cpp b/options.cpp
index fa96843..d49553c 100644
--- a/options.cpp
+++ b/options.cpp
@@ -438,6 +438,46 @@ static BOOL CALLBACK DlgProcGpgBinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LP
GetFilePath(_T("Choose gpg.exe"), "szGpgBinPath", _T("*.exe"), _T("EXE Executables"));
tmp = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T("gpg.exe"));
SetDlgItemText(hwndDlg, IDC_BIN_PATH, tmp);
+ bool gpg_exists = false;
+ {
+ if(_waccess(tmp, 0) != -1)
+ gpg_exists = true;
+ if(gpg_exists)
+ {
+ bool bad_version = false;
+ TCHAR *tmp_path = UniGetContactSettingUtf(NULL, szGPGModuleName, "szGpgBinPath", _T(""));
+ DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp);
+ string out;
+ DWORD code;
+ wstring cmd = _T("--version");
+ 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, &params));
+ if(!gpg_thread.timed_join(boost::posix_time::seconds(10)))
+ gpg_thread.~thread();
+ DBWriteContactSettingTString(NULL, szGPGModuleName, "szGpgBinPath", tmp_path);
+ mir_free(tmp_path);
+ string::size_type p1 = out.find("(GnuPG) ");
+ if(p1 != string::npos)
+ {
+ p1 += strlen("(GnuPG) ");
+ if(out[p1] != '1')
+ bad_version = true;
+ }
+ else
+ {
+ bad_version = false;
+ MessageBox(0, _T("This is not gnupg binary !\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK);
+ }
+ if(bad_version)
+ MessageBox(0, _T("Unsupported gnupg version found, use at you own risk!\nrecommended to use GnuPG v1.x.x with this plugn."), _T("Warning"), MB_OK);
+ }
+ }
char mir_path[MAX_PATH];
char *atmp = mir_t2a(tmp);
mir_free(tmp);