NeoMutt  2024-11-14-34-g5aaf0d
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, int op)
 Exit this menu - Implements smime_function_t -.
 
static int op_generic_select_entry (struct SmimeData *sd, int op)
 Select the current entry - Implements smime_function_t -.
 

Detailed Description

Prototype for a Smime Function.

Parameters
menuMenu
opOperation to perform, e.g. OP_GENERIC_SELECT_ENTRY
Return values
enumFunctionRetval

Function Documentation

◆ op_exit()

static int op_exit ( struct SmimeData sd,
int  op 
)
static

Exit this menu - Implements smime_function_t -.

Definition at line 44 of file smime_functions.c.

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

◆ op_generic_select_entry()

static int op_generic_select_entry ( struct SmimeData sd,
int  op 
)
static

Select the current entry - Implements smime_function_t -.

Definition at line 53 of file smime_functions.c.

54{
55 const int index = menu_get_index(sd->menu);
56 struct SmimeKey **pkey = ARRAY_GET(sd->ska, index);
57 if (!pkey)
58 return FR_NO_ACTION;
59
60 if ((*pkey)->trust != 't')
61 {
62 const char *s = "";
63 switch ((*pkey)->trust)
64 {
65 case 'e':
66 case 'i':
67 case 'r':
68 s = _("ID is expired/disabled/revoked. Do you really want to use the key?");
69 break;
70 case 'u':
71 s = _("ID has undefined validity. Do you really want to use the key?");
72 break;
73 case 'v':
74 s = _("ID is not trusted. Do you really want to use the key?");
75 break;
76 }
77
78 char buf[1024] = { 0 };
79 snprintf(buf, sizeof(buf), "%s", s);
80
81 if (query_yesorno(buf, MUTT_NO) != MUTT_YES)
82 {
84 return FR_NO_ACTION;
85 }
86 }
87
88 sd->key = *pkey;
89 sd->done = true;
90 return FR_SUCCESS;
91}
#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:37
int menu_get_index(struct Menu *menu)
Get the current selection in the Menu.
Definition: menu.c:160
#define _(a)
Definition: message.h:28
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
Definition: mutt_logging.c:74
@ 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:327
struct SmimeKey * key
Selected Key.
struct Menu * menu
Smime Menu.
struct SmimeKeyArray * ska
Array of Keys.
An SIME key.
Definition: smime.h:44
+ Here is the call graph for this function: