NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
Autocrypt Function API

Prototype for a Autocrypt Function. More...

+ Collaboration diagram for Autocrypt Function API:

Functions

static int op_autocrypt_create_acct (struct AutocryptData *ad, const struct KeyEvent *event)
 Create a new autocrypt account - Implements autocrypt_function_t -.
 
static int op_autocrypt_delete_acct (struct AutocryptData *ad, const struct KeyEvent *event)
 Delete the current account - Implements autocrypt_function_t -.
 
static int op_autocrypt_toggle_active (struct AutocryptData *ad, const struct KeyEvent *event)
 Toggle the current account active/inactive - Implements autocrypt_function_t -.
 
static int op_autocrypt_toggle_prefer (struct AutocryptData *ad, const struct KeyEvent *event)
 Toggle the current account prefer-encrypt flag - Implements autocrypt_function_t -.
 
static int op_exit (struct AutocryptData *ad, const struct KeyEvent *event)
 Exit this menu - Implements autocrypt_function_t -.
 

Detailed Description

Prototype for a Autocrypt Function.

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

Function Documentation

◆ op_autocrypt_create_acct()

static int op_autocrypt_create_acct ( struct AutocryptData * ad,
const struct KeyEvent * event )
static

Create a new autocrypt account - Implements autocrypt_function_t -.

Definition at line 126 of file functions.c.

127{
128 if (mutt_autocrypt_account_init(false) == 0)
129 populate_menu(ad->menu);
130
131 return FR_SUCCESS;
132}
int mutt_autocrypt_account_init(bool prompt)
Create a new Autocrypt account.
Definition autocrypt.c:143
@ FR_SUCCESS
Valid function - successfully performed.
Definition dispatcher.h:40
bool populate_menu(struct Menu *menu)
Add the Autocrypt data to a Menu.
struct Menu * menu
Autocrypt Menu.
+ Here is the call graph for this function:

◆ op_autocrypt_delete_acct()

static int op_autocrypt_delete_acct ( struct AutocryptData * ad,
const struct KeyEvent * event )
static

Delete the current account - Implements autocrypt_function_t -.

Definition at line 137 of file functions.c.

138{
139 if (!ad->menu->mdata)
140 return FR_ERROR;
141
142 const int index = menu_get_index(ad->menu);
143 struct AccountEntry **pentry = ARRAY_GET(&ad->entries, index);
144 if (!pentry)
145 return 0;
146
147 char msg[128] = { 0 };
148 snprintf(msg, sizeof(msg),
149 // L10N: Confirmation message when deleting an autocrypt account
150 _("Really delete account \"%s\"?"), buf_string((*pentry)->addr->mailbox));
151 if (query_yesorno(msg, MUTT_NO) != MUTT_YES)
152 return FR_NO_ACTION;
153
154 if (mutt_autocrypt_db_account_delete((*pentry)->account) == 0)
155 populate_menu(ad->menu);
156
157 return FR_SUCCESS;
158}
#define ARRAY_GET(head, idx)
Return the element at index.
Definition array.h:109
int mutt_autocrypt_db_account_delete(struct AutocryptAccount *acct)
Delete an Account from the Autocrypt database.
Definition db.c:427
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
@ FR_ERROR
Valid function - error occurred.
Definition dispatcher.h:39
@ 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:164
#define _(a)
Definition message.h:28
@ 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:326
An entry in the Autocrypt account Menu.
Definition private.h:46
struct AccountEntryArray entries
Account Entries.
void * mdata
Private data.
Definition lib.h:149
+ Here is the call graph for this function:

◆ op_autocrypt_toggle_active()

static int op_autocrypt_toggle_active ( struct AutocryptData * ad,
const struct KeyEvent * event )
static

Toggle the current account active/inactive - Implements autocrypt_function_t -.

Definition at line 163 of file functions.c.

164{
165 if (!ad->menu->mdata)
166 return FR_ERROR;
167
168 const int index = menu_get_index(ad->menu);
169 struct AccountEntry **pentry = ARRAY_GET(&ad->entries, index);
170 if (!pentry)
171 return 0;
172
173 toggle_active((*pentry));
175
176 return FR_SUCCESS;
177}
static void toggle_active(struct AccountEntry *entry)
Toggle whether an Autocrypt account is active.
Definition functions.c:95
#define MENU_REDRAW_FULL
Redraw everything.
Definition lib.h:60
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition menu.c:188
+ Here is the call graph for this function:

◆ op_autocrypt_toggle_prefer()

static int op_autocrypt_toggle_prefer ( struct AutocryptData * ad,
const struct KeyEvent * event )
static

Toggle the current account prefer-encrypt flag - Implements autocrypt_function_t -.

Definition at line 182 of file functions.c.

183{
184 if (!ad->menu->mdata)
185 return FR_ERROR;
186
187 const int index = menu_get_index(ad->menu);
188 struct AccountEntry **pentry = ARRAY_GET(&ad->entries, index);
189 if (!pentry)
190 return 0;
191
192 toggle_prefer_encrypt((*pentry));
194
195 return FR_SUCCESS;
196}
static void toggle_prefer_encrypt(struct AccountEntry *entry)
Toggle whether an Autocrypt account prefers encryption.
Definition functions.c:111
+ Here is the call graph for this function:

◆ op_exit()

static int op_exit ( struct AutocryptData * ad,
const struct KeyEvent * event )
static

Exit this menu - Implements autocrypt_function_t -.

Definition at line 201 of file functions.c.

202{
203 ad->done = true;
204 return FR_SUCCESS;
205}
bool done
Should we close the Dialog?