]> git.pld-linux.org Git - packages/mutt.git/blob - mutt-crypt-autoselectkey.patch
- 1.5.21
[packages/mutt.git] / mutt-crypt-autoselectkey.patch
1 --- crypt-autoselectkey/PATCHES Dec 2002 17:44:54 -0000 3.6
2 +++ crypt-autoselectkey/PATCHES Feb 2004 13:19:46 -0000
3 @@ -0,0 +1 @@
4 +patch-1.5.6.dw.crypt-autoselectkey.1
5 --- crypt-autoselectkey/init.h Feb 2004 17:10:43 -0000  3.43
6 +++ crypt-autoselectkey/init.h Feb 2004 13:19:46 -0000
7 @@ -1205,2 +1205,12 @@ struct option_t MuttVars[] = {
8    */
9 +  
10 +
11 +  { "pgp_autoselectkey",       DT_SYN,  R_NONE, UL "crypt_autoselectkey", 0 },
12 +  { "crypt_autoselectkey",     DT_BOOL, R_NONE, OPTCRYPTAUTOSELECT, 0 },
13 +  /*
14 +  ** .pp
15 +  ** If set, then a list of keys is not presented for selection when only
16 +  ** one matching key is available.  This may be useful in conjunction with
17 +  ** the \fIcrypt-hook\fP command.
18 +  */
19    { "pgp_autosign",    DT_SYN,  R_NONE, UL "crypt_autosign", 0 },
20 --- crypt-autoselectkey/mutt.h Feb 2004 17:10:43 -0000  3.23
21 +++ crypt-autoselectkey/mutt.h Feb 2004 13:19:46 -0000
22 @@ -431,2 +431,3 @@ enum
23    
24 +  OPTCRYPTAUTOSELECT,
25    OPTCRYPTAUTOSIGN,
26 --- crypt-autoselectkey/pgpkey.c Oct 2003 19:55:39 -0000        3.8
27 +++ crypt-autoselectkey/pgpkey.c Feb 2004 13:19:46 -0000
28 @@ -437,4 +437,9 @@ static int pgp_id_matches_addr (ADDRESS 
29  
30 +
31 +#define pgp_trusted_id(uid) (!option(OPTPGPCHECKTRUST) \
32 +                            || (pgp_id_is_valid((uid)) \
33 +                                && pgp_id_is_strong((uid))))
34 +
35  static pgp_key_t pgp_select_key (pgp_key_t keys,
36 -                                 ADDRESS * p, const char *s)
37 +                                 ADDRESS * p, const char *s)
38  {
39 @@ -452,2 +457,3 @@ static pgp_key_t pgp_select_key (pgp_key
40  
41 +  int keymatch = 0;            /* count matching keys */
42    int unusable = 0;
43 @@ -481,2 +487,3 @@ static pgp_key_t pgp_select_key (pgp_key
44      }
45 +    keymatch++;
46    }
47 @@ -489,2 +496,17 @@ static pgp_key_t pgp_select_key (pgp_key
48    }
49 +  else if (keymatch == 1 && option(OPTCRYPTAUTOSELECT))
50 +  {
51 +    /*
52 +     * Only one matching key...see if there's an id with enough trust to auto-select
53 +     */
54 +    kp = KeyTable[0]->parent;
55 +    for (a = kp->address; a; a = a->next)
56 +    {
57 +      if (pgp_trusted_id(a))
58 +      {
59 +       safe_free ((void **) &KeyTable);
60 +       return (kp);
61 +      }
62 +    }
63 +  }
64  
65 @@ -599,5 +621,3 @@ static pgp_key_t pgp_select_key (pgp_key
66        
67 -      if (option (OPTPGPCHECKTRUST) &&
68 -         (!pgp_id_is_valid (KeyTable[menu->current])
69 -          || !pgp_id_is_strong (KeyTable[menu->current])))
70 +      if (!pgp_trusted_id(KeyTable[menu->current]))
71        {
This page took 0.033006 seconds and 3 git commands to generate.