NeoMutt  2022-04-29-247-gc6aae8
Teaching an old dog new tricks
DOXYGEN
dlg_pgp.c
Go to the documentation of this file.
1
68#include "config.h"
69#include <ctype.h>
70#include <locale.h>
71#include <stdbool.h>
72#include <stdint.h>
73#include <stdio.h>
74#include <stdlib.h>
75#include "private.h"
76#include "mutt/lib.h"
77#include "address/lib.h"
78#include "config/lib.h"
79#include "core/lib.h"
80#include "gui/lib.h"
81#include "lib.h"
82#include "menu/lib.h"
83#include "format_flags.h"
84#include "keymap.h"
85#include "mutt_logging.h"
86#include "muttlib.h"
87#include "opcodes.h"
88#include "pgp.h"
89#include "pgp_functions.h"
90#include "pgpkey.h"
91#include "pgplib.h"
92
94static const struct Mapping PgpHelp[] = {
95 // clang-format off
96 { N_("Exit"), OP_EXIT },
97 { N_("Select"), OP_GENERIC_SELECT_ENTRY },
98 { N_("Check key"), OP_VERIFY_KEY },
99 { N_("Help"), OP_HELP },
100 { NULL, 0 },
101 // clang-format on
102};
103
108{
109 size_t num;
110 struct PgpUid *uid;
111};
112
113static const char trust_flags[] = "?- +";
114
123static int pgp_compare_key_address(const void *a, const void *b)
124{
125 struct PgpUid const *const *s = (struct PgpUid const *const *) a;
126 struct PgpUid const *const *t = (struct PgpUid const *const *) b;
127
128 int r = mutt_istr_cmp((*s)->addr, (*t)->addr);
129 if (r != 0)
130 return (r > 0);
131
132 return mutt_istr_cmp(pgp_fpr_or_lkeyid((*s)->parent), pgp_fpr_or_lkeyid((*t)->parent)) > 0;
133}
134
143static int pgp_compare_address_qsort(const void *a, const void *b)
144{
145 const short c_pgp_sort_keys = cs_subset_sort(NeoMutt->sub, "pgp_sort_keys");
146 return (c_pgp_sort_keys & SORT_REVERSE) ? !pgp_compare_key_address(a, b) :
148}
149
158static int pgp_compare_key_date(const void *a, const void *b)
159{
160 struct PgpUid const *const *s = (struct PgpUid const *const *) a;
161 struct PgpUid const *const *t = (struct PgpUid const *const *) b;
162
163 int r = ((*s)->parent->gen_time - (*t)->parent->gen_time);
164 if (r != 0)
165 return r > 0;
166 return mutt_istr_cmp((*s)->addr, (*t)->addr) > 0;
167}
168
177static int pgp_compare_date_qsort(const void *a, const void *b)
178{
179 const short c_pgp_sort_keys = cs_subset_sort(NeoMutt->sub, "pgp_sort_keys");
180 return (c_pgp_sort_keys & SORT_REVERSE) ? !pgp_compare_key_date(a, b) :
182}
183
192static int pgp_compare_keyid(const void *a, const void *b)
193{
194 struct PgpUid const *const *s = (struct PgpUid const *const *) a;
195 struct PgpUid const *const *t = (struct PgpUid const *const *) b;
196
197 int r = mutt_istr_cmp(pgp_fpr_or_lkeyid((*s)->parent), pgp_fpr_or_lkeyid((*t)->parent));
198 if (r != 0)
199 return (r > 0);
200 return mutt_istr_cmp((*s)->addr, (*t)->addr) > 0;
201}
202
211static int pgp_compare_keyid_qsort(const void *a, const void *b)
212{
213 const short c_pgp_sort_keys = cs_subset_sort(NeoMutt->sub, "pgp_sort_keys");
214 return (c_pgp_sort_keys & SORT_REVERSE) ? !pgp_compare_keyid(a, b) :
215 pgp_compare_keyid(a, b);
216}
217
229static int pgp_compare_key_trust(const void *a, const void *b)
230{
231 struct PgpUid const *const *s = (struct PgpUid const *const *) a;
232 struct PgpUid const *const *t = (struct PgpUid const *const *) b;
233
234 int r = (((*s)->parent->flags & KEYFLAG_RESTRICTIONS) -
235 ((*t)->parent->flags & KEYFLAG_RESTRICTIONS));
236 if (r != 0)
237 return r > 0;
238 r = ((*s)->trust - (*t)->trust);
239 if (r != 0)
240 return r < 0;
241 r = ((*s)->parent->keylen - (*t)->parent->keylen);
242 if (r != 0)
243 return r < 0;
244 r = ((*s)->parent->gen_time - (*t)->parent->gen_time);
245 if (r != 0)
246 return r < 0;
247 r = mutt_istr_cmp((*s)->addr, (*t)->addr);
248 if (r != 0)
249 return r > 0;
250 return mutt_istr_cmp(pgp_fpr_or_lkeyid((*s)->parent), pgp_fpr_or_lkeyid((*t)->parent)) > 0;
251}
252
261static int pgp_compare_trust_qsort(const void *a, const void *b)
262{
263 const short c_pgp_sort_keys = cs_subset_sort(NeoMutt->sub, "pgp_sort_keys");
264 return (c_pgp_sort_keys & SORT_REVERSE) ? !pgp_compare_key_trust(a, b) :
266}
267
276{
277 static char buf[3];
278
279 if (!(flags & KEYFLAG_CANENCRYPT))
280 buf[0] = '-';
281 else if (flags & KEYFLAG_PREFER_SIGNING)
282 buf[0] = '.';
283 else
284 buf[0] = 'e';
285
286 if (!(flags & KEYFLAG_CANSIGN))
287 buf[1] = '-';
289 buf[1] = '.';
290 else
291 buf[1] = 's';
292
293 buf[2] = '\0';
294
295 return buf;
296}
297
304{
306 return 'R';
308 return 'X';
310 return 'd';
312 return 'c';
313
314 return ' ';
315}
316
339static const char *pgp_entry_format_str(char *buf, size_t buflen, size_t col, int cols,
340 char op, const char *src, const char *prec,
341 const char *if_str, const char *else_str,
342 intptr_t data, MuttFormatFlags flags)
343{
344 char fmt[128] = { 0 };
345 bool optional = (flags & MUTT_FORMAT_OPTIONAL);
346
347 struct PgpEntry *entry = (struct PgpEntry *) data;
348 struct PgpUid *uid = entry->uid;
349 struct PgpKeyInfo *key = uid->parent;
350 struct PgpKeyInfo *pkey = pgp_principal_key(key);
351
352 if (isupper((unsigned char) op))
353 key = pkey;
354
355 KeyFlags kflags = key->flags | (pkey->flags & KEYFLAG_RESTRICTIONS) | uid->flags;
356
357 switch (tolower(op))
358 {
359 case 'a':
360 if (!optional)
361 {
362 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
363 snprintf(buf, buflen, fmt, key->algorithm);
364 }
365 break;
366 case 'c':
367 if (!optional)
368 {
369 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
370 snprintf(buf, buflen, fmt, pgp_key_abilities(kflags));
371 }
372 else if (!(kflags & KEYFLAG_ABILITIES))
373 optional = false;
374 break;
375 case 'f':
376 if (!optional)
377 {
378 snprintf(fmt, sizeof(fmt), "%%%sc", prec);
379 snprintf(buf, buflen, fmt, pgp_flags(kflags));
380 }
381 else if (!(kflags & KEYFLAG_RESTRICTIONS))
382 optional = false;
383 break;
384 case 'k':
385 if (!optional)
386 {
387 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
388 snprintf(buf, buflen, fmt, pgp_this_keyid(key));
389 }
390 break;
391 case 'l':
392 if (!optional)
393 {
394 snprintf(fmt, sizeof(fmt), "%%%sd", prec);
395 snprintf(buf, buflen, fmt, key->keylen);
396 }
397 break;
398 case 'n':
399 if (!optional)
400 {
401 snprintf(fmt, sizeof(fmt), "%%%sd", prec);
402 snprintf(buf, buflen, fmt, entry->num);
403 }
404 break;
405 case 't':
406 if (!optional)
407 {
408 snprintf(fmt, sizeof(fmt), "%%%sc", prec);
409 snprintf(buf, buflen, fmt, trust_flags[uid->trust & 0x03]);
410 }
411 else if (!(uid->trust & 0x03))
412 {
413 /* undefined trust */
414 optional = false;
415 }
416 break;
417 case 'u':
418 if (!optional)
419 {
420 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
421 snprintf(buf, buflen, fmt, NONULL(uid->addr));
422 }
423 break;
424 case '[':
425
426 {
427 char buf2[128];
428 bool do_locales = true;
429 size_t len;
430
431 char *p = buf;
432
433 const char *cp = src;
434 if (*cp == '!')
435 {
436 do_locales = false;
437 cp++;
438 }
439
440 len = buflen - 1;
441 while ((len > 0) && (*cp != ']'))
442 {
443 if (*cp == '%')
444 {
445 cp++;
446 if (len >= 2)
447 {
448 *p++ = '%';
449 *p++ = *cp;
450 len -= 2;
451 }
452 else
453 break; /* not enough space */
454 cp++;
455 }
456 else
457 {
458 *p++ = *cp++;
459 len--;
460 }
461 }
462 *p = '\0';
463
464 if (!do_locales)
465 setlocale(LC_TIME, "C");
466 mutt_date_localtime_format(buf2, sizeof(buf2), buf, key->gen_time);
467 if (!do_locales)
468 setlocale(LC_TIME, "");
469
470 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
471 snprintf(buf, buflen, fmt, buf2);
472 if (len > 0)
473 src = cp + 1;
474 break;
475 }
476 default:
477 *buf = '\0';
478 }
479
480 if (optional)
481 {
482 mutt_expando_format(buf, buflen, col, cols, if_str, pgp_entry_format_str,
484 }
485 else if (flags & MUTT_FORMAT_OPTIONAL)
486 {
487 mutt_expando_format(buf, buflen, col, cols, else_str, pgp_entry_format_str,
489 }
490
491 /* We return the format string, unchanged */
492 return src;
493}
494
500static void pgp_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
501{
502 struct PgpUid **key_table = menu->mdata;
503 struct PgpEntry entry;
504
505 entry.uid = key_table[line];
506 entry.num = line + 1;
507
508 const char *const c_pgp_entry_format = cs_subset_string(NeoMutt->sub, "pgp_entry_format");
509 mutt_expando_format(buf, buflen, 0, menu->win->state.cols,
510 NONULL(c_pgp_entry_format), pgp_entry_format_str,
511 (intptr_t) &entry, MUTT_FORMAT_ARROWCURSOR);
512}
513
519static void pgp_key_table_free(struct Menu *menu, void **ptr)
520{
521 FREE(ptr);
522}
523
528{
529 if (nc->event_type != NT_CONFIG)
530 return 0;
531 if (!nc->global_data || !nc->event_data)
532 return -1;
533
534 struct EventConfig *ev_c = nc->event_data;
535
536 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
537 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
538 {
539 return 0;
540 }
541
542 struct Menu *menu = nc->global_data;
544 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
545
546 return 0;
547}
548
557{
558 if (nc->event_type != NT_WINDOW)
559 return 0;
560 if (!nc->global_data || !nc->event_data)
561 return -1;
563 return 0;
564
565 struct MuttWindow *win_menu = nc->global_data;
566 struct EventWindow *ev_w = nc->event_data;
567 if (ev_w->win != win_menu)
568 return 0;
569
570 struct Menu *menu = win_menu->wdata;
571
574
575 mutt_debug(LL_DEBUG5, "window delete done\n");
576 return 0;
577}
578
587 struct Address *p, const char *s)
588{
589 struct PgpUid **key_table = NULL;
590 struct Menu *menu = NULL;
591 char buf[1024] = { 0 };
592 struct PgpUid *a = NULL;
593 bool unusable = false;
594 int keymax = 0;
595
596 const bool c_pgp_show_unusable = cs_subset_bool(NeoMutt->sub, "pgp_show_unusable");
597 int i = 0;
598 for (struct PgpKeyInfo *kp = keys; kp; kp = kp->next)
599 {
600 if (!c_pgp_show_unusable && (kp->flags & KEYFLAG_CANTUSE))
601 {
602 unusable = true;
603 continue;
604 }
605
606 for (a = kp->address; a; a = a->next)
607 {
608 if (!c_pgp_show_unusable && (a->flags & KEYFLAG_CANTUSE))
609 {
610 unusable = true;
611 continue;
612 }
613
614 if (i == keymax)
615 {
616 keymax += 5;
617 mutt_mem_realloc(&key_table, sizeof(struct PgpUid *) * keymax);
618 }
619
620 key_table[i++] = a;
621 }
622 }
623
624 if ((i == 0) && unusable)
625 {
626 mutt_error(_("All matching keys are expired, revoked, or disabled"));
627 return NULL;
628 }
629
630 int (*f)(const void *, const void *);
631 const short c_pgp_sort_keys = cs_subset_sort(NeoMutt->sub, "pgp_sort_keys");
632 switch (c_pgp_sort_keys & SORT_MASK)
633 {
634 case SORT_ADDRESS:
636 break;
637 case SORT_DATE:
639 break;
640 case SORT_KEYID:
642 break;
643 case SORT_TRUST:
644 default:
646 break;
647 }
648 qsort(key_table, i, sizeof(struct PgpUid *), f);
649
651
652 menu = dlg->wdata;
653 menu->max = i;
655 menu->mdata = key_table;
657
658 struct PgpData pd = { false, menu, key_table, NULL };
659 dlg->wdata = &pd;
660
661 // NT_COLOR is handled by the SimpleDialog
664
665 if (p)
666 snprintf(buf, sizeof(buf), _("PGP keys matching <%s>"), p->mailbox);
667 else
668 snprintf(buf, sizeof(buf), _("PGP keys matching \"%s\""), s);
669
670 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
671 sbar_set_title(sbar, buf);
672
674
675 // ---------------------------------------------------------------------------
676 // Event Loop
677 int op = OP_NULL;
678 do
679 {
680 menu_tagging_dispatcher(menu->win, op);
681 window_redraw(NULL);
682
683 op = km_dokey(MENU_PGP);
684 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
685 if (op < 0)
686 continue;
687 if (op == OP_NULL)
688 {
690 continue;
691 }
693
694 int rc = pgp_function_dispatcher(dlg, op);
695
696 if (rc == FR_UNKNOWN)
697 rc = menu_function_dispatcher(menu->win, op);
698 if (rc == FR_UNKNOWN)
699 rc = global_function_dispatcher(NULL, op);
700 } while (!pd.done);
701 // ---------------------------------------------------------------------------
702
703 simple_dialog_free(&dlg);
704 return pd.key;
705}
Email Address Handling.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:317
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:292
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Definition: date.c:692
@ FR_UNKNOWN
Unknown function.
Definition: dispatcher.h:33
static int pgp_compare_address_qsort(const void *a, const void *b)
Compare the addresses of two PGP keys.
Definition: dlg_pgp.c:143
static int pgp_compare_key_date(const void *a, const void *b)
Compare Key dates for sorting.
Definition: dlg_pgp.c:158
static int pgp_compare_keyid_qsort(const void *a, const void *b)
Compare key IDs.
Definition: dlg_pgp.c:211
static int pgp_compare_date_qsort(const void *a, const void *b)
Compare the dates of two PGP keys.
Definition: dlg_pgp.c:177
static const char trust_flags[]
Definition: dlg_pgp.c:113
struct PgpKeyInfo * dlg_select_pgp_key(struct PgpKeyInfo *keys, struct Address *p, const char *s)
Let the user select a key to use.
Definition: dlg_pgp.c:586
static int pgp_compare_keyid(const void *a, const void *b)
Compare Key IDs and addresses for sorting.
Definition: dlg_pgp.c:192
static int pgp_compare_key_trust(const void *a, const void *b)
Compare the trust of keys for sorting.
Definition: dlg_pgp.c:229
static char pgp_flags(KeyFlags flags)
Turn PGP key flags into a string.
Definition: dlg_pgp.c:303
static int pgp_compare_trust_qsort(const void *a, const void *b)
Compare the trust levels of two PGP keys.
Definition: dlg_pgp.c:261
static const struct Mapping PgpHelp[]
Help Bar for the PGP key selection dialog.
Definition: dlg_pgp.c:94
static char * pgp_key_abilities(KeyFlags flags)
Turn PGP key abilities into a string.
Definition: dlg_pgp.c:275
static int pgp_compare_key_address(const void *a, const void *b)
Compare Key addresses and IDs for sorting.
Definition: dlg_pgp.c:123
Flags to control mutt_expando_format()
#define MUTT_FORMAT_NO_FLAGS
No flags are set.
Definition: format_flags.h:30
#define MUTT_FORMAT_OPTIONAL
Allow optional field processing.
Definition: format_flags.h:33
#define MUTT_FORMAT_ARROWCURSOR
Reserve space for arrow_cursor.
Definition: format_flags.h:35
uint8_t MuttFormatFlags
Flags for mutt_expando_format(), e.g. MUTT_FORMAT_FORCESUBJ.
Definition: format_flags.h:29
int menu_tagging_dispatcher(struct MuttWindow *win, int op)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
Definition: tagging.c:223
int pgp_function_dispatcher(struct MuttWindow *win, int op)
Perform a Pgp function - Implements function_dispatcher_t -.
int global_function_dispatcher(struct MuttWindow *win, int op)
Perform a Global function - Implements function_dispatcher_t -.
Definition: global.c:164
int menu_function_dispatcher(struct MuttWindow *win, int op)
Perform a Menu function - Implements function_dispatcher_t -.
Definition: functions.c:320
static const char * pgp_entry_format_str(char *buf, size_t buflen, size_t col, int cols, char op, const char *src, const char *prec, const char *if_str, const char *else_str, intptr_t data, MuttFormatFlags flags)
Format an entry on the PGP key selection menu - Implements format_t -.
Definition: dlg_pgp.c:339
void mutt_expando_format(char *buf, size_t buflen, size_t col, int cols, const char *src, format_t callback, intptr_t data, MuttFormatFlags flags)
Expand expandos (x) in a string -.
Definition: muttlib.c:777
#define mutt_error(...)
Definition: logging.h:87
#define mutt_debug(LEVEL,...)
Definition: logging.h:84
static void pgp_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a menu item for the pgp key list - Implements Menu::make_entry() -.
Definition: dlg_pgp.c:500
static void pgp_key_table_free(struct Menu *menu, void **ptr)
Free the key table - Implements Menu::mdata_free() -.
Definition: dlg_pgp.c:519
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pgp.c:556
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pgp.c:527
Convenience wrapper for the gui headers.
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
Definition: simple.c:166
struct MuttWindow * simple_dialog_new(enum MenuType mtype, enum WindowType wtype, const struct Mapping *help_data)
Create a simple index Dialog.
Definition: simple.c:129
int km_dokey(enum MenuType mtype)
Determine what a keypress should do.
Definition: keymap.c:795
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: keymap.c:1061
Manage keymappings.
@ LL_DEBUG5
Log at debug level 5.
Definition: logging.h:44
@ LL_DEBUG1
Log at debug level 1.
Definition: logging.h:40
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
Definition: memory.c:114
#define FREE(x)
Definition: memory.h:43
GUI present the user with a selectable list.
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:59
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:178
Convenience wrapper for the library headers.
#define N_(a)
Definition: message.h:32
#define _(a)
Definition: message.h:28
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
Definition: notify.c:228
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
Definition: notify.c:189
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:483
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:807
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:74
NeoMutt Logging.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:604
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:522
@ WT_DLG_PGP
Pgp Dialog, dlg_select_pgp_key()
Definition: mutt_window.h:88
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
Definition: mutt_window.h:102
@ NT_WINDOW_DELETE
Window is about to be deleted.
Definition: mutt_window.h:206
Some miscellaneous functions.
#define KEYFLAG_EXPIRED
Key is expired.
Definition: lib.h:131
uint16_t KeyFlags
Flags describing PGP/SMIME keys, e.g. KEYFLAG_CANSIGN.
Definition: lib.h:125
#define KEYFLAG_RESTRICTIONS
Definition: lib.h:140
#define KEYFLAG_ABILITIES
Definition: lib.h:142
#define KEYFLAG_CANENCRYPT
Key is suitable for encryption.
Definition: lib.h:128
#define KEYFLAG_CANTUSE
Definition: lib.h:139
#define KEYFLAG_PREFER_SIGNING
Key's owner prefers signing.
Definition: lib.h:137
#define KEYFLAG_CRITICAL
Key is marked critical.
Definition: lib.h:135
#define KEYFLAG_DISABLED
Key is marked disabled.
Definition: lib.h:133
#define KEYFLAG_REVOKED
Key is revoked.
Definition: lib.h:132
#define KEYFLAG_PREFER_ENCRYPTION
Key's owner prefers encryption.
Definition: lib.h:136
#define KEYFLAG_CANSIGN
Key is suitable for signing.
Definition: lib.h:127
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:55
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Definition: notify_type.h:43
const char * opcodes_get_name(int op)
Get the name of an opcode.
Definition: opcodes.c:46
All user-callable functions.
char * pgp_this_keyid(struct PgpKeyInfo *k)
Get the ID of this key.
Definition: pgp.c:191
char * pgp_fpr_or_lkeyid(struct PgpKeyInfo *k)
Get the fingerprint or long keyid.
Definition: pgp.c:234
PGP sign, encrypt, check routines.
Pgp functions.
struct PgpKeyInfo * pgp_principal_key(struct PgpKeyInfo *key)
Get the main (parent) PGP key.
Definition: pgpkey.c:89
PGP key management routines.
Misc PGP helper routines.
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
Definition: sbar.c:224
GUI display the mailboxes in a side panel.
#define SORT_MASK
Mask for the sort id.
Definition: sort2.h:78
@ SORT_TRUST
Sort by encryption key's trust level.
Definition: sort2.h:56
@ SORT_KEYID
Sort by the encryption key's ID.
Definition: sort2.h:55
@ SORT_DATE
Sort by the date the email was sent.
Definition: sort2.h:43
@ SORT_ADDRESS
Sort by email address.
Definition: sort2.h:54
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:79
Key value store.
#define NONULL(x)
Definition: string2.h:37
An email address.
Definition: address.h:36
char * mailbox
Mailbox and host address.
Definition: address.h:38
A config-change event.
Definition: subset.h:70
const char * name
Name of config item that changed.
Definition: subset.h:72
An Event that happened to a Window.
Definition: mutt_window.h:216
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:217
Mapping between user-readable string and a constant.
Definition: mapping.h:32
Definition: lib.h:69
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:76
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Definition: lib.h:96
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:152
void * mdata
Private data.
Definition: lib.h:137
int max
Number of entries in the menu.
Definition: lib.h:71
struct WindowState state
Current state of the Window.
Definition: mutt_window.h:127
void * wdata
Private data.
Definition: mutt_window.h:145
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Definition: mutt_window.h:138
Container for Accounts, Notifications.
Definition: neomutt.h:37
struct Notify * notify
Notifications handler.
Definition: neomutt.h:38
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
Data passed to a notification function.
Definition: observer.h:34
void * event_data
Data from notify_send()
Definition: observer.h:38
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
Definition: observer.h:36
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
Definition: observer.h:37
void * global_data
Data from notify_observer_add()
Definition: observer.h:39
Data to pass to the Pgp Functions.
Definition: pgp_functions.h:34
struct PgpUid ** key_table
Array of Keys.
Definition: pgp_functions.h:37
struct Menu * menu
Pgp Menu.
Definition: pgp_functions.h:36
bool done
Should we close the Dialog?
Definition: pgp_functions.h:35
struct PgpKeyInfo * key
Selected Key.
Definition: pgp_functions.h:38
An entry in a PGP key menu.
Definition: dlg_pgp.c:108
struct PgpUid * uid
Definition: dlg_pgp.c:110
size_t num
Index number.
Definition: dlg_pgp.c:109
Information about a PGP key.
Definition: pgplib.h:47
KeyFlags flags
Definition: pgplib.h:51
struct PgpKeyInfo * next
Definition: pgplib.h:57
short keylen
Definition: pgplib.h:52
time_t gen_time
Definition: pgplib.h:53
const char * algorithm
Definition: pgplib.h:55
PGP User ID.
Definition: pgplib.h:35
short trust
Definition: pgplib.h:37
struct PgpKeyInfo * parent
Parent key.
Definition: pgplib.h:39
int flags
Definition: pgplib.h:38
char * addr
Definition: pgplib.h:36
struct PgpUid * next
Linked list.
Definition: pgplib.h:40
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
@ MENU_PGP
PGP encryption menu.
Definition: type.h:55