From d343c7ed12d993658e62f4a5a3732276a0e627cb Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Fri, 13 Aug 2010 03:45:45 +0300 Subject: modified: main.cpp modified: messages.cpp modified: options.cpp --- main.cpp | 12 ++++++++++-- messages.cpp | 18 +++++++++++++++--- options.cpp | 13 +++++++++++-- 3 files changed, 36 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index a7595b1..834d6c7 100644 --- a/main.cpp +++ b/main.cpp @@ -88,7 +88,11 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM string::size_type p = 0, p2 = 0, stop = 0; { wstring cmd = _T("--list-secret-keys"); - pxExecute(&cmd, "", &out, &code); + if(pxExecute(&cmd, "", &out, &code) == pxNotFound) + { + MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK); + break; + } } cp866_to_cp1251(&out); while(p != string::npos) @@ -152,7 +156,11 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM DWORD code; wstring cmd = _T("--export -a "); cmd += fp; - pxExecute(&cmd, "", &out, &code); + if(pxExecute(&cmd, "", &out, &code) == pxNotFound) + { + MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK); + break; + } DBWriteContactSettingString(NULL, szModuleName, "GPGPubKey", out.c_str()); } DBWriteContactSettingByte(NULL, szModuleName, "FirstRun", 0); diff --git a/messages.cpp b/messages.cpp index db6fdad..8617a70 100644 --- a/messages.cpp +++ b/messages.cpp @@ -70,7 +70,11 @@ int RecvMsgSvc(WPARAM w, LPARAM l) cmd += tmp2; cmd += _T("\""); } - pxExecute(&cmd, "", &output, &exitcode); + if(pxExecute(&cmd, "", &output, &exitcode) == pxNotFound) + { + MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK); + return CallService(MS_PROTO_CHAINRECV, w, l); + } cp866_to_cp1251(&output); MessageBoxA(0, output.c_str(), "", MB_OK); DeleteFile(tmp2); @@ -103,7 +107,11 @@ int RecvMsgSvc(WPARAM w, LPARAM l) cmd += _T(" -d -a \""); cmd += path; cmd += _T("\""); - pxExecute(&cmd, "", &out, &code); + if(pxExecute(&cmd, "", &out, &code) == pxNotFound) + { + MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK); + return CallService(MS_PROTO_CHAINRECV, w, l); + } DeleteFile(path.c_str()); str.clear(); { @@ -198,7 +206,11 @@ int SendMsgSvc(WPARAM w, LPARAM l) mir_free(tmp); f.close(); } - pxExecute(&cmd, "", &out, &code); + if(pxExecute(&cmd, "", &out, &code) == pxNotFound) + { + MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK); + return CallService(MS_PROTO_CHAINSEND, w, l); + } DeleteFile(path.c_str()); path.append(_T(".asc")); wfstream f(path.c_str(), std::ios::in); diff --git a/options.cpp b/options.cpp index 906119a..0039b39 100644 --- a/options.cpp +++ b/options.cpp @@ -167,7 +167,12 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA ptmp = mir_a2t(tmp); cmd += ptmp; mir_free(ptmp); - pxExecute(&cmd, "", &output,&exitcode); + if(pxExecute(&cmd, "", &output,&exitcode) == pxNotFound) + { + MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK); + mir_free(tmp); + break; + } MessageBoxA(0, "Key removed from GPG keyring", "info", MB_OK); } mir_free(tmp); @@ -376,7 +381,11 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP cmd += tmp2; cmd += _T("\""); } - pxExecute(&cmd, "", &output, &exitcode); + if(pxExecute(&cmd, "", &output, &exitcode) == pxNotFound) + { + MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK); + break; + } cp866_to_cp1251(&output); { string::size_type s = output.find("gpg: key ") + strlen("gpg: key "); -- cgit v1.2.3