From 069250918284b12d42e4e2f4102dd2dbfba18e15 Mon Sep 17 00:00:00 2001 From: Gluzskiy Alexandr Date: Sun, 15 Aug 2010 13:30:10 +0300 Subject: modified: commonheaders.h modified: init.cpp modified: main.cpp modified: messages.cpp modified: options.cpp --- messages.cpp | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'messages.cpp') 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 -- cgit v1.2.3