NeoMutt  2024-10-02-34-g9dd811
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, int op)
 Create a new autocrypt account - Implements autocrypt_function_t -.
 
static int op_autocrypt_delete_acct (struct AutocryptData *ad, int op)
 Delete the current account - Implements autocrypt_function_t -.
 
static int op_autocrypt_toggle_active (struct AutocryptData *ad, int op)
 Toggle the current account active/inactive - Implements autocrypt_function_t -.
 
static int op_autocrypt_toggle_prefer (struct AutocryptData *ad, int op)
 Toggle the current account prefer-encrypt flag - Implements autocrypt_function_t -.
 
static int op_exit (struct AutocryptData *ad, int op)
 Exit this menu - Implements autocrypt_function_t -.
 

Detailed Description

Prototype for a Autocrypt Function.

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

Function Documentation

◆ op_autocrypt_create_acct()

static int op_autocrypt_create_acct ( struct AutocryptData ad,
int  op 
)
static

Create a new autocrypt account - Implements autocrypt_function_t -.

Definition at line 112 of file functions.c.

113{
114 if (mutt_autocrypt_account_init(false) == 0)
115 populate_menu(ad->menu);
116
117 return FR_SUCCESS;
118}
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:39
bool populate_menu(struct Menu *menu)
Add the Autocrypt data to a Menu.
struct Menu * menu
Autocrypt Menu.
Definition: functions.h:36
+ Here is the call graph for this function:

◆ op_autocrypt_delete_acct()

static int op_autocrypt_delete_acct ( struct AutocryptData ad,
int  op 
)
static

Delete the current account - Implements autocrypt_function_t -.

Definition at line 123 of file functions.c.

124{
125 if (!ad->menu->mdata)
126 return FR_ERROR;
127
128 const int index = menu_get_index(ad->menu);
129 struct AccountEntry *entry = ((struct AccountEntry *) ad->menu->mdata) + index;
130 char msg[128] = { 0 };
131 snprintf(msg, sizeof(msg),
132 // L10N: Confirmation message when deleting an autocrypt account
133 _("Really delete account \"%s\"?"), buf_string(entry->addr->mailbox));
134 if (query_yesorno(msg, MUTT_NO) != MUTT_YES)
135 return FR_NO_ACTION;
136
138 populate_menu(ad->menu);
139
140 return FR_SUCCESS;
141}
int mutt_autocrypt_db_account_delete(struct AutocryptAccount *acct)
Delete an Account from the Autocrypt database.
Definition: db.c:428
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:38
@ 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
@ 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
An entry in the Autocrypt account Menu.
Definition: private.h:45
struct Address * addr
Email address associated with the account.
Definition: private.h:48
struct AutocryptAccount * account
Account details.
Definition: private.h:47
struct Buffer * mailbox
Mailbox and host address.
Definition: address.h:38
void * mdata
Private data.
Definition: lib.h:147
+ Here is the call graph for this function:

◆ op_autocrypt_toggle_active()

static int op_autocrypt_toggle_active ( struct AutocryptData ad,
int  op 
)
static

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

Definition at line 146 of file functions.c.

147{
148 if (!ad->menu->mdata)
149 return FR_ERROR;
150
151 const int index = menu_get_index(ad->menu);
152 struct AccountEntry *entry = ((struct AccountEntry *) ad->menu->mdata) + index;
153 toggle_active(entry);
155
156 return FR_SUCCESS;
157}
static void toggle_active(struct AccountEntry *entry)
Toggle whether an Autocrypt account is active.
Definition: functions.c:81
#define MENU_REDRAW_FULL
Redraw everything.
Definition: lib.h:59
void menu_queue_redraw(struct Menu *menu, MenuRedrawFlags redraw)
Queue a request for a redraw.
Definition: menu.c:184
+ Here is the call graph for this function:

◆ op_autocrypt_toggle_prefer()

static int op_autocrypt_toggle_prefer ( struct AutocryptData ad,
int  op 
)
static

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

Definition at line 162 of file functions.c.

163{
164 if (!ad->menu->mdata)
165 return FR_ERROR;
166
167 const int index = menu_get_index(ad->menu);
168 struct AccountEntry *entry = (struct AccountEntry *) (ad->menu->mdata) + index;
171
172 return FR_SUCCESS;
173}
static void toggle_prefer_encrypt(struct AccountEntry *entry)
Toggle whether an Autocrypt account prefers encryption.
Definition: functions.c:97
+ Here is the call graph for this function:

◆ op_exit()

static int op_exit ( struct AutocryptData ad,
int  op 
)
static

Exit this menu - Implements autocrypt_function_t -.

Definition at line 178 of file functions.c.

179{
180 ad->done = true;
181 return FR_SUCCESS;
182}
bool done
Should we close the Dialog?
Definition: functions.h:35