]> git.pld-linux.org Git - packages/mutt.git/blame - mutt-crypt-autoselectkey.patch
- rediff patches
[packages/mutt.git] / mutt-crypt-autoselectkey.patch
CommitLineData
d26530dc
JR
1diff -urNp -x '*.orig' mutt-2.0.6.org/PATCHES mutt-2.0.6/PATCHES
2--- mutt-2.0.6.org/PATCHES 2021-04-18 19:23:38.550015388 +0200
3+++ mutt-2.0.6/PATCHES 2021-04-18 19:23:38.680017105 +0200
4@@ -1,2 +1,3 @@
1b2148c3 5+patch-1.5.6.dw.crypt-autoselectkey.1
d26530dc
JR
6 vvv.quote
7 patch-1.3.27.cd.signatures_menu.2.1
8diff -urNp -x '*.orig' mutt-2.0.6.org/init.h mutt-2.0.6/init.h
9--- mutt-2.0.6.org/init.h 2021-04-18 19:23:38.550015388 +0200
10+++ mutt-2.0.6/init.h 2021-04-18 19:23:38.680017105 +0200
11@@ -1203,6 +1203,16 @@ struct option_t MuttVars[] = {
12 ** For a full listing of defined \fCprintf(3)\fP-like sequences see
13 ** the section on $$index_format. See also $$attribution_locale.
1b2148c3
JB
14 */
15+
16+
8d013520 17+ { "pgp_autoselectkey", DT_SYN, R_NONE, {.p="crypt_autoselectkey"}, {.l=0} },
1b2148c3
JB
18+ { "crypt_autoselectkey", DT_BOOL, R_NONE, OPTCRYPTAUTOSELECT, 0 },
19+ /*
20+ ** .pp
21+ ** If set, then a list of keys is not presented for selection when only
22+ ** one matching key is available. This may be useful in conjunction with
23+ ** the \fIcrypt-hook\fP command.
24+ */
d26530dc
JR
25 /* L10N:
26 $forward_attribution_trailer default value
27 */
28diff -urNp -x '*.orig' mutt-2.0.6.org/mutt.h mutt-2.0.6/mutt.h
29--- mutt-2.0.6.org/mutt.h 2021-04-18 19:23:38.546682010 +0200
30+++ mutt-2.0.6/mutt.h 2021-04-18 19:23:38.680017105 +0200
31@@ -429,6 +429,7 @@ enum
32 #if defined(HAVE_QDBM) || defined(HAVE_TC) || defined(HAVE_KC)
33 OPTHCACHECOMPRESS,
34 #endif /* HAVE_QDBM */
1b2148c3 35+ OPTCRYPTAUTOSELECT,
d26530dc
JR
36 #endif
37 OPTHDRS,
38 OPTHEADER,
39diff -urNp -x '*.orig' mutt-2.0.6.org/pgpkey.c mutt-2.0.6/pgpkey.c
40--- mutt-2.0.6.org/pgpkey.c 2020-07-25 20:22:53.000000000 +0200
41+++ mutt-2.0.6/pgpkey.c 2021-04-18 19:23:38.680017105 +0200
42@@ -440,8 +440,13 @@ static int pgp_id_matches_addr (ADDRESS
43 return rv;
44 }
1b2148c3
JB
45
46+
47+#define pgp_trusted_id(uid) (!option(OPTPGPCHECKTRUST) \
48+ || (pgp_id_is_valid((uid)) \
49+ && pgp_id_is_strong((uid))))
50+
51 static pgp_key_t pgp_select_key (pgp_key_t keys,
52- ADDRESS * p, const char *s)
53+ ADDRESS * p, const char *s)
54 {
d26530dc
JR
55 int keymax;
56 pgp_uid_t **KeyTable;
57@@ -456,6 +461,7 @@ static pgp_key_t pgp_select_key (pgp_key
58 pgp_uid_t *a;
59 int (*f) (const void *, const void *);
1b2148c3
JB
60
61+ int keymatch = 0; /* count matching keys */
62 int unusable = 0;
d26530dc
JR
63
64 keymax = 0;
65@@ -485,6 +491,7 @@ static pgp_key_t pgp_select_key (pgp_key
66
67 KeyTable[i++] = a;
1b2148c3
JB
68 }
69+ keymatch++;
70 }
d26530dc
JR
71
72 if (!i && unusable)
73@@ -493,6 +500,21 @@ static pgp_key_t pgp_select_key (pgp_key
74 mutt_sleep (1);
75 return NULL;
1b2148c3
JB
76 }
77+ else if (keymatch == 1 && option(OPTCRYPTAUTOSELECT))
78+ {
79+ /*
80+ * Only one matching key...see if there's an id with enough trust to auto-select
81+ */
82+ kp = KeyTable[0]->parent;
83+ for (a = kp->address; a; a = a->next)
84+ {
85+ if (pgp_trusted_id(a))
86+ {
87+ safe_free ((void **) &KeyTable);
88+ return (kp);
89+ }
90+ }
91+ }
92
d26530dc
JR
93 switch (PgpSortKeys & SORT_MASK)
94 {
95@@ -609,9 +631,7 @@ static pgp_key_t pgp_select_key (pgp_key
96 break;
97 }
98
458d46c4
AG
99- if (option (OPTPGPCHECKTRUST) &&
100- (!pgp_id_is_valid (KeyTable[menu->current])
101- || !pgp_id_is_strong (KeyTable[menu->current])))
1b2148c3 102+ if (!pgp_trusted_id(KeyTable[menu->current]))
458d46c4 103 {
d26530dc
JR
104 char *s = "";
105 char buff[LONG_STRING];
This page took 0.110774 seconds and 4 git commands to generate.