summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--commonheaders.h1
-rw-r--r--init.cpp2
-rw-r--r--main.cpp2
-rw-r--r--messages.cpp32
-rw-r--r--options.cpp1
5 files changed, 32 insertions, 6 deletions
diff --git a/commonheaders.h b/commonheaders.h
index 5cf8d99..2c3a640 100644
--- a/commonheaders.h
+++ b/commonheaders.h
@@ -45,6 +45,7 @@ using std::fstream;
#include <m_skin.h>
#include <m_protomod.h>
#include <m_protosvc.h>
+#include <m_netlib.h>
#include "resource.h"
#include "gpgme.h"
diff --git a/init.cpp b/init.cpp
index 86b189f..916f846 100644
--- a/init.cpp
+++ b/init.cpp
@@ -135,6 +135,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
int RecvMsgSvc(WPARAM w, LPARAM l);
int SendMsgSvc(WPARAM w, LPARAM l);
int HookSendMsg(WPARAM w, LPARAM l);
+// int TestHook(WPARAM w, LPARAM l);
// void test();
@@ -145,6 +146,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
HookEvent(ME_OPT_INITIALISE, GpgOptInit);
HookEvent(ME_DB_EVENT_FILTER_ADD, HookSendMsg);
+// HookEvent(ME_NETLIB_FASTSEND, TestHook);
hOnPreBuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPreBuildContactMenu);
PROTOCOLDESCRIPTOR pd = {0};
diff --git a/main.cpp b/main.cpp
index 09fc90f..6a58405 100644
--- a/main.cpp
+++ b/main.cpp
@@ -410,7 +410,9 @@ void ImportKey()
if(pxExecute(&cmd, "", &output, &exitcode) == pxNotFound)
{
MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
+ return;
}
+ DBDeleteContactSetting(new_key_hcnt, szModuleName, "bAlwatsTrust");
cp866_to_cp1251(&output);
{
string::size_type s = output.find("gpg: key ") + strlen("gpg: key ");
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
diff --git a/options.cpp b/options.cpp
index 364bfc2..41a9de2 100644
--- a/options.cpp
+++ b/options.cpp
@@ -521,6 +521,7 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP
break;
}
cp866_to_cp1251(&output);
+ DBDeleteContactSetting(new_key_hcnt, szModuleName, "bAlwatsTrust");
{
string::size_type s = output.find("gpg: key ") + strlen("gpg: key ");
string::size_type s2 = output.find(":", s);