Changeset 5434:677e7712d735

Show
Ignore:
Timestamp:
2008-06-29 01:09:33 (2 months ago)
Author:
Brendan Cully <brendan@…>
Branch:
HEAD
Message:

Improve gpgme SMIME uid display: align each line by the length of the first.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • crypt-gpgme.c

    r5433 r5434  
    12531253} 
    12541254 
    1255 static void print_smime_keyinfo (gpgme_signature_t sig, gpgme_key_t key, 
    1256                                  STATE *s) 
    1257 { 
     1255static void print_smime_keyinfo (const char* msg, gpgme_signature_t sig, 
     1256                                 gpgme_key_t key, STATE *s) 
     1257{ 
     1258  size_t msglen; 
    12581259  gpgme_user_id_t uids = NULL; 
    1259   int aka = 0; 
    1260  
     1260  int i, aka = 0; 
     1261 
     1262  state_attach_puts (msg, s); 
     1263  state_attach_puts (" ", s); 
    12611264  for (uids = key->uids; uids; uids = uids->next) 
    12621265  { 
     
    12641267      continue; 
    12651268    if (aka) 
    1266       state_attach_puts (_("                aka: "), s); 
     1269    { 
     1270      msglen = mutt_strlen (msg) - 4; 
     1271      for (i = 0; i < msglen; i++) 
     1272        state_attach_puts(" ", s); 
     1273      state_attach_puts(_("aka: "), s); 
     1274    } 
    12671275    state_attach_puts (uids->uid, s); 
    12681276    state_attach_puts ("\n", s); 
     
    12701278    aka = 1; 
    12711279  } 
    1272   state_attach_puts (_("            created: "), s); 
     1280 
     1281  msglen = mutt_strlen (msg) - 8; 
     1282  for (i = 0; i < msglen; i++) 
     1283    state_attach_puts(" ", s); 
     1284  state_attach_puts (_("created: "), s); 
    12731285  print_time (sig->timestamp, s); 
    12741286  state_attach_puts ("\n", s);   
     
    12881300  int i, anybad = 0, anywarn = 0; 
    12891301  unsigned int sum; 
    1290   gpgme_user_id_t uids = NULL; 
    12911302  gpgme_verify_result_t result; 
    12921303  gpgme_signature_t sig; 
     
    13431354      else if ((sum & GPGME_SIGSUM_GREEN)) 
    13441355      { 
    1345         state_attach_puts (_("Good signature from: "), s); 
    1346         print_smime_keyinfo (sig, key, s); 
    1347         state_attach_puts (_("            expires: "), s); 
    1348         print_time (sig->exp_timestamp, s); 
    1349         state_attach_puts ("\n", s); 
     1356        print_smime_keyinfo (_("Good signature from:"), sig, key, s); 
    13501357        if (show_sig_summary (sum, ctx, key, idx, s, sig)) 
    13511358          anywarn = 1; 
     
    13541361      else if ((sum & GPGME_SIGSUM_RED)) 
    13551362      { 
    1356         state_attach_puts (_("*BAD* signature claimed to be from: "), s); 
    1357         print_smime_keyinfo (sig, key, s); 
     1363        print_smime_keyinfo (_("*BAD* signature from:"), sig, key, s); 
    13581364        show_sig_summary (sum, ctx, key, idx, s, sig); 
    13591365      } 
    13601366      else if (!anybad && key && (key->protocol == GPGME_PROTOCOL_OpenPGP)) 
    1361         { /* We can't decide (yellow) but this is a PGP key with a good 
    1362              signature, so we display what a PGP user expects: The name, 
    1363              fingerprint and the key validity (which is neither fully or 
    1364              ultimate). */ 
    1365           state_attach_puts (_("Good signature from: "), s); 
    1366           state_attach_puts (uid, s); 
    1367           state_attach_puts ("\n", s); 
    1368           state_attach_puts (_("            created: "), s); 
    1369           print_time (sig->timestamp, s); 
    1370           state_attach_puts ("\n", s); 
    1371           show_one_sig_validity (ctx, idx, s); 
    1372           show_fingerprint (key,s); 
    1373           if (show_sig_summary (sum, ctx, key, idx, s, sig)) 
    1374             anywarn = 1; 
    1375         } 
     1367      { /* We can't decide (yellow) but this is a PGP key with a good 
     1368           signature, so we display what a PGP user expects: The name, 
     1369           fingerprint and the key validity (which is neither fully or 
     1370           ultimate). */ 
     1371        print_smime_keyinfo (_("Good signature from:"), sig, key, s); 
     1372        show_one_sig_validity (ctx, idx, s); 
     1373        show_fingerprint (key,s); 
     1374        if (show_sig_summary (sum, ctx, key, idx, s, sig)) 
     1375          anywarn = 1; 
     1376      } 
    13761377      else /* can't decide (yellow) */ 
    13771378      { 
    1378         state_attach_puts (_("Problem signature from: "), s); 
    1379         print_smime_keyinfo (sig, key, s); 
    1380         state_attach_puts (_("            expires: "), s); 
     1379        print_smime_keyinfo (_("Problem signature from:"), sig, key, s); 
     1380        state_attach_puts (_("               expires: "), s); 
    13811381        print_time (sig->exp_timestamp, s); 
    13821382        state_attach_puts ("\n", s);