95 {
N_(
"Exit"), OP_EXIT },
96 {
N_(
"Select"), OP_GENERIC_SELECT_ENTRY },
97 {
N_(
"Check key"), OP_VERIFY_KEY },
98 {
N_(
"Help"), OP_HELP },
119 const bool sort_reverse = *(
bool *) sdata;
128 return sort_reverse ? -rc : rc;
138 const bool sort_reverse = *(
bool *) sdata;
147 return sort_reverse ? -rc : rc;
157 const bool sort_reverse = *(
bool *) sdata;
159 unsigned long ts = 0;
160 unsigned long tt = 0;
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;
183 return sort_reverse ? -rc : rc;
193 const bool sort_reverse = *(
bool *) sdata;
195 unsigned long ts = 0;
196 unsigned long tt = 0;
209 if (s->
kobj->subkeys)
210 ts = s->
kobj->subkeys->length;
211 if (t->
kobj->subkeys)
212 tt = t->
kobj->subkeys->length;
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;
238 return sort_reverse ? -rc : rc;
318 char op,
const char *src,
const char *prec,
319 const char *if_str,
const char *else_str,
322 char fmt[128] = { 0 };
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);
341 snprintf(buf, buflen, fmt, s);
348 snprintf(fmt,
sizeof(fmt),
"%%%ss", prec);
360 snprintf(fmt,
sizeof(fmt),
"%%%sc", prec);
374 snprintf(fmt,
sizeof(fmt),
"%%%ss", prec);
384 snprintf(fmt,
sizeof(fmt),
"%%%ss", prec);
392 snprintf(fmt,
sizeof(fmt),
"%%%slu", prec);
394 if (key->
kobj->subkeys)
395 val = key->
kobj->subkeys->length;
398 snprintf(buf, buflen, fmt, val);
405 snprintf(fmt,
sizeof(fmt),
"%%%sd", prec);
406 snprintf(buf, buflen, fmt, entry->
num);
411 snprintf(fmt,
sizeof(fmt),
"%%%ss", prec);
412 snprintf(buf, buflen, fmt, gpgme_get_protocol_name(key->
kobj->protocol));
426 case GPGME_VALIDITY_FULL:
429 case GPGME_VALIDITY_MARGINAL:
432 case GPGME_VALIDITY_NEVER:
435 case GPGME_VALIDITY_ULTIMATE:
438 case GPGME_VALIDITY_UNDEFINED:
441 case GPGME_VALIDITY_UNKNOWN:
447 snprintf(fmt,
sizeof(fmt),
"%%%sc", prec);
448 snprintf(buf, buflen, fmt, *s);
455 snprintf(fmt,
sizeof(fmt),
"%%%ss", prec);
456 snprintf(buf, buflen, fmt, key->
uid);
463 bool use_c_locale =
false;
464 struct tm tm = { 0 };
468 const char *cp = src;
475 size_t len = buflen - 1;
476 while ((len > 0) && (*cp !=
']'))
501 if (key->
kobj->subkeys && (key->
kobj->subkeys->timestamp > 0))
509 strftime(buf2,
sizeof(buf2), buf, &tm);
511 snprintf(fmt,
sizeof(fmt),
"%%%ss", prec);
512 snprintf(buf, buflen, fmt, buf2);
547 entry.
key = key_table[line];
548 entry.
num = line + 1;
608 if (ev_w->
win != win_menu)
632 const char *s,
unsigned int app,
bool *forced_valid)
638 bool unusable =
false;
664 mutt_error(
_(
"All matching keys are marked expired/revoked"));
702 menu->
mdata = key_table;
712 const char *ts = NULL;
715 ts =
_(
"PGP and S/MIME keys matching");
717 ts =
_(
"PGP keys matching");
719 ts =
_(
"S/MIME keys matching");
721 ts =
_(
"keys matching");
723 char buf[1024] = { 0 };
734 snprintf(buf,
sizeof(buf),
_(
"%s \"%s\""), ts, s);
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
short cs_subset_sort(const struct ConfigSubset *sub, const char *name)
Get a sort config item by name.
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.
const char * crypt_keyid(struct CryptKeyInfo *k)
Find the ID for the key.
Wrapper for PGP/SMIME calls to GPGME.
@ FR_UNKNOWN
Unknown function.
static char crypt_flags(KeyFlags flags)
Parse the key flags into a single character.
static char * crypt_key_abilities(KeyFlags flags)
Parse key flags into a string.
static const struct Mapping GpgmeHelp[]
Help Bar for the GPGME key selection dialog.
int km_dokey(enum MenuType mtype, GetChFlags flags)
Determine what a keypress should do.
void km_error_key(enum MenuType mtype)
Handle an unbound key sequence.
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 -.
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 -.
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 -.
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 -.
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 -.
#define mutt_debug(LEVEL,...)
static int gpgme_key_config_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
static int gpgme_key_window_observer(struct NotifyCallback *nc)
Notification that a Window has changed - Implements observer_t -.
static int crypt_sort_trust(const void *a, const void *b, void *sdata)
Compare two keys by their trust levels - Implements sort_t -.
static int crypt_sort_address(const void *a, const void *b, void *sdata)
Compare two keys by their addresses - Implements sort_t -.
static int crypt_sort_date(const void *a, const void *b, void *sdata)
Compare two keys by their dates - Implements sort_t -.
static int crypt_sort_keyid(const void *a, const void *b, void *sdata)
Compare two keys by their IDs - Implements sort_t -.
Convenience wrapper for the gui headers.
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.
#define GETCH_NO_FLAGS
No flags are set.
@ LL_DEBUG5
Log at debug level 5.
@ LL_DEBUG1
Log at debug level 1.
void mutt_mem_realloc(void *ptr, size_t size)
Resize a block of memory on the heap.
struct tm mutt_date_localtime(time_t t)
Converts calendar time to a broken-down time structure expressed in user timezone.
Convenience wrapper for the library headers.
bool notify_observer_remove(struct Notify *notify, const observer_t callback, const void *global_data)
Remove an observer from an object.
bool notify_observer_add(struct Notify *notify, enum NotifyType type, observer_t callback, void *global_data)
Add an observer to an object.
int mutt_istr_cmp(const char *a, const char *b)
Compare two strings ignoring case, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
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_set_focus(struct MuttWindow *win)
Set the Window focus.
struct MuttWindow * window_find_child(struct MuttWindow *win, enum WindowType type)
Recursively find a child Window of a given type.
@ WT_DLG_GPGME
GPGME Dialog, dlg_gpgme()
@ WT_STATUS_BAR
Status Bar containing extra info about the Index/Pager/etc.
@ NT_WINDOW_DELETE
Window is about to be deleted.
Some miscellaneous functions.
#define KEYFLAG_EXPIRED
Key is expired.
#define KEYFLAG_ISX509
Key is an X.509 key.
uint16_t KeyFlags
Flags describing PGP/SMIME keys, e.g. KEYFLAG_CANSIGN.
#define APPLICATION_PGP
Use PGP to encrypt/sign.
#define KEYFLAG_RESTRICTIONS
#define KEYFLAG_ABILITIES
#define KEYFLAG_CANENCRYPT
Key is suitable for encryption.
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
#define KEYFLAG_PREFER_SIGNING
Key's owner prefers signing.
#define KEYFLAG_CRITICAL
Key is marked critical.
#define KEYFLAG_DISABLED
Key is marked disabled.
#define KEYFLAG_REVOKED
Key is revoked.
#define KEYFLAG_PREFER_ENCRYPTION
Key's owner prefers encryption.
#define KEYFLAG_CANSIGN
Key is suitable for signing.
@ 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 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.
int(* sort_t)(const void *a, const void *b, void *sdata)
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.
#define SORT_REVERSE
Reverse the order of the sort.
Assorted sorting methods.
#define mutt_numeric_cmp(a, b)
struct Buffer * mailbox
Mailbox and host address.
struct Notify * notify
Notifications: NotifyConfig, EventConfig.
An entry in the Select-Key menu.
struct CryptKeyInfo * key
Key.
gpgme_validity_t validity
uid validity (cached for convenience)
KeyFlags flags
global and per uid flags (for convenience)
struct CryptKeyInfo * next
Linked list.
const char * uid
and for convenience point to this user ID
const char * name
Name of config item that changed.
An Event that happened to a Window.
struct MuttWindow * win
Window that changed.
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.
struct WindowState state
Current state of the Window.
void * wdata
Private data.
struct Notify * notify
Notifications: NotifyWindow, EventWindow.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
locale_t time_c_locale
Current locale but LC_TIME=C.
Data passed to a notification function.
void * event_data
Data from notify_send()
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
int event_subtype
Send: Event subtype, e.g. NT_ACCOUNT_ADD.
void * global_data
Data from notify_observer_add()
short cols
Number of columns, can be MUTT_WIN_SIZE_UNLIMITED.
MenuType
Types of GUI selections.
@ MENU_KEY_SELECT_PGP
Select a PGP key.
@ MENU_KEY_SELECT_SMIME
Select a SMIME key.
@ MENU_GENERIC
Generic selection list.