102 |
} |
} |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
/* If the keyserver returned one than more key in a |
107 |
|
keyblob, show the names of all imported keys. */ |
108 |
|
static void |
109 |
|
show_imported_keys (gpgme_import_result_t res) |
110 |
|
{ |
111 |
|
gpgme_import_status_t t; |
112 |
|
gpgme_key_t key; |
113 |
|
gpgme_data_t msg; |
114 |
|
gpgme_ctx_t ctx; |
115 |
|
gpgme_error_t err; |
116 |
|
const char *s; |
117 |
|
char *p; |
118 |
|
size_t n=0; |
119 |
|
|
120 |
|
err = gpgme_data_new (&msg); |
121 |
|
if (err) |
122 |
|
BUG (NULL); |
123 |
|
err = gpgme_new (&ctx); |
124 |
|
if (err) |
125 |
|
BUG (NULL); |
126 |
|
s = _("WARNING: multiple keys matched request.\n\n"); |
127 |
|
gpgme_data_write (msg, s, strlen (s)); |
128 |
|
for (t=res->imports; t; t = t->next) { |
129 |
|
if (!gpgme_get_key (ctx, t->fpr, &key, 0)) { |
130 |
|
s = key->uids->uid; |
131 |
|
gpgme_data_write (msg, s, strlen (s)); |
132 |
|
gpgme_data_write (msg, "\n", 1); |
133 |
|
gpgme_key_release (key); |
134 |
|
} |
135 |
|
} |
136 |
|
gpgme_data_write (msg, "\0", 1); |
137 |
|
p = gpgme_data_release_and_get_mem (msg, &n); |
138 |
|
if (p != NULL) { |
139 |
|
msg_box (NULL, p, _("Imported Keys"), MB_INFO); |
140 |
|
gpgme_free (p); |
141 |
|
} |
142 |
|
gpgme_release (ctx); |
143 |
|
} |
144 |
|
|
145 |
|
|
146 |
/* Receive a key from the keyserver @kserver (port @port) |
/* Receive a key from the keyserver @kserver (port @port) |
147 |
with the pattern @pattern. |
with the pattern @pattern. |
148 |
Return value: 0 on success. */ |
Return value: 0 on success. */ |
207 |
goto leave; |
goto leave; |
208 |
} |
} |
209 |
import_res = gpgme_op_import_result (ctx); |
import_res = gpgme_op_import_result (ctx); |
210 |
if (r_fpr) |
if (import_res && r_fpr) |
211 |
*r_fpr = m_strdup (import_res->imports->fpr); |
*r_fpr = m_strdup (import_res->imports->fpr); |
212 |
} |
} |
213 |
|
|
214 |
/* if we use the refresh mode, a lot of keys will be fetched and thus only |
/* if we use the refresh mode, a lot of keys will be fetched and thus only |
215 |
a summarize at the end is presented and not for each key. */ |
a summarize at the end is presented and not for each key. */ |
216 |
if (!(flags & KM_KS_REFRESH)) { |
if (!(flags & KM_KS_REFRESH)) { |
217 |
if (import_res && import_res->unchanged == 1) { |
if (import_res && import_res->considered > 1) |
218 |
|
show_imported_keys (import_res); |
219 |
|
if (import_res && import_res->unchanged == import_res->considered) { |
220 |
_snprintf (msg, DIM (msg)-1, |
_snprintf (msg, DIM (msg)-1, |
221 |
_("Key '%s' successfully received but nothing was changed."), pattern ); |
_("Key '%s' successfully received but nothing was changed."), pattern ); |
222 |
status_box (dlg, msg, _("GnuPG Status")); |
status_box (dlg, msg, _("GnuPG Status")); |
438 |
SetDlgItemText (dlg, IDC_KEYSERVER_INDEX, _("&Search")); |
SetDlgItemText (dlg, IDC_KEYSERVER_INDEX, _("&Search")); |
439 |
SetDlgItemText (dlg, IDC_KEYSERVER_PROXSETT, _("C&hange")); |
SetDlgItemText (dlg, IDC_KEYSERVER_PROXSETT, _("C&hange")); |
440 |
SetDlgItemText (dlg, IDC_KEYSERVER_DEFAULT, _("Set &default")); |
SetDlgItemText (dlg, IDC_KEYSERVER_DEFAULT, _("Set &default")); |
441 |
SetDlgItemText (dlg, IDCANCEL, _("&Cancel")); |
SetDlgItemText (dlg, IDCANCEL, _("&Close")); |
442 |
|
|
443 |
set_proxy (dlg); |
set_proxy (dlg); |
444 |
keyserver_list_build (&lv, GetDlgItem (dlg, IDC_KEYSERVER_LIST)); |
keyserver_list_build (&lv, GetDlgItem (dlg, IDC_KEYSERVER_LIST)); |
471 |
switch (LOWORD (wparam)) { |
switch (LOWORD (wparam)) { |
472 |
case IDC_KEYSERVER_PROXSETT: |
case IDC_KEYSERVER_PROXSETT: |
473 |
dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYSERVER_PROXY, |
dialog_box_param (glob_hinst, (LPCTSTR)IDD_WINPT_KEYSERVER_PROXY, |
474 |
dlg, keyserver_proxy_dlg_proc, 0, |
dlg, keyserver_proxy_dlg_proc, NULL, |
475 |
_("Proxy Settings"), IDS_WINPT_KEYSERVER_PROXY); |
_("Proxy Settings"), IDS_WINPT_KEYSERVER_PROXY); |
476 |
set_proxy (dlg); |
set_proxy (dlg); |
477 |
return TRUE; |
return TRUE; |