NeoMutt  2023-11-03-107-g582dc1
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
dlg_gpgme.c
Go to the documentation of this file.
1
68#include "config.h"
69#include <ctype.h>
70#include <gpgme.h>
71#include <locale.h>
72#include <stdbool.h>
73#include <stdint.h>
74#include <stdio.h>
75#include <time.h>
76#include "private.h"
77#include "mutt/lib.h"
78#include "address/lib.h"
79#include "config/lib.h"
80#include "core/lib.h"
81#include "gui/lib.h"
82#include "lib.h"
83#include "key/lib.h"
84#include "menu/lib.h"
85#include "crypt_gpgme.h"
86#include "format_flags.h"
87#include "gpgme_functions.h"
88#include "mutt_logging.h"
89#include "muttlib.h"
90#include "sort.h"
91
93static const struct Mapping GpgmeHelp[] = {
94 // clang-format off
95 { N_("Exit"), OP_EXIT },
96 { N_("Select"), OP_GENERIC_SELECT_ENTRY },
97 { N_("Check key"), OP_VERIFY_KEY },
98 { N_("Help"), OP_HELP },
99 { NULL, 0 },
100 // clang-format on
101};
102
107{
108 size_t num;
110};
111
115static int crypt_sort_address(const void *a, const void *b, void *sdata)
116{
117 struct CryptKeyInfo *s = *(struct CryptKeyInfo **) a;
118 struct CryptKeyInfo *t = *(struct CryptKeyInfo **) b;
119 const bool sort_reverse = *(bool *) sdata;
120
121 int rc = mutt_istr_cmp(s->uid, t->uid);
122 if (rc != 0)
123 goto done;
124
126
127done:
128 return sort_reverse ? -rc : rc;
129}
130
134static int crypt_sort_keyid(const void *a, const void *b, void *sdata)
135{
136 struct CryptKeyInfo *s = *(struct CryptKeyInfo **) a;
137 struct CryptKeyInfo *t = *(struct CryptKeyInfo **) b;
138 const bool sort_reverse = *(bool *) sdata;
139
141 if (rc != 0)
142 goto done;
143
144 rc = mutt_istr_cmp(s->uid, t->uid);
145
146done:
147 return sort_reverse ? -rc : rc;
148}
149
153static int crypt_sort_date(const void *a, const void *b, void *sdata)
154{
155 struct CryptKeyInfo *s = *(struct CryptKeyInfo **) a;
156 struct CryptKeyInfo *t = *(struct CryptKeyInfo **) b;
157 const bool sort_reverse = *(bool *) sdata;
158
159 unsigned long ts = 0;
160 unsigned long tt = 0;
161 int rc = 0;
162
163 if (s->kobj->subkeys && (s->kobj->subkeys->timestamp > 0))
164 ts = s->kobj->subkeys->timestamp;
165 if (t->kobj->subkeys && (t->kobj->subkeys->timestamp > 0))
166 tt = t->kobj->subkeys->timestamp;
167
168 if (ts > tt)
169 {
170 rc = 1;
171 goto done;
172 }
173
174 if (ts < tt)
175 {
176 rc = -1;
177 goto done;
178 }
179
180 rc = mutt_istr_cmp(s->uid, t->uid);
181
182done:
183 return sort_reverse ? -rc : rc;
184}
185
189static int crypt_sort_trust(const void *a, const void *b, void *sdata)
190{
191 struct CryptKeyInfo *s = *(struct CryptKeyInfo **) a;
192 struct CryptKeyInfo *t = *(struct CryptKeyInfo **) b;
193 const bool sort_reverse = *(bool *) sdata;
194
195 unsigned long ts = 0;
196 unsigned long tt = 0;
197
199 if (rc != 0)
200 goto done;
201
202 // Note: reversed
204 if (rc != 0)
205 return rc;
206
207 ts = 0;
208 tt = 0;
209 if (s->kobj->subkeys)
210 ts = s->kobj->subkeys->length;
211 if (t->kobj->subkeys)
212 tt = t->kobj->subkeys->length;
213
214 // Note: reversed
215 rc = mutt_numeric_cmp(tt, ts);
216 if (rc != 0)
217 goto done;
218
219 ts = 0;
220 tt = 0;
221 if (s->kobj->subkeys && (s->kobj->subkeys->timestamp > 0))
222 ts = s->kobj->subkeys->timestamp;
223 if (t->kobj->subkeys && (t->kobj->subkeys->timestamp > 0))
224 tt = t->kobj->subkeys->timestamp;
225
226 // Note: reversed
227 rc = mutt_numeric_cmp(tt, ts);
228 if (rc != 0)
229 goto done;
230
231 rc = mutt_istr_cmp(s->uid, t->uid);
232 if (rc != 0)
233 goto done;
234
236
237done:
238 return sort_reverse ? -rc : rc;
239}
240
249{
250 static char buf[3];
251
252 if (!(flags & KEYFLAG_CANENCRYPT))
253 buf[0] = '-';
254 else if (flags & KEYFLAG_PREFER_SIGNING)
255 buf[0] = '.';
256 else
257 buf[0] = 'e';
258
259 if (!(flags & KEYFLAG_CANSIGN))
260 buf[1] = '-';
262 buf[1] = '.';
263 else
264 buf[1] = 's';
265
266 buf[2] = '\0';
267
268 return buf;
269}
270
279{
281 return 'R';
283 return 'X';
285 return 'd';
287 return 'c';
288
289 return ' ';
290}
291
317static const char *crypt_format_str(char *buf, size_t buflen, size_t col, int cols,
318 char op, const char *src, const char *prec,
319 const char *if_str, const char *else_str,
320 intptr_t data, MuttFormatFlags flags)
321{
322 char fmt[128] = { 0 };
323 bool optional = (flags & MUTT_FORMAT_OPTIONAL);
324
325 struct CryptEntry *entry = (struct CryptEntry *) data;
326 struct CryptKeyInfo *key = entry->key;
327
328 KeyFlags kflags = (key->flags);
329
330 switch (tolower(op))
331 {
332 case 'a':
333 if (!optional)
334 {
335 const char *s = NULL;
336 snprintf(fmt, sizeof(fmt), "%%%s.3s", prec);
337 if (key->kobj->subkeys)
338 s = gpgme_pubkey_algo_name(key->kobj->subkeys->pubkey_algo);
339 else
340 s = "?";
341 snprintf(buf, buflen, fmt, s);
342 }
343 break;
344
345 case 'c':
346 if (!optional)
347 {
348 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
349 snprintf(buf, buflen, fmt, crypt_key_abilities(kflags));
350 }
351 else if (!(kflags & KEYFLAG_ABILITIES))
352 {
353 optional = false;
354 }
355 break;
356
357 case 'f':
358 if (!optional)
359 {
360 snprintf(fmt, sizeof(fmt), "%%%sc", prec);
361 snprintf(buf, buflen, fmt, crypt_flags(kflags));
362 }
363 else if (!(kflags & KEYFLAG_RESTRICTIONS))
364 {
365 optional = false;
366 }
367 break;
368
369 case 'i':
370 if (!optional)
371 {
372 /* fixme: we need a way to distinguish between main and subkeys.
373 * Store the idx in entry? */
374 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
375 snprintf(buf, buflen, fmt, crypt_fpr_or_lkeyid(key));
376 }
377 break;
378
379 case 'k':
380 if (!optional)
381 {
382 /* fixme: we need a way to distinguish between main and subkeys.
383 * Store the idx in entry? */
384 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
385 snprintf(buf, buflen, fmt, crypt_keyid(key));
386 }
387 break;
388
389 case 'l':
390 if (!optional)
391 {
392 snprintf(fmt, sizeof(fmt), "%%%slu", prec);
393 unsigned long val;
394 if (key->kobj->subkeys)
395 val = key->kobj->subkeys->length;
396 else
397 val = 0;
398 snprintf(buf, buflen, fmt, val);
399 }
400 break;
401
402 case 'n':
403 if (!optional)
404 {
405 snprintf(fmt, sizeof(fmt), "%%%sd", prec);
406 snprintf(buf, buflen, fmt, entry->num);
407 }
408 break;
409
410 case 'p':
411 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
412 snprintf(buf, buflen, fmt, gpgme_get_protocol_name(key->kobj->protocol));
413 break;
414
415 case 't':
416 {
417 char *s = NULL;
418 if ((kflags & KEYFLAG_ISX509))
419 {
420 s = "x";
421 }
422 else
423 {
424 switch (key->validity)
425 {
426 case GPGME_VALIDITY_FULL:
427 s = "f";
428 break;
429 case GPGME_VALIDITY_MARGINAL:
430 s = "m";
431 break;
432 case GPGME_VALIDITY_NEVER:
433 s = "n";
434 break;
435 case GPGME_VALIDITY_ULTIMATE:
436 s = "u";
437 break;
438 case GPGME_VALIDITY_UNDEFINED:
439 s = "q";
440 break;
441 case GPGME_VALIDITY_UNKNOWN:
442 default:
443 s = "?";
444 break;
445 }
446 }
447 snprintf(fmt, sizeof(fmt), "%%%sc", prec);
448 snprintf(buf, buflen, fmt, *s);
449 break;
450 }
451
452 case 'u':
453 if (!optional)
454 {
455 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
456 snprintf(buf, buflen, fmt, key->uid);
457 }
458 break;
459
460 case '[':
461 {
462 char buf2[128];
463 bool use_c_locale = false;
464 struct tm tm = { 0 };
465
466 char *p = buf;
467
468 const char *cp = src;
469 if (*cp == '!')
470 {
471 use_c_locale = true;
472 cp++;
473 }
474
475 size_t len = buflen - 1;
476 while ((len > 0) && (*cp != ']'))
477 {
478 if (*cp == '%')
479 {
480 cp++;
481 if (len >= 2)
482 {
483 *p++ = '%';
484 *p++ = *cp;
485 len -= 2;
486 }
487 else
488 {
489 break; /* not enough space */
490 }
491 cp++;
492 }
493 else
494 {
495 *p++ = *cp++;
496 len--;
497 }
498 }
499 *p = '\0';
500
501 if (key->kobj->subkeys && (key->kobj->subkeys->timestamp > 0))
502 tm = mutt_date_localtime(key->kobj->subkeys->timestamp);
503 else
504 tm = mutt_date_localtime(0); // Default to 1970-01-01
505
506 if (use_c_locale)
507 strftime_l(buf2, sizeof(buf2), buf, &tm, NeoMutt->time_c_locale);
508 else
509 strftime(buf2, sizeof(buf2), buf, &tm);
510
511 snprintf(fmt, sizeof(fmt), "%%%ss", prec);
512 snprintf(buf, buflen, fmt, buf2);
513 if (len > 0)
514 src = cp + 1;
515 break;
516 }
517
518 default:
519 *buf = '\0';
520 }
521
522 if (optional)
523 {
524 mutt_expando_format(buf, buflen, col, cols, if_str, crypt_format_str, data,
526 }
527 else if (flags & MUTT_FORMAT_OPTIONAL)
528 {
529 mutt_expando_format(buf, buflen, col, cols, else_str, crypt_format_str,
531 }
532
533 /* We return the format string, unchanged */
534 return src;
535}
536
542static void crypt_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
543{
544 struct CryptKeyInfo **key_table = menu->mdata;
545 struct CryptEntry entry = { 0 };
546
547 entry.key = key_table[line];
548 entry.num = line + 1;
549
550 const char *const c_pgp_entry_format = cs_subset_string(NeoMutt->sub, "pgp_entry_format");
551 mutt_expando_format(buf, buflen, 0, menu->win->state.cols, NONULL(c_pgp_entry_format),
552 crypt_format_str, (intptr_t) &entry, MUTT_FORMAT_ARROWCURSOR);
553}
554
560static void gpgme_key_table_free(struct Menu *menu, void **ptr)
561{
562 FREE(ptr);
563}
564
569{
570 if (nc->event_type != NT_CONFIG)
571 return 0;
572 if (!nc->global_data || !nc->event_data)
573 return -1;
574
575 struct EventConfig *ev_c = nc->event_data;
576
577 if (!mutt_str_equal(ev_c->name, "pgp_entry_format") &&
578 !mutt_str_equal(ev_c->name, "pgp_sort_keys"))
579 {
580 return 0;
581 }
582
583 struct Menu *menu = nc->global_data;
585 mutt_debug(LL_DEBUG5, "config done, request WA_RECALC, MENU_REDRAW_FULL\n");
586
587 return 0;
588}
589
598{
599 if (nc->event_type != NT_WINDOW)
600 return 0;
601 if (!nc->global_data || !nc->event_data)
602 return -1;
604 return 0;
605
606 struct MuttWindow *win_menu = nc->global_data;
607 struct EventWindow *ev_w = nc->event_data;
608 if (ev_w->win != win_menu)
609 return 0;
610
611 struct Menu *menu = win_menu->wdata;
612
615
616 mutt_debug(LL_DEBUG5, "window delete done\n");
617 return 0;
618}
619
631struct CryptKeyInfo *dlg_gpgme(struct CryptKeyInfo *keys, struct Address *p,
632 const char *s, unsigned int app, bool *forced_valid)
633{
634 int keymax;
635 int i;
636 sort_t f = NULL;
637 enum MenuType menu_to_use = MENU_GENERIC;
638 bool unusable = false;
639
640 /* build the key table */
641 keymax = 0;
642 i = 0;
643 struct CryptKeyInfo **key_table = NULL;
644 const bool c_pgp_show_unusable = cs_subset_bool(NeoMutt->sub, "pgp_show_unusable");
645 for (struct CryptKeyInfo *k = keys; k; k = k->next)
646 {
647 if (!c_pgp_show_unusable && (k->flags & KEYFLAG_CANTUSE))
648 {
649 unusable = true;
650 continue;
651 }
652
653 if (i == keymax)
654 {
655 keymax += 20;
656 mutt_mem_realloc(&key_table, sizeof(struct CryptKeyInfo *) * keymax);
657 }
658
659 key_table[i++] = k;
660 }
661
662 if (!i && unusable)
663 {
664 mutt_error(_("All matching keys are marked expired/revoked"));
665 return NULL;
666 }
667
668 const short c_pgp_sort_keys = cs_subset_sort(NeoMutt->sub, "pgp_sort_keys");
669 switch (c_pgp_sort_keys & SORT_MASK)
670 {
671 case SORT_ADDRESS:
673 break;
674 case SORT_DATE:
675 f = crypt_sort_date;
676 break;
677 case SORT_KEYID:
679 break;
680 case SORT_TRUST:
681 default:
683 break;
684 }
685
686 if (key_table)
687 {
688 bool sort_reverse = c_pgp_sort_keys & SORT_REVERSE;
689 mutt_qsort_r(key_table, i, sizeof(struct CryptKeyInfo *), f, &sort_reverse);
690 }
691
692 if (app & APPLICATION_PGP)
693 menu_to_use = MENU_KEY_SELECT_PGP;
694 else if (app & APPLICATION_SMIME)
695 menu_to_use = MENU_KEY_SELECT_SMIME;
696
697 struct MuttWindow *dlg = simple_dialog_new(menu_to_use, WT_DLG_GPGME, GpgmeHelp);
698
699 struct Menu *menu = dlg->wdata;
700 menu->max = i;
702 menu->mdata = key_table;
704
705 struct GpgmeData gd = { false, menu, key_table, NULL, forced_valid };
706 dlg->wdata = &gd;
707
708 // NT_COLOR is handled by the SimpleDialog
711
712 const char *ts = NULL;
713
714 if ((app & APPLICATION_PGP) && (app & APPLICATION_SMIME))
715 ts = _("PGP and S/MIME keys matching");
716 else if ((app & APPLICATION_PGP))
717 ts = _("PGP keys matching");
718 else if ((app & APPLICATION_SMIME))
719 ts = _("S/MIME keys matching");
720 else
721 ts = _("keys matching");
722
723 char buf[1024] = { 0 };
724 if (p)
725 {
726 /* L10N: 1$s is one of the previous four entries.
727 %2$s is an address.
728 e.g. "S/MIME keys matching <john.doe@example.com>" */
729 snprintf(buf, sizeof(buf), _("%s <%s>"), ts, buf_string(p->mailbox));
730 }
731 else
732 {
733 /* L10N: e.g. 'S/MIME keys matching "John Doe".' */
734 snprintf(buf, sizeof(buf), _("%s \"%s\""), ts, s);
735 }
736
737 struct MuttWindow *sbar = window_find_child(dlg, WT_STATUS_BAR);
738 sbar_set_title(sbar, buf);
739
741
742 struct MuttWindow *old_focus = window_set_focus(menu->win);
743 // ---------------------------------------------------------------------------
744 // Event Loop
745 int op = OP_NULL;
746 do
747 {
748 menu_tagging_dispatcher(menu->win, op);
749 window_redraw(NULL);
750
751 op = km_dokey(menu_to_use, GETCH_NO_FLAGS);
752 mutt_debug(LL_DEBUG1, "Got op %s (%d)\n", opcodes_get_name(op), op);
753 if (op < 0)
754 continue;
755 if (op == OP_NULL)
756 {
757 km_error_key(menu_to_use);
758 continue;
759 }
761
762 int rc = gpgme_function_dispatcher(dlg, op);
763
764 if (rc == FR_UNKNOWN)
765 rc = menu_function_dispatcher(menu->win, op);
766 if (rc == FR_UNKNOWN)
767 rc = global_function_dispatcher(NULL, op);
768 } while (!gd.done);
769 // ---------------------------------------------------------------------------
770
771 window_set_focus(old_focus);
772 simple_dialog_free(&dlg);
773 return gd.key;
774}
Email Address Handling.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition: buffer.h:93
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:48
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
Definition: helpers.c:267
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
const char * crypt_fpr_or_lkeyid(struct CryptKeyInfo *k)
Find the fingerprint of a key.
Definition: crypt_gpgme.c:213
const char * crypt_keyid(struct CryptKeyInfo *k)
Find the ID for the key.
Definition: crypt_gpgme.c:137
Wrapper for PGP/SMIME calls to GPGME.
@ FR_UNKNOWN
Unknown function.
Definition: dispatcher.h:33
static char crypt_flags(KeyFlags flags)
Parse the key flags into a single character.
Definition: dlg_gpgme.c:278
static char * crypt_key_abilities(KeyFlags flags)
Parse key flags into a string.
Definition: dlg_gpgme.c:248
static const struct Mapping GpgmeHelp[]
Help Bar for the GPGME key selection dialog.
Definition: dlg_gpgme.c:93
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 km_dokey(enum MenuType mtype, GetChFlags flags)
Determine what a keypress should do.
Definition: get.c:463
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
Definition: get.c:293
Gpgme functions.
int gpgme_function_dispatcher(struct MuttWindow *win, int op)
Perform a Gpgme function - Implements function_dispatcher_t -.
int menu_tagging_dispatcher(struct MuttWindow *win, int op)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
Definition: tagging.c:230
int global_function_dispatcher(struct MuttWindow *win, int op)
Perform a Global function - Implements function_dispatcher_t -.
Definition: global.c:169
int menu_function_dispatcher(struct MuttWindow *win, int op)
Perform a Menu function - Implements function_dispatcher_t -.
Definition: functions.c:317
static const char * crypt_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 a string for the key selection menu - Implements format_t -.
Definition: dlg_gpgme.c:317
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:739
struct CryptKeyInfo * dlg_gpgme(struct CryptKeyInfo *keys, struct Address *p, const char *s, unsigned int app, bool *forced_valid)
Get the user to select a key -.
Definition: dlg_gpgme.c:631
#define mutt_error(...)
Definition: logging2.h:92
#define mutt_debug(LEVEL,...)
Definition: logging2.h:89
static void crypt_make_entry(struct Menu *menu, char *buf, size_t buflen, int line)
Format a PGP Key for the Menu - Implements Menu::make_entry() -.
Definition: dlg_gpgme.c:542
static void gpgme_key_table_free(struct Menu *menu, void **ptr)
Free the key table - Implements Menu::mdata_free() -.
Definition: dlg_gpgme.c:560
static int gpgme_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Definition: dlg_gpgme.c:568
static int gpgme_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
Definition: dlg_gpgme.c:597
static int crypt_sort_trust(const void *a, const void *b, void *sdata)
Compare two keys by their trust levels - Implements sort_t -.
Definition: dlg_gpgme.c:189
static int crypt_sort_address(const void *a, const void *b, void *sdata)
Compare two keys by their addresses - Implements sort_t -.
Definition: dlg_gpgme.c:115
static int crypt_sort_date(const void *a, const void *b, void *sdata)
Compare two keys by their dates - Implements sort_t -.
Definition: dlg_gpgme.c:153
static int crypt_sort_keyid(const void *a, const void *b, void *sdata)
Compare two keys by their IDs - Implements sort_t -.
Definition: dlg_gpgme.c:134
Convenience wrapper for the gui headers.
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
Definition: simple.c:168
struct MuttWindow * simple_dialog_new(enum MenuType mtype, enum WindowType wtype, const struct Mapping *help_data)
Create a simple index Dialog.
Definition: simple.c:132
Manage keymappings.
#define GETCH_NO_FLAGS
No flags are set.
Definition: lib.h:52
@ LL_DEBUG5
Log at debug level 5.
Definition: logging2.h:47
@ LL_DEBUG1
Log at debug level 1.
Definition: logging2.h:43
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:45
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:180
struct tm mutt_date_localtime(time_t t)
Converts calendar time to a broken-down time structure expressed in user timezone.
Definition: date.c:879
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:230
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:191
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
Definition: string.c:484
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:763
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:634
struct MuttWindow * window_set_focus(struct MuttWindow *win)
Set the Window focus.
Definition: mutt_window.c:684
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
Definition: mutt_window.c:533
@ WT_DLG_GPGME
GPGME Dialog, dlg_gpgme()
Definition: mutt_window.h:83
@ 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:229
Some miscellaneous functions.
#define KEYFLAG_EXPIRED
Key is expired.
Definition: lib.h:132
#define KEYFLAG_ISX509
Key is an X.509 key.
Definition: lib.h:130
uint16_t KeyFlags
Flags describing PGP/SMIME keys, e.g. KEYFLAG_CANSIGN.
Definition: lib.h:126
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:91
#define KEYFLAG_RESTRICTIONS
Definition: lib.h:141
#define KEYFLAG_ABILITIES
Definition: lib.h:143
#define KEYFLAG_CANENCRYPT
Key is suitable for encryption.
Definition: lib.h:129
#define KEYFLAG_CANTUSE
Definition: lib.h:140
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:92
#define KEYFLAG_PREFER_SIGNING
Key's owner prefers signing.
Definition: lib.h:138
#define KEYFLAG_CRITICAL
Key is marked critical.
Definition: lib.h:136
#define KEYFLAG_DISABLED
Key is marked disabled.
Definition: lib.h:134
#define KEYFLAG_REVOKED
Key is revoked.
Definition: lib.h:133
#define KEYFLAG_PREFER_ENCRYPTION
Key's owner prefers encryption.
Definition: lib.h:137
#define KEYFLAG_CANSIGN
Key is suitable for signing.
Definition: lib.h:128
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
Definition: notify_type.h:57
@ 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:48
void mutt_qsort_r(void *base, size_t nmemb, size_t size, sort_t compar, void *sdata)
Sort an array, where the comparator has access to opaque data rather than requiring global variables.
Definition: qsort_r.c:66
int(* sort_t)(const void *a, const void *b, void *sdata)
Definition: qsort_r.h:40
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
Definition: sbar.c:227
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
Assorted sorting methods.
#define mutt_numeric_cmp(a, b)
Definition: sort.h:34
Key value store.
#define NONULL(x)
Definition: string2.h:37
An email address.
Definition: address.h:36
struct Buffer * mailbox
Mailbox and host address.
Definition: address.h:38
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
Definition: subset.h:52
An entry in the Select-Key menu.
Definition: dlg_gpgme.c:107
struct CryptKeyInfo * key
Key.
Definition: dlg_gpgme.c:109
size_t num
Index number.
Definition: dlg_gpgme.c:108
A stored PGP key.
Definition: crypt_gpgme.h:44
gpgme_validity_t validity
uid validity (cached for convenience)
Definition: crypt_gpgme.h:50
KeyFlags flags
global and per uid flags (for convenience)
Definition: crypt_gpgme.h:49
struct CryptKeyInfo * next
Linked list.
Definition: crypt_gpgme.h:45
const char * uid
and for convenience point to this user ID
Definition: crypt_gpgme.h:48
gpgme_key_t kobj
Definition: crypt_gpgme.h:46
A config-change event.
Definition: subset.h:71
const char * name
Name of config item that changed.
Definition: subset.h:73
An Event that happened to a Window.
Definition: mutt_window.h:239
struct MuttWindow * win
Window that changed.
Definition: mutt_window.h:240
Data to pass to the Gpgme Functions.
bool * forced_valid
User insists on out-of-date key.
struct CryptKeyInfo * key
Selected Key.
struct CryptKeyInfo ** key_table
Array of Keys.
bool done
Should we close the Dialog?
struct Menu * menu
Gpgme Menu.
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:96
void(* mdata_free)(struct Menu *menu, void **ptr)
Definition: lib.h:151
void * mdata
Private data.
Definition: lib.h:137
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:41
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:45
locale_t time_c_locale
Current locale but LC_TIME=C.
Definition: neomutt.h:47
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
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
Definition: mutt_window.h:60
MenuType
Types of GUI selections.
Definition: type.h:36
@ MENU_KEY_SELECT_PGP
Select a PGP key.
Definition: type.h:48
@ MENU_KEY_SELECT_SMIME
Select a SMIME key.
Definition: type.h:49
@ MENU_GENERIC
Generic selection list.
Definition: type.h:46