summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 1fefc89..0941c28 100644
--- a/main.cpp
+++ b/main.cpp
@@ -198,6 +198,13 @@ static BOOL CALLBACK DlgProcFirstRun(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM
else
DBDeleteContactSetting(NULL, szGPGModuleName, "szKeyPassword");
DBWriteContactSettingByte(NULL, szGPGModuleName, "FirstRun", 0);
+ {
+ wstring keyinfo = _T("Current private key id: ");
+ keyinfo += (_tcslen(fp) > 0)?fp:_T("not set");
+ extern HWND hwndCurKey_p;
+ SetWindowText(hwndCurKey_p, keyinfo.c_str());
+ }
+
DestroyWindow(hwndDlg);
break;
case IDC_OTHER:
@@ -1091,6 +1098,47 @@ void FirstRun()
void InitCheck()
{
+ {//parse gpg output
+ string out;
+ DWORD code;
+ pxResult result;
+ wstring::size_type p = 0, p2 = 0, stop = 0;
+ {
+ gpg_execution_params params;
+ wstring cmd = _T("--batch --list-secret-keys");
+ params.cmd = &cmd;
+ params.useless = "";
+ params.out = &out;
+ params.code = &code;
+ params.result = &result;
+ HANDLE gpg_thread = mir_forkthread(pxEexcute_thread, (void*)&params);
+ if(WaitForSingleObject(gpg_thread, 10000) == WAIT_TIMEOUT)
+ {
+ TerminateThread(gpg_thread, 0);
+ MessageBox(0, _T("GPG execution timed out, aborted"), _T(""), MB_OK);
+ }
+ if(result == pxNotFound)
+ {
+ MessageBox(0, _T("Set path to gpg.exe first!"), _T("Warning"), MB_OK);
+ return;
+ }
+ }
+ char *keyid = UniGetContactSettingUtf(NULL, szGPGModuleName, "KeyID", "");
+ if(strlen(keyid) > 0)
+ {
+ string question = "Your secret key whith id: ";
+ question += keyid;
+ mir_free(keyid);
+ question += " deleted from gpg secret keyring\nDo you want to set another key ?";
+ void ShowFirstRunDialog();
+ if(out.find(keyid) == string::npos)
+ if(MessageBoxA(0, question.c_str(), "Own secret key warning", MB_YESNO) == IDYES)
+ ShowFirstRunDialog();
+ return;
+ }
+ else
+ mir_free(keyid);
+ }
}
void ImportKey()