summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGluzskiy Alexandr <sss123next@list.ru>2010-08-13 03:45:45 +0300
committerGluzskiy Alexandr <sss123next@list.ru>2010-08-13 03:45:45 +0300
commitd343c7ed12d993658e62f4a5a3732276a0e627cb (patch)
tree42bdb8fbf7e01a3a260fa7cf1052d008d4969ed6
parent47be0fda4fb11916325c2ff3b55e24501ab43ea1 (diff)
modified: main.cpp
modified: messages.cpp modified: options.cpp
-rw-r--r--main.cpp12
-rw-r--r--messages.cpp18
-rw-r--r--options.cpp13
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 ");