/[winpt]/trunk/Src/wptKeyserverSearchDlg.cpp
ViewVC logotype

Contents of /trunk/Src/wptKeyserverSearchDlg.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5 - (show annotations)
Mon Mar 7 13:21:36 2005 UTC (19 years, 11 months ago) by twoaday
File size: 4422 byte(s)
2005-03-03  Timo Schulz  <twoaday@g10code.com>
                                                                                
        * wptCardDlg.cpp (card_changepin_dlg_proc): Add item to re-type the
        new PIN. Suggested by Achim.
        Support to show the unmasked PIN.
        Modified TAB-order.
        * wptPINDlg.cpp (pin_cb_dlg_proc): Show unmasked PIN.
 
        * Fixed wrong GPG --command-fd strings. Thanks to Achim.
 
2005-03-04  Timo Schulz  <twoaday@g10code.com>
 
        * GPG asks twice for the new PIN. Thanks to Achim.
        * wptCardDlg.cpp (card_changepin_dlg_proc): Reset the 'safety' pin also.        Only check the passphrase if the backup flag is enabled. Again thanks to        Achim.
 
2005-03-06  Timo Schulz  <twoaday@freakmail.de>
 
        * wptKeySignDlg.cpp (do_fill_seckeylist): Skip secret keys without
        a public key. Noted by Kurt Fitzner.
 


1 /* wptKeyserverSearchDlg.cpp - Keyserver Searching
2 * Copyright (C) 2001-2005 Timo Schulz
3 *
4 * This file is part of WinPT.
5 *
6 * WinPT is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * WinPT is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with WinPT; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19 */
20
21 #include <windows.h>
22 #include <stdio.h>
23
24 #include "../resource.h"
25 #include "wptCommonCtl.h"
26 #include "wptKeyserver.h"
27 #include "wptErrors.h"
28 #include "wptTypes.h"
29 #include "wptGPG.h"
30 #include "wptContext.h" /* for passphrase_s */
31 #include "wptDlgs.h"
32 #include "wptNLS.h"
33
34
35 BOOL CALLBACK
36 hkpsearch_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam)
37 {
38 static listview_ctrl_t lv = NULL;
39 static keyserver_ctx * ksc;
40 keyserver_key key;
41 struct listview_column_s keysearch[] = {
42 {0, 48, (char *)_("Size")},
43 {1, 64, (char *)_("Key ID")},
44 {2, 72, (char *)_("Creation")},
45 {3, 256, (char *)_("User ID")},
46 {0, 0, NULL}
47 };
48 char t[32], info[384];
49 int i, rc;
50 int conn_fd = 0;
51
52 switch (msg)
53 {
54 case WM_INITDIALOG:
55 ksc = (keyserver_ctx *)lparam;
56 if (!ksc)
57 dlg_fatal_error (dlg, "Could not get dialog param.");
58 #ifndef LANG_DE
59 SetWindowText (dlg, _("Keyserver Searching"));
60 #endif
61 SetDlgItemText (dlg, IDC_HKPSEARCH_RECV, _("&Receive"));
62 _snprintf (info, sizeof (info) - 1,
63 _("Connect to '%s' to search for \"%s\""),
64 ksc->name, ksc->pattern);
65 SetDlgItemText (dlg, IDC_HKPSEARCH_INFO, info);
66 listview_new (&lv);
67 lv->ctrl = GetDlgItem (dlg, IDC_HKPSEARCH_LIST);
68 for (i = 0; keysearch[i].width; i++)
69 listview_add_column (lv, &keysearch[i]);
70 listview_set_ext_style (lv);
71 rc = kserver_search_init (ksc->name, ksc->port, ksc->pattern, &conn_fd);
72 if (rc) {
73 msg_box (dlg, winpt_strerror (rc), _("Keyserver - search init"), MB_ERR);
74 EndDialog (dlg, FALSE);
75 return FALSE;
76 }
77 rc = kserver_search_chkresp (conn_fd);
78 if (rc) {
79 msg_box (dlg, winpt_strerror (rc), _("Keyserver - check response"), MB_ERR);
80 closesocket (conn_fd);
81 EndDialog (dlg, FALSE);
82 return FALSE;
83 }
84 for (;;) {
85 rc = kserver_search (conn_fd, &key);
86 if (rc)
87 break;
88 if (!key.bits)
89 continue;
90 _snprintf (t, sizeof (t) - 1, "%d", key.bits);
91 listview_add_item (lv, " ");
92 listview_add_sub_item (lv, 0, 0, t);
93 listview_add_sub_item (lv, 0, 1, key.keyid);
94 listview_add_sub_item (lv, 0, 2, key.date);
95 listview_add_sub_item (lv, 0, 3, key.uid);
96 }
97 closesocket (conn_fd);
98 SetForegroundWindow (dlg);
99 return TRUE;
100
101 case WM_DESTROY:
102 if (lv) {
103 listview_release (lv);
104 lv = NULL;
105 }
106 return FALSE;
107
108 case WM_SYSCOMMAND:
109 if (LOWORD (wparam) == SC_CLOSE)
110 EndDialog (dlg, TRUE);
111 return FALSE;
112
113 case WM_COMMAND:
114 switch (LOWORD (wparam)) {
115 case IDOK:
116 EndDialog (dlg, TRUE);
117 return TRUE;
118
119 case IDCANCEL:
120 EndDialog (dlg, FALSE);
121 return FALSE;
122
123 case IDC_HKPSEARCH_RECV:
124 if ((i = listview_get_curr_pos (lv)) == -1) {
125 msg_box (dlg, _("Please select a key."), _("Keyserver"), MB_ERR);
126 return FALSE;
127 }
128 listview_get_item_text (lv, i, 1, t, sizeof (t) -1);
129 hkp_recv_key (dlg, ksc->name, ksc->port, t, 0, 0);
130 return TRUE;
131 }
132 break;
133 }
134
135 return FALSE;
136 } /* hkpsearch_dlg_proc */

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26