NeoMutt  2025-12-11-694-ga89709
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
functions.c File Reference

Autocrypt functions. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "private.h"
#include "mutt/lib.h"
#include "address/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "functions.h"
#include "lib.h"
#include "key/lib.h"
#include "menu/lib.h"
#include "question/lib.h"
#include "autocrypt_data.h"
+ Include dependency graph for functions.c:

Go to the source code of this file.

Functions

void autocrypt_init_keys (struct SubMenu *sm_generic)
 Initialise the Autocrypt Keybindings - Implements ::init_keys_api.
 
static void toggle_active (struct AccountEntry *entry)
 Toggle whether an Autocrypt account is active.
 
static void toggle_prefer_encrypt (struct AccountEntry *entry)
 Toggle whether an Autocrypt account prefers encryption.
 
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 -.
 
int autocrypt_function_dispatcher (struct MuttWindow *win, const struct KeyEvent *event)
 Perform a Autocrypt function - Implements function_dispatcher_t -.
 

Variables

struct MenuDefinitionMdAutocrypt = NULL
 Autocrypt Menu Definition.
 
static const struct MenuFuncOp OpAutocrypt []
 Functions for the Autocrypt Account.
 
static const struct MenuOpSeq AutocryptDefaultBindings []
 Key bindings for the Autocrypt Account.
 
static const struct AutocryptFunction AutocryptFunctions []
 All the NeoMutt functions that the Autocrypt supports.
 

Detailed Description

Autocrypt functions.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file functions.c.

Function Documentation

◆ autocrypt_init_keys()

void autocrypt_init_keys ( struct SubMenu * sm_generic)

Initialise the Autocrypt Keybindings - Implements ::init_keys_api.

Definition at line 77 of file functions.c.

78{
79 struct MenuDefinition *md = NULL;
80 struct SubMenu *sm = NULL;
81
83 md = km_register_menu(MENU_AUTOCRYPT, "autocrypt");
84 km_menu_add_submenu(md, sm);
85 km_menu_add_submenu(md, sm_generic);
87
88 MdAutocrypt = md;
89}
static const struct MenuFuncOp OpAutocrypt[]
Functions for the Autocrypt Account.
Definition functions.c:52
struct MenuDefinition * MdAutocrypt
Autocrypt Menu Definition.
Definition functions.c:46
static const struct MenuOpSeq AutocryptDefaultBindings[]
Key bindings for the Autocrypt Account.
Definition functions.c:64
void km_menu_add_submenu(struct MenuDefinition *md, struct SubMenu *sm)
Add a SubMenu to a Menu Definition.
Definition init.c:123
struct SubMenu * km_register_submenu(const struct MenuFuncOp functions[])
Register a submenu.
Definition init.c:91
struct MenuDefinition * km_register_menu(int menu, const char *name)
Register a menu.
Definition init.c:107
void km_menu_add_bindings(struct MenuDefinition *md, const struct MenuOpSeq bindings[])
Add Keybindings to a Menu.
Definition init.c:136
Functions for a Dialog or Window.
Definition menu.h:80
Collection of related functions.
Definition menu.h:68
@ MENU_AUTOCRYPT
Autocrypt Account menu.
Definition type.h:37
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggle_active()

static void toggle_active ( struct AccountEntry * entry)
static

Toggle whether an Autocrypt account is active.

Parameters
entryMenu Entry for the account

Definition at line 95 of file functions.c.

96{
97 entry->account->enabled = !entry->account->enabled;
99 {
100 entry->account->enabled = !entry->account->enabled;
101 /* L10N: This error message is displayed if a database update of an
102 account record fails for some odd reason. */
103 mutt_error(_("Error updating account record"));
104 }
105}
int mutt_autocrypt_db_account_update(struct AutocryptAccount *acct)
Update Account info in the Autocrypt database.
Definition db.c:381
#define mutt_error(...)
Definition logging2.h:94
#define _(a)
Definition message.h:28
struct AutocryptAccount * account
Account details.
Definition private.h:48
bool enabled
Is this account enabled.
Definition lib.h:118
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toggle_prefer_encrypt()

static void toggle_prefer_encrypt ( struct AccountEntry * entry)
static

Toggle whether an Autocrypt account prefers encryption.

Parameters
entryMenu Entry for the account

Definition at line 111 of file functions.c.

112{
113 entry->account->prefer_encrypt = !entry->account->prefer_encrypt;
115 {
116 entry->account->prefer_encrypt = !entry->account->prefer_encrypt;
117 mutt_error(_("Error updating account record"));
118 }
119}
bool prefer_encrypt
false = nopref, true = mutual
Definition lib.h:117
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ MdAutocrypt

