diff options
author | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-15 13:30:10 +0300 |
---|---|---|
committer | Gluzskiy Alexandr <sss123next@list.ru> | 2010-08-15 13:30:10 +0300 |
commit | 069250918284b12d42e4e2f4102dd2dbfba18e15 (patch) | |
tree | 6dae5a8c3cd97bd9058521ee60c8c501f0eb9f89 /messages.cpp | |
parent | 86cafe5f5e47960cb8962fd555612aeb2d288285 (diff) |
modified: commonheaders.h
modified: init.cpp
modified: main.cpp
modified: messages.cpp
modified: options.cpp
Diffstat (limited to 'messages.cpp')
-rw-r--r-- | messages.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/messages.cpp b/messages.cpp index 960d063..7e2a2fb 100644 --- a/messages.cpp +++ b/messages.cpp @@ -46,10 +46,6 @@ int RecvMsgSvc(WPARAM w, LPARAM l) if(!DBGetContactSettingByte(ccs->hContact, szModuleName, "GPGEncryption", 0))
;//
void ShowNewKeyDialog();
-/* if(key_action == 3)
- return CallService(MS_PROTO_CHAINRECV, w, l);
- else if(key_action == 2)
- DBWriteContactSettingByte(ccs->hContact, szModuleName, "GPGEncryption", 1); */
s1 = 0;
while((s1 = str.find(_T("\r"), s1)) != wstring::npos)
{
@@ -201,8 +197,9 @@ int SendMsgSvc(WPARAM w, LPARAM l) mir_free(tmp);
return CallService(MS_PROTO_CHAINSEND, w, l);
}
- cmd += _T("--comment \"\" --no-version ");
- cmd += _T("--trust-model always ");
+// cmd += _T("--comment \"\" --no-version ");
+ if(DBGetContactSettingByte(ccs->hContact, szModuleName, "bAlwaysTrust", 0))
+ cmd += _T("--trust-model always ");
cmd += _T("--batch --yes -e -a -r ");
TCHAR *tmp2 = mir_a2t(tmp);
mir_free(tmp);
@@ -235,6 +232,22 @@ int SendMsgSvc(WPARAM w, LPARAM l) }
//MessageBoxA(0, out.c_str(), "out", MB_OK);
DeleteFile(path.c_str());
+ if(out.find("There is no assurance this key belongs to the named user") != string::npos)
+ {
+ out.clear();
+ if(MessageBox(0, _T("We trying to encrypt with untrusted key, do you want to trust this key permanently ?"), _T("Warning"), MB_YESNO) == IDYES)
+ {
+ DBWriteContactSettingByte(ccs->hContact, szModuleName, "bAlwaysTrust", 1);
+ cmd.insert(0, _T("--trust-model always "));
+ 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);
+ }
+ }
+ else
+ return CallService(MS_PROTO_CHAINSEND, w, l);
+ }
path.append(_T(".asc"));
wfstream f(path.c_str(), std::ios::in);
str.clear();
@@ -294,3 +307,10 @@ int HookSendMsg(WPARAM w, LPARAM l) }
return 0;
}
+
+/*int TestHook(WPARAM w, LPARAM l)
+{
+ char *buf = (char*)w;
+ char *proto = (char*)l;
+ return 0;
+} */
\ No newline at end of file |