NeoMutt  2023-03-22-27-g3cb248
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 {
454 break; /* not enough space */
455 }
456 cp++;
457 }
458 else
459 {
460 *p++ = *cp++;
461 len--;
462 }
463 }
464 *p = '\0';
465
466 if (!do_locales)
467 setlocale(LC_TIME, "C");
468 mutt_date_localtime_format(buf2, sizeof(buf2), buf, key->gen_time);
469 if (!do_locales)
470 setlocale(LC_TIME, "");
471
472 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
473 snprintf(buf, buflen, fmt, buf2);
474 if (len > 0)
475 src = cp + 1;
476 break;
477 }
478 default:
479 *buf = '\0';
480 }
481
482 if (optional)
483 {
484 mutt_expando_format(buf, buflen, col, cols, if_str, pgp_entry_format_str,
486 }
487 else if (flags & MUTT_FORMAT_OPTIONAL)
488 {
489 mutt_expando_format(buf, buflen, col, cols, else_str, pgp_entry_format_str,
491 }
492
493 /* We return the format string, unchanged */
494 return src;
495}
496
502static void pgp_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
503{
504 struct PgpUid **key_table = menu->mdata;
505 struct PgpEntry entry;
506
507 entry.uid = key_table[line];
508 entry.num = line + 1;
509
510 const char *const c_pgp_entry_format = cs_subset_string(NeoMutt->sub, "pgp_entry_format");
511 mutt_expando_format(buf, buflen, 0, menu->win->state.cols,
512 NONULL(c_pgp_entry_format), pgp_entry_format_str,
513 (intptr_t) &entry, MUTT_FORMAT_ARROWCURSOR);
514}
515
521static void pgp_key_table_free(struct Menu *menu, void **ptr)
522{
523 FREE(ptr);
524}
525
530{
531 if (nc->event_type != NT_CONFIG)
532 return 0;
533 if (!nc->global_data || !nc->event_data)
534 return -1;
535
536 struct EventConfig *ev_c = nc->event_data;
537
538 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
539 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
540 {
541 return 0;
542 }
543
544 struct Menu *menu = nc->global_data;
546 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
547
548 return 0;
549}
550
559{
560 if (nc->event_type != NT_WINDOW)
561 return 0;
562 if (!nc->global_data || !nc->event_data)
563 return -1;
565 return 0;
566
567 struct MuttWindow *win_menu = nc->global_data;
568 struct EventWindow *ev_w = nc->event_data;
569 if (ev_w->win != win_menu)
570 return 0;
571
572 struct Menu *menu = win_menu->wdata;
573
576
577 mutt_debug(LL_DEBUG5, "window delete done\n");
578 return 0;
579}
580
589 struct Address *p, const char *s)
590{
591 struct PgpUid **key_table = NULL;
592 struct Menu *menu = NULL;
593 char buf[1024] = { 0 };
594 struct PgpUid *a = NULL;
595 bool unusable = false;
596 int keymax = 0;
597
598 const bool c_pgp_show_unusable = cs_subset_bool(NeoMutt->sub, "pgp_show_unusable");
599 int i = 0;
600 for (struct PgpKeyInfo *kp = keys; kp; kp = kp->next)
601 {
602 if (!c_pgp_show_unusable && (kp->flags & KEYFLAG_CANTUSE))
603 {
604 unusable = true;
605 continue;
606 }
607
608 for (a = kp->address; a; a = a->next)
609 {
610 if (!c_pgp_show_unusable && (a->flags & KEYFLAG_CANTUSE))
611 {
612 unusable = true;
613 continue;
614 }
615
616 if (i == keymax)
617 {
618 keymax += 5;
619 mutt_mem_realloc(&key_table, sizeof(struct PgpUid *) * keymax);
620 }
621
622 key_table[i++] = a;
623 }
624 }
625
626 if ((i == 0) && unusable)
627 {
628 mutt_error(_("All matching keys are expired, revoked, or disabled"));
629 return NULL;
630 }
631
632 int (*f)(const void *, const void *);
633 const short c_pgp_sort_keys = cs_subset_sort(NeoMutt->sub, "pgp_sort_keys");
634 switch (c_pgp_sort_keys & SORT_MASK)
635 {
636 case SORT_ADDRESS:
638 break;
639 case SORT_DATE:
641 break;
642 case SORT_KEYID:
644 break;
645 case SORT_TRUST:
646 default:
648 break;
649 }
650 qsort(key_table, i, sizeof(struct PgpUid *), f);
651
653
654 menu = dlg->wdata;
655 menu->max = i;
657 menu->mdata = key_table;
659
660 struct PgpData pd = { false, menu, key_table, NULL };
661 dlg->wdata = &pd;
662
663 // NT_COLOR is handled by the SimpleDialog
666
667 if (p)
668 snprintf(buf, sizeof(buf), _("PGP keys matching <%s>"), p->mailbox);
669 else
670 snprintf(buf, sizeof(buf), _("PGP keys matching \"%s\""), s);
671
672 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
673 sbar_set_title(sbar, buf);
674
676
677 // ---------------------------------------------------------------------------
678 // Event Loop
679 int op = OP_NULL;
680 do
681 {
682 menu_tagging_dispatcher(menu->win, op);
683 window_redraw(NULL);
684
685 op = km_dokey(MENU_PGP);
686 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
687 if (op < 0)
688 continue;
689 if (op == OP_NULL)
690 {
692 continue;
693 }
695
696 int rc = pgp_function_dispatcher(dlg, op);
697
698 if (rc == FR_UNKNOWN)
699 rc = menu_function_dispatcher(menu->win, op);
700 if (rc == FR_UNKNOWN)
701 rc = global_function_dispatcher(NULL, op);
702 } while (!pd.done);
703 // ---------------------------------------------------------------------------
704
705 simple_dialog_free(&dlg);
706 return pd.key;
707}
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:702
@ 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:588
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:726
#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:502
static void pgp_key_table_free(struct Menu *menu, void **ptr)
Free the key table - Implements Menu::mdata_free() -.
Definition: dlg_pgp.c:521
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_pgp.c:558
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_pgp.c:529
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:797
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: keymap.c:1065
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:60
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:73
NeoMutt Logging.
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
Definition: mutt_window.c:605
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:523
@ 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:205
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:190
char * pgp_fpr_or_lkeyid(struct PgpKeyInfo *k)
Get the fingerprint or long keyid.
Definition: pgp.c:233
PGP sign, encrypt, check routines.
Pgp functions.
struct PgpKeyInfo * pgp_principal_key(struct PgpKeyInfo *key)
Get the main (parent) PGP key.
Definition: pgpkey.c:87
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:74
@ SORT_TRUST
Sort by encryption key's trust level.
Definition: sort2.h:52
@ SORT_KEYID
Sort by the encryption key's ID.
Definition: sort2.h:51
@ SORT_DATE
Sort by the date the email was sent.
Definition: sort2.h:39
@ SORT_ADDRESS
Sort by email address.
Definition: sort2.h:50
#define SORT_REVERSE
Reverse the order of the sort.
Definition: sort2.h:75
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:215
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:216
Mapping between user-readable string and a constant.
Definition: mapping.h:32
Definition: lib.h:70
struct MuttWindow * win
Window holding the Menu.
Definition: lib.h:77
void(* make_entry)(struct Menu *menu, char *buf, size_t buflen, int line)
Definition: lib.h:97
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:152
void * mdata
Private data.
Definition: lib.h:138
int max
Number of entries in the menu.
Definition: lib.h:72
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