struct MenuDefinition* MdAutocrypt = NULL

Autocrypt Menu Definition.

Definition at line 46 of file functions.c.

◆ OpAutocrypt

const struct MenuFuncOp OpAutocrypt[]
static
Initial value:
= {
{ "create-account", OP_AUTOCRYPT_CREATE_ACCT },
{ "delete-account", OP_AUTOCRYPT_DELETE_ACCT },
{ "exit", OP_EXIT },
{ "toggle-active", OP_AUTOCRYPT_TOGGLE_ACTIVE },
{ "toggle-prefer-encrypt", OP_AUTOCRYPT_TOGGLE_PREFER },
{ NULL, 0 }
}

Functions for the Autocrypt Account.

Definition at line 52 of file functions.c.

52 { /* map: autocrypt account */
53 { "create-account", OP_AUTOCRYPT_CREATE_ACCT },
54 { "delete-account", OP_AUTOCRYPT_DELETE_ACCT },
55 { "exit", OP_EXIT },
56 { "toggle-active", OP_AUTOCRYPT_TOGGLE_ACTIVE },
57 { "toggle-prefer-encrypt", OP_AUTOCRYPT_TOGGLE_PREFER },
58 { NULL, 0 }
59};

◆ AutocryptDefaultBindings

const struct MenuOpSeq AutocryptDefaultBindings[]
static
Initial value:
= {
{ OP_AUTOCRYPT_CREATE_ACCT, "c" },
{ OP_AUTOCRYPT_DELETE_ACCT, "D" },
{ OP_AUTOCRYPT_TOGGLE_ACTIVE, "a" },
{ OP_AUTOCRYPT_TOGGLE_PREFER, "p" },
{ OP_EXIT, "q" },
{ 0, NULL }
}

Key bindings for the Autocrypt Account.

Definition at line 64 of file functions.c.

64 { /* map: autocrypt account */
65 { OP_AUTOCRYPT_CREATE_ACCT, "c" },
66 { OP_AUTOCRYPT_DELETE_ACCT, "D" },
67 { OP_AUTOCRYPT_TOGGLE_ACTIVE, "a" },
68 { OP_AUTOCRYPT_TOGGLE_PREFER, "p" },
69 { OP_EXIT, "q" },
70 { 0, NULL }
71};

◆ AutocryptFunctions

const struct AutocryptFunction AutocryptFunctions[]
static
Initial value:
= {
{ OP_AUTOCRYPT_CREATE_ACCT, op_autocrypt_create_acct },
{ OP_AUTOCRYPT_DELETE_ACCT, op_autocrypt_delete_acct },
{ OP_AUTOCRYPT_TOGGLE_ACTIVE, op_autocrypt_toggle_active },
{ OP_AUTOCRYPT_TOGGLE_PREFER, op_autocrypt_toggle_prefer },
{ OP_EXIT, op_exit },
{ 0, NULL },
}
static int op_exit(struct AliasMenuData *mdata, const struct KeyEvent *event)
exit this menu - Implements alias_function_t -
Definition functions.c:234
static int op_autocrypt_toggle_active(struct AutocryptData *ad, const struct KeyEvent *event)
Toggle the current account active/inactive - Implements autocrypt_function_t -.
Definition functions.c:163
static int op_autocrypt_create_acct(struct AutocryptData *ad, const struct KeyEvent *event)
Create a new autocrypt account - Implements autocrypt_function_t -.
Definition functions.c:126
static int op_autocrypt_delete_acct(struct AutocryptData *ad, const struct KeyEvent *event)
Delete the current account - Implements autocrypt_function_t -.
Definition functions.c:137
static int op_autocrypt_toggle_prefer(struct AutocryptData *ad, const struct KeyEvent *event)
Toggle the current account prefer-encrypt flag - Implements autocrypt_function_t -.
Definition functions.c:182

All the NeoMutt functions that the Autocrypt supports.

Definition at line 212 of file functions.c.

212 {
213 // clang-format off
214 { OP_AUTOCRYPT_CREATE_ACCT, op_autocrypt_create_acct },
215 { OP_AUTOCRYPT_DELETE_ACCT, op_autocrypt_delete_acct },
216 { OP_AUTOCRYPT_TOGGLE_ACTIVE, op_autocrypt_toggle_active },
217 { OP_AUTOCRYPT_TOGGLE_PREFER, op_autocrypt_toggle_prefer },
218 { OP_EXIT, op_exit },
219 { 0, NULL },
220 // clang-format on
221};