summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.cpp40
-rw-r--r--new_gpg.rc2
-rw-r--r--options.cpp5
-rw-r--r--resource.h2
4 files changed, 46 insertions, 3 deletions
diff --git a/main.cpp b/main.cpp
index 6cc6d13..964f3fb 100644
--- a/main.cpp
+++ b/main.cpp
@@ -1088,11 +1088,17 @@ static BOOL CALLBACK DlgProcLoadExistingKey(HWND hwndDlg,UINT msg,WPARAM wParam,
}
static BOOL CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ extern HANDLE new_key_hcnt;
+ extern HANDLE new_key_hcnt_mutex;
+ HANDLE hContact = new_key_hcnt;
+ ReleaseMutex(new_key_hcnt_mutex);
switch (msg)
{
case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
+ ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("subkeys.pgp.net"), 0);
+ ComboBoxAddStringUtf(GetDlgItem(hwndDlg, IDC_KEYSERVER), _T("keys.gnupg.net"), 0);
return TRUE;
}
@@ -1102,11 +1108,43 @@ static BOOL CALLBACK DlgProcImportKeyDialog(HWND hwndDlg, UINT msg, WPARAM wPara
switch (LOWORD(wParam))
{
case IDC_IMPORT:
+ {
+ string out;
+ DWORD code;
+ wstring cmd = _T(" --keyserver \"");
+ TCHAR *server= new TCHAR [128];
+ GetDlgItemText(hwndDlg, IDC_KEYSERVER, server, 128);
+ cmd += server;
+ delete [] server;
+ cmd += _T("\" --recv-keys ");
+ char *tmp = UniGetContactSettingUtf(hContact, szGPGModuleName, "KeyID_Prescense", "");
+ TCHAR *tmp2 = mir_a2t(tmp);
+ mir_free(tmp);
+ cmd += tmp2;
+ mir_free(tmp2);
+ gpg_execution_params params;
+ pxResult result;
+ 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);
+ }
+ MessageBoxA(0, out.c_str(), "GPG output", MB_OK);
+ }
break;
default:
break;
}
-
break;
}
diff --git a/new_gpg.rc b/new_gpg.rc
index 5683857..3910dc8 100644
--- a/new_gpg.rc
+++ b/new_gpg.rc
@@ -164,7 +164,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
PUSHBUTTON "Import",IDC_IMPORT,15,56,50,14
LTEXT "Select keyserver for key search:",IDC_STATIC,16,20,122,8
- COMBOBOX IDC_LEYSERVER,15,34,125,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_KEYSERVER,15,34,125,30,CBS_DROPDOWN | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
diff --git a/options.cpp b/options.cpp
index b361113..d0aadfc 100644
--- a/options.cpp
+++ b/options.cpp
@@ -1161,6 +1161,11 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP
}
break;
case IDC_IMPORT:
+ extern HANDLE new_key_hcnt;
+ extern HANDLE new_key_hcnt_mutex;
+ WaitForSingleObject(new_key_hcnt_mutex, INFINITE);
+ new_key_hcnt_mutex = CreateMutex(NULL, FALSE, NULL);
+ new_key_hcnt = hContact;
void ShowImportKeyDialog();
ShowImportKeyDialog();
break;
diff --git a/resource.h b/resource.h
index 9aac61f..a217a6e 100644
--- a/resource.h
+++ b/resource.h
@@ -66,7 +66,7 @@
#define IDC_KEYID 1053
#define IDC_CURRENT_KEY 1054
#define IDC_DEFAULT_PASSWORD 1055
-#define IDC_LEYSERVER 1058
+#define IDC_KEYSERVER 1058
// Next default values for new objects
//