Let the user select a key to use.
594{
595 struct PgpUid **key_table = NULL;
596 struct Menu *menu = NULL;
597 char buf[1024] = { 0 };
599 bool unusable = false;
600 int keymax = 0;
601
603 int i = 0;
605 {
607 {
608 unusable = true;
609 continue;
610 }
611
612 for (a = kp->address; a; a = a->
next)
613 {
615 {
616 unusable = true;
617 continue;
618 }
619
620 if (i == keymax)
621 {
622 keymax += 5;
624 }
625
626 key_table[i++] = a;
627 }
628 }
629
630 if ((i == 0) && unusable)
631 {
632 mutt_error(
_(
"All matching keys are expired, revoked, or disabled"));
633 return NULL;
634 }
635
636 int (*f)(const void *, const void *);
639 {
642 break;
645 break;
648 break;
650 default:
652 break;
653 }
654
655 if (key_table)
656 qsort(key_table, i,
sizeof(
struct PgpUid *), f);
657
659
663 menu->
mdata = key_table;
665
668
669
672
673 if (p)
675 else
676 snprintf(buf,
sizeof(buf),
_(
"PGP keys matching \"%s\""), s);
677
680
682
683
684
685 int op = OP_NULL;
686 do
687 {
690
693 if (op < 0)
694 continue;
695 if (op == OP_NULL)
696 {
698 continue;
699 }
701
703
709
710
713}
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
@ FR_UNKNOWN
Unknown function.
static int pgp_compare_address_qsort(const void *a, const void *b)
Compare the addresses of two PGP keys.
static int pgp_compare_keyid_qsort(const void *a, const void *b)
Compare key IDs.
static int pgp_compare_date_qsort(const void *a, const void *b)
Compare the dates of two PGP keys.
static int pgp_compare_trust_qsort(const void *a, const void *b)
Compare the trust levels of two PGP keys.
static const struct Mapping PgpHelp[]
Help Bar for the PGP key selection dialog.
int menu_tagging_dispatcher(struct MuttWindow *win, int op)
Perform tagging operations on the Menu - Implements function_dispatcher_t -.
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 -.
int menu_function_dispatcher(struct MuttWindow *win, int op)
Perform a Menu function - Implements function_dispatcher_t -.
#define mutt_debug(LEVEL,...)
static int pgp_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
static int pgp_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
void simple_dialog_free(struct MuttWindow **ptr)
Destroy a simple index Dialog.
struct MuttWindow * simple_dialog_new(enum MenuType mtype, enum WindowType wtype, const struct Mapping *help_data)
Create a simple index Dialog.
int km_dokey(enum MenuType mtype)
Determine what a keypress should do.
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
@ LL_DEBUG1
Log at debug level 1.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
@ WT_DLG_PGP
Pgp Dialog, dlg_select_pgp_key()
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
@ NT_WINDOW
MuttWindow has changed, NotifyWindow, EventWindow.
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
const char * opcodes_get_name(int op)
Get the name of an opcode.
void sbar_set_title(struct MuttWindow *win, const char *title)
Set the title for the Simple Bar.
#define SORT_MASK
Mask for the sort id.
@ SORT_TRUST
Sort by encryption key's trust level.
@ SORT_KEYID
Sort by the encryption key's ID.
@ SORT_DATE
Sort by the date the email was sent.
@ SORT_ADDRESS
Sort by email address.
struct Buffer * mailbox
Mailbox and host address.
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
struct Notify * notify
Notifications handler.
Data to pass to the Pgp Functions.
struct PgpUid ** key_table
Array of Keys.
struct Menu * menu
Pgp Menu.
bool done
Should we close the Dialog?
struct PgpKeyInfo * key
Selected Key.
Information about a PGP key.
struct PgpUid * next
Linked list.
@ MENU_PGP
PGP encryption menu.