* pkclist.c (build_pk_list): Keystrify.
authorDavid Shaw <dshaw@jabberwocky.com>
Thu, 7 Oct 2004 21:14:31 +0000 (21:14 +0000)
committerDavid Shaw <dshaw@jabberwocky.com>
Thu, 7 Oct 2004 21:14:31 +0000 (21:14 +0000)
* mainproc.c (check_sig_and_print), pkclist.c (do_edit_ownertrust):
Improve translatability of user ID prompts.

g10/ChangeLog
g10/mainproc.c
g10/pkclist.c

index 4724344..c506f21 100644 (file)
@@ -1,3 +1,10 @@
+2004-10-07  David Shaw  <dshaw@jabberwocky.com>
+
+       * 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  <dshaw@jabberwocky.com>
 
        * helptext.c, pkclist.c (do_we_trust): It is not possible to get
index 3a36b18..a1daa9c 100644 (file)
@@ -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 );
+           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
+             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));
+             fprintf(log_stream()," [%s]\n",trust_value_to_string(valid));
            else
-             fputs("\"\n", log_stream() );
+             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 );
index 5f4e304..e8e0b86 100644 (file)
@@ -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)