431 |
} |
} |
432 |
|
|
433 |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT, dlg, |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT, dlg, |
434 |
clip_import_dlg_proc, NULL, |
clip_import_dlg_proc, 0, |
435 |
_("Key Import"), IDS_WINPT_IMPORT); |
_("Key Import"), IDS_WINPT_IMPORT); |
436 |
|
|
437 |
return 0; |
return 0; |
688 |
} /* km_send_to_keyserver */ |
} /* km_send_to_keyserver */ |
689 |
|
|
690 |
|
|
691 |
|
/* Send the selected key in @lv via MAPI to a mail recipient. */ |
692 |
int |
int |
693 |
km_send_to_mail_recipient( listview_ctrl_t lv, HWND dlg ) |
km_send_to_mail_recipient (listview_ctrl_t lv, HWND dlg) |
694 |
{ |
{ |
|
#if 0 /*FIXME*/ |
|
695 |
gpgme_key_t key; |
gpgme_key_t key; |
696 |
gpgme_ctx_t ctx=NULL; |
gpgme_ctx_t ctx=NULL; |
697 |
gpgme_recipients_t rset=NULL; |
gpgme_data_t out; |
698 |
gpgme_error_t rc; |
gpgme_error_t rc; |
699 |
const char * s; |
const char *s; |
700 |
char keyid[32], tmp[192+256], * p =NULL; |
char keyid[32], tmp[192+256]; |
701 |
int pos; |
int pos; |
702 |
|
|
703 |
if( listview_count_items( lv, 1 ) > 1 ) { |
if (listview_count_items (lv, 1 ) > 1) { |
704 |
msg_box( dlg, _("Please only select one key."), _("Key Manager"), MB_INFO|MB_OK ); |
msg_box (dlg, _("Please only select one key."), |
705 |
|
_("Key Manager"), MB_INFO|MB_OK); |
706 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
707 |
} |
} |
708 |
pos = listview_get_curr_pos( lv ); |
pos = listview_get_curr_pos (lv); |
709 |
if( pos == -1 ) { |
if (pos == -1) { |
710 |
msg_box( dlg, _("Please select a key."), _("Key Manager"), MB_ERR ); |
msg_box (dlg, _("Please select a key."), _("Key Manager"), MB_ERR); |
711 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
712 |
} |
} |
713 |
listview_get_item_text( lv, pos, 1, keyid, sizeof keyid-1 ); |
listview_get_item_text(lv, pos, 1, keyid, sizeof keyid-1); |
714 |
if( get_pubkey( keyid, &key ) ) |
if (get_pubkey (keyid, &key)) |
715 |
BUG( NULL ); |
BUG (NULL); |
716 |
s = key->uids->name; |
s = key->uids->name; |
717 |
GetTempPath (sizeof tmp-1, tmp); |
GetTempPath (sizeof tmp-1, tmp); |
718 |
strncat (tmp, s, sizeof tmp-200); |
strncat (tmp, s, sizeof tmp-200); |
719 |
strncat (tmp, ".asc", sizeof tmp-200); |
strncat (tmp, ".asc", sizeof tmp-200); |
|
p = fm_quote_file (tmp); |
|
720 |
|
|
721 |
rc = gpgme_recipients_new (&rset); |
rc = gpgme_new (&ctx); |
722 |
if (!rc) |
if (rc) |
723 |
rc = gpgme_recipients_add_name (rset, keyid); |
BUG (NULL); |
724 |
if (!rc) |
rc = gpgme_data_new (&out); |
725 |
rc = gpgme_new (&ctx); |
if (rc) |
726 |
if (!rc) { |
BUG (NULL); |
727 |
gpgme_set_armor (ctx, 1); |
|
728 |
rc = gpgme_op_file_export (ctx, rset, p); |
gpgme_set_armor (ctx, 1); |
729 |
} |
rc = gpgme_op_export (ctx, key->subkeys->keyid, 0, out); |
730 |
if (rc) |
if (rc) |
731 |
msg_box (dlg, gpgme_strerror (rc), _("Key Manager"), MB_ERR); |
msg_box (dlg, gpgme_strerror (rc), _("Key Manager"), MB_ERR); |
732 |
else |
else |
733 |
mapi_send_pubkey (keyid, tmp); |
mapi_send_pubkey (keyid, tmp); |
734 |
|
|
735 |
free_if_alloc (p); |
gpg_data_release_and_set_file (out, tmp); |
|
gpgme_recipients_release (rset); |
|
736 |
gpgme_release (ctx); |
gpgme_release (ctx); |
737 |
return rc; |
return rc; |
|
#endif |
|
|
return 0; |
|
738 |
} |
} |
739 |
|
|
740 |
|
|