From 4737923d564bc24870432bcf53542ba87f70068b Mon Sep 17 00:00:00 2001 From: David Shaw Date: Thu, 7 Oct 2004 21:14:31 +0000 Subject: [PATCH] * pkclist.c (build_pk_list): Keystrify. * mainproc.c (check_sig_and_print), pkclist.c (do_edit_ownertrust): Improve translatability of user ID prompts. --- g10/ChangeLog | 7 ++++++ g10/mainproc.c | 65 ++++++++++++++++++++++++++++++++------------------ g10/pkclist.c | 19 +++++++-------- 3 files changed, 57 insertions(+), 34 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 47243443b..c506f217e 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,10 @@ +2004-10-07 David Shaw + + * pkclist.c (build_pk_list): Keystrify. + + * mainproc.c (check_sig_and_print), pkclist.c + (do_edit_ownertrust): Improve translatability of user ID prompts. + 2004-10-06 David Shaw * helptext.c, pkclist.c (do_we_trust): It is not possible to get diff --git a/g10/mainproc.c b/g10/mainproc.c index 3a36b186b..a1daa9c04 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1442,6 +1442,7 @@ check_sig_and_print( CTX c, KBNODE node ) /* find and print the primary user ID */ for( un=keyblock; un; un = un->next ) { + char *p; int valid; if(un->pkt->pkttype==PKT_PUBLIC_KEY) { @@ -1475,19 +1476,28 @@ check_sig_and_print( CTX c, KBNODE node ) un->pkt->pkt.user_id->len, -1 ); - log_info(rc? _("BAD signature from \"") - : sig->flags.expired ? _("Expired signature from \"") - : _("Good signature from \"")); - print_utf8_string( log_stream(), un->pkt->pkt.user_id->name, - un->pkt->pkt.user_id->len ); - if(opt.verify_options&VERIFY_SHOW_VALIDITY) - fprintf(log_stream(),"\" [%s]\n",trust_value_to_string(valid)); + p=utf8_to_native(un->pkt->pkt.user_id->name, + un->pkt->pkt.user_id->len,0); + + if(rc) + log_info(_("BAD signature from \"%s\""),p); + else if(sig->flags.expired) + log_info(_("Expired signature from \"%s\""),p); else - fputs("\"\n", log_stream() ); + log_info(_("Good signature from \"%s\""),p); + + m_free(p); + + if(opt.verify_options&VERIFY_SHOW_VALIDITY) + fprintf(log_stream()," [%s]\n",trust_value_to_string(valid)); + else + fputs("\n", log_stream() ); count++; } if( !count ) { /* just in case that we have no valid textual userid */ + char *p; + /* Try for an invalid textual userid */ for( un=keyblock; un; un = un->next ) { if( un->pkt->pkttype == PKT_USER_ID && @@ -1511,22 +1521,30 @@ check_sig_and_print( CTX c, KBNODE node ) un? un->pkt->pkt.user_id->len:3, -1 ); - log_info(rc? _("BAD signature from \"") - : sig->flags.expired ? _("Expired signature from \"") - : _("Good signature from \"")); - if (opt.trust_model!=TM_ALWAYS && un) { - fputs(_("[uncertain]"), log_stream() ); + if(un) + p=utf8_to_native(un->pkt->pkt.user_id->name, + un->pkt->pkt.user_id->len,0); + else + p=m_strdup("[?]"); + + if(rc) + log_info(_("BAD signature from \"%s\""),p); + else if(sig->flags.expired) + log_info(_("Expired signature from \"%s\""),p); + else + log_info(_("Good signature from \"%s\""),p); + if (opt.trust_model!=TM_ALWAYS && un) + { putc(' ', log_stream() ); - } - print_utf8_string( log_stream(), - un? un->pkt->pkt.user_id->name:"[?]", - un? un->pkt->pkt.user_id->len:3 ); - fputs("\"\n", log_stream() ); + fputs(_("[uncertain]"), log_stream() ); + } + fputs("\n", log_stream() ); } /* If we have a good signature and already printed * the primary user ID, print all the other user IDs */ if ( count && !rc ) { + char *p; for( un=keyblock; un; un = un->next ) { if( un->pkt->pkttype != PKT_USER_ID ) continue; @@ -1548,9 +1566,10 @@ check_sig_and_print( CTX c, KBNODE node ) un->pkt->pkt.user_id->numattribs,pk,NULL); } - log_info( _(" aka \"")); - print_utf8_string( log_stream(), un->pkt->pkt.user_id->name, - un->pkt->pkt.user_id->len ); + p=utf8_to_native(un->pkt->pkt.user_id->name, + un->pkt->pkt.user_id->len,0); + log_info(_(" aka \"%s\""),p); + m_free(p); if(opt.verify_options&VERIFY_SHOW_VALIDITY) { @@ -1563,10 +1582,10 @@ check_sig_and_print( CTX c, KBNODE node ) valid=trust_value_to_string(get_validity(pk, un->pkt-> pkt.user_id)); - fprintf(log_stream(),"\" [%s]\n",valid); + fprintf(log_stream()," [%s]\n",valid); } else - fputs("\"\n", log_stream() ); + fputs("\n", log_stream() ); } } release_kbnode( keyblock ); diff --git a/g10/pkclist.c b/g10/pkclist.c index 5f4e30436..e8e0b86ae 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -171,7 +171,6 @@ do_edit_ownertrust (PKT_public_key *pk, int mode, unsigned *new_trust, int defer_help ) { char *p; - size_t n; u32 keyid[2]; int changed=0; int quit=0; @@ -204,11 +203,9 @@ do_edit_ownertrust (PKT_public_key *pk, int mode, tty_printf("%4u%c/%s %s\n",nbits_from_pk( pk ), pubkey_letter( pk->pubkey_algo ), keystr(keyid), datestr_from_pk( pk ) ); - tty_printf(_(" \"")); - p = get_user_id( keyid, &n ); - tty_print_utf8_string( p, n ); + p=get_user_id_native(keyid); + tty_printf(_(" \"%s\"\n"),p); m_free(p); - tty_printf("\"\n"); keyblock = get_pubkeyblock (keyid); if (!keyblock) @@ -231,10 +228,10 @@ do_edit_ownertrust (PKT_public_key *pk, int mode, show_photos(un->pkt->pkt.user_id->attribs, un->pkt->pkt.user_id->numattribs,pk,NULL); - tty_printf(_(" aka \"")); - tty_print_utf8_string (un->pkt->pkt.user_id->name, - un->pkt->pkt.user_id->len ); - tty_printf("\"\n"); + p=utf8_to_native(un->pkt->pkt.user_id->name, + un->pkt->pkt.user_id->len,0); + + tty_printf(_(" aka \"%s\"\n"),p); } print_fingerprint (pk, NULL, 2); @@ -785,10 +782,10 @@ build_pk_list( STRLIST rcpts, PK_LIST *ret_pk_list, unsigned use ) u32 keyid[2]; keyid_from_pk(iter->pk,keyid); - tty_printf("%4u%c/%08lX %s \"", + tty_printf("%4u%c/%s %s \"", nbits_from_pk(iter->pk), pubkey_letter(iter->pk->pubkey_algo), - (ulong)keyid[1], + keystr(keyid), datestr_from_pk(iter->pk)); if(iter->pk->user_id)