496 |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT, dlg, |
dialog_box_param (glob_hinst, (LPCSTR)IDD_WINPT_IMPORT, dlg, |
497 |
file_import_dlg_proc, (LPARAM)&fm_stat, |
file_import_dlg_proc, (LPARAM)&fm_stat, |
498 |
_("File Import"), IDS_WINPT_IMPORT); |
_("File Import"), IDS_WINPT_IMPORT); |
499 |
if (fm_stat.cancel == 1 ) { |
if (fm_stat.cancel == 1) { |
500 |
free_if_alloc (fm_stat.opaque); |
free_if_alloc (fm_stat.opaque); |
501 |
return WPTERR_GENERAL; |
return WPTERR_GENERAL; |
502 |
} |
} |
511 |
goto leave; |
goto leave; |
512 |
} |
} |
513 |
|
|
514 |
|
SetCursor (LoadCursor (NULL, IDC_WAIT)); |
515 |
err = gpgme_op_import (ctx, keydata); |
err = gpgme_op_import (ctx, keydata); |
516 |
|
SetCursor (LoadCursor (NULL, IDC_ARROW)); |
517 |
if (err) { |
if (err) { |
518 |
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
msg_box (dlg, gpgme_strerror (err), _("Key Manager"), MB_ERR); |
519 |
goto leave; |
goto leave; |
713 |
strncat (tmp, ".asc", sizeof tmp-200); |
strncat (tmp, ".asc", sizeof tmp-200); |
714 |
p = fm_quote_file (tmp); |
p = fm_quote_file (tmp); |
715 |
|
|
716 |
rc = gpgme_recipients_new( &rset ); |
rc = gpgme_recipients_new (&rset); |
717 |
if( !rc ) |
if (!rc) |
718 |
rc = gpgme_recipients_add_name( rset, keyid ); |
rc = gpgme_recipients_add_name (rset, keyid); |
719 |
if( !rc ) |
if (!rc) |
720 |
rc = gpgme_new( &ctx ); |
rc = gpgme_new (&ctx); |
721 |
if( !rc ) { |
if (!rc) { |
722 |
gpgme_set_armor (ctx, 1); |
gpgme_set_armor (ctx, 1); |
723 |
rc = gpgme_op_file_export( ctx, rset, p ); |
rc = gpgme_op_file_export (ctx, rset, p); |
724 |
} |
} |
725 |
if( rc ) |
if (rc) |
726 |
msg_box( dlg, gpgme_strerror( rc ), _("Key Manager"), MB_ERR ); |
msg_box (dlg, gpgme_strerror (rc), _("Key Manager"), MB_ERR); |
727 |
else |
else |
728 |
mapi_send_pubkey (keyid, tmp); |
mapi_send_pubkey (keyid, tmp); |
729 |
free_if_alloc( p ); |
|
730 |
gpgme_recipients_release( rset ); |
free_if_alloc (p); |
731 |
gpgme_release( ctx ); |
gpgme_recipients_release (rset); |
732 |
|
gpgme_release (ctx); |
733 |
return rc; |
return rc; |
734 |
#endif |
#endif |
735 |
return 0; |
return 0; |