NeoMutt  2025-12-11-1040-g5187ba
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_quit (struct SmimeData *sd, const struct KeyEvent *event)
 Save changes and exit this dialog - 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_quit()

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

Save changes and exit this dialog - Implements smime_function_t -.

Definition at line 46 of file functions_smime.c.

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

◆ op_generic_select_entry()

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

Select the current entry - Implements smime_function_t -.

Definition at line 55 of file functions_smime.c.

56{
57 const int index = menu_get_index(sd->menu);
58 struct SmimeKey **pkey = ARRAY_GET(sd->ska, index);
59 if (!pkey)
60 return FR_NO_ACTION;
61
62 if ((*pkey)->trust != 't')
63 {
64 const char *s = "";
65 switch ((*pkey)->trust)
66 {
67 case 'e':
68 case 'i':
69 case 'r':
70 s = _("ID is expired/disabled/revoked. Do you really want to use the key?");
71 break;
72 case 'u':
73 default:
74 s = _("ID has undefined validity. Do you really want to use the key?");
75 break;
76 case 'v':
77 s = _("ID is not trusted. Do you really want to use the key?");
78 break;
79 }
80
81 char buf[1024] = { 0 };
82 snprintf(buf, sizeof(buf), "%s", s);
83
84 if (query_yesorno(buf, MUTT_NO) != MUTT_YES)
85 {
87 return FR_NO_ACTION;
88 }
89 }
90
91 sd->key = *pkey;
92 sd->done = true;
93 return FR_SUCCESS;
94}
#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:153
#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:43
Here is the call graph for this function: