NeoMutt  2025-12-11-769-g906513
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Smime Function API

Prototype for a Smime Function. More...

+ Collaboration diagram for Smime Function API:

Functions

static int op_exit (struct SmimeData *sd, const struct KeyEvent *event)
 Exit this menu - Implements smime_function_t -.
 
static int op_generic_select_entry (struct SmimeData *sd, const struct KeyEvent *event)
 Select the current entry - Implements smime_function_t -.
 

Detailed Description

Prototype for a Smime Function.

Parameters
menuMenu
eventEvent to process
Return values
enumFunctionRetval
Precondition
menu is not NULL
event is not NULL

Function Documentation

◆ op_exit()

static int op_exit ( struct SmimeData * sd,
const struct KeyEvent * event )
static

Exit this menu - Implements smime_function_t -.

Definition at line 45 of file smime_functions.c.

46{
47 sd->done = true;
48 return FR_SUCCESS;
49}
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
bool done
Should we close the Dialog?

◆ op_generic_select_entry()

static int op_generic_select_entry ( struct SmimeData * sd,
const struct KeyEvent * event )
static

Select the current entry - Implements smime_function_t -.

Definition at line 54 of file smime_functions.c.

55{
56 const int index = menu_get_index(sd->menu);
57 struct SmimeKey **pkey = ARRAY_GET(sd->ska, index);
58 if (!pkey)
59 return FR_NO_ACTION;
60
61 if ((*pkey)->trust != 't')
62 {
63 const char *s = "";
64 switch ((*pkey)->trust)
65 {
66 case 'e':
67 case 'i':
68 case 'r':
69 s = _("ID is expired/disabled/revoked. Do you really want to use the key?");
70 break;
71 case 'u':
72 s = _("ID has undefined validity. Do you really want to use the key?");
73 break;
74 case 'v':
75 s = _("ID is not trusted. Do you really want to use the key?");
76 break;
77 }
78
79 char buf[1024] = { 0 };
80 snprintf(buf, sizeof(buf), "%s", s);
81
82 if (query_yesorno(buf, MUTT_NO) != MUTT_YES)
83 {
85 return FR_NO_ACTION;
86 }
87 }
88
89 sd->key = *pkey;
90 sd->done = true;
91 return FR_SUCCESS;
92}
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
@ FR_NO_ACTION
Valid function - no action performed.
Definition dispatcher.h:38
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition menu.c:165
#define _(a)
Definition message.h:28
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
@ MUTT_NO
User answered 'No', or assume 'No'.
Definition quad.h:38
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition quad.h:39
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
Definition question.c:329
struct SmimeKey * key
Selected Key.
struct Menu * menu
Smime Menu.
struct SmimeKeyArray * ska
Array of Keys.
An SIME key.
Definition smime.h:42
+ Here is the call graph for this function: