/**
* @file
- * XXX
+ * Autocrypt feature
*
* @authors
* Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
#include "ncrypt/ncrypt.h"
#include "send.h"
+/**
+ * autocrypt_dir_init - Initialise an Autocrypt directory
+ * @param can_create If true, the directory may be created
+ * @retval 0 Success
+ * @retval -1 Error
+ */
static int autocrypt_dir_init(int can_create)
{
int rc = 0;
return rc;
}
+/**
+ * mutt_autocrypt_init - Initialise Autocrypt
+ * @param can_create If true, directories may be created
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_init(int can_create)
{
if (AutocryptDB)
return -1;
}
+/**
+ * mutt_autocrypt_cleanup - Shutdown Autocrypt
+ */
void mutt_autocrypt_cleanup(void)
{
mutt_autocrypt_db_close();
}
-/* Creates a brand new account.
- * This is used the first time autocrypt is initialized, and
- * in the account menu. */
+/**
+ * mutt_autocrypt_account_init - Create a new Autocrypt account
+ * @param prompt Prompt the user
+ * @retval 0 Success
+ * @retval -1 Error
+ *
+ * This is used the first time autocrypt is initialized,
+ * and in the account menu.
+ */
int mutt_autocrypt_account_init(int prompt)
{
struct Address *addr = NULL;
return rc;
}
+/**
+ * mutt_autocrypt_process_autocrypt_header - Parse an Autocrypt email header
+ * @param e Email
+ * @param env Envelope
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_process_autocrypt_header(struct Email *e, struct Envelope *env)
{
struct AutocryptHeader *ac_hdr, *valid_ac_hdr = NULL;
return rc;
}
+/**
+ * mutt_autocrypt_process_gossip_header - Parse an Autocrypt email gossip header
+ * @param e Email
+ * @param prot_headers Envelope with protected headers
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_process_gossip_header(struct Email *hdr, struct Envelope *prot_headers)
{
struct Envelope *env;
return rc;
}
-/* Returns the recommendation. If the recommendataion is > NO and
- * keylist is not NULL, keylist will be populated with the autocrypt
- * keyids
+/**
+ * mutt_autocrypt_ui_recommendation - Get the recommended action for an Email
+ * @param[in] e Email
+ * @param[out] keylist List of Autocrypt key ids
+ * @retval num Recommendation, e.g. #AUTOCRYPT_REC_AVAILABLE
+ *
+ * If the recommendataion is > NO and keylist is not NULL, keylist will be
+ * populated with the autocrypt keyids.
*/
enum AutocryptRec mutt_autocrypt_ui_recommendation(struct Email *hdr, char **keylist)
{
return rc;
}
+/**
+ * mutt_autocrypt_set_sign_as_default_key - Set the Autocrypt default key for signing
+ * @param e Email
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_set_sign_as_default_key(struct Email *hdr)
{
int rc = -1;
return rc;
}
+/**
+ * write_autocrypt_header_line - Write an Autocrypt header to a file
+ * @param fp File to write to
+ * @param addr Email address
+ * @param prefer_encrypt Whether encryption is preferred
+ * @param keydata Raw Autocrypt data
+ */
static void write_autocrypt_header_line(FILE *fp, const char *addr,
int prefer_encrypt, const char *keydata)
{
}
}
+/**
+ * mutt_autocrypt_write_autocrypt_header - Write the Autocrypt header to a file
+ * @param env Envelope
+ * @param fp File to write to
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_write_autocrypt_header(struct Envelope *env, FILE *fp)
{
int rc = -1;
return rc;
}
+/**
+ * mutt_autocrypt_write_gossip_headers - Write the Autocrypt gossip headers to a file
+ * @param env Envelope
+ * @param fp File to write to
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_write_gossip_headers(struct Envelope *env, FILE *fp)
{
struct AutocryptHeader *gossip;
return 0;
}
+/**
+ * mutt_autocrypt_generate_gossip_list - Create the gossip list headers
+ * @param e Email
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_generate_gossip_list(struct Email *hdr)
{
int rc = -1;
TAILQ_FOREACH(recip, &recips, entries)
{
- /* At this point, we just accept missing keys and include what
- * we can. */
+ /* At this point, we just accept missing keys and include what we can. */
if (mutt_autocrypt_db_peer_get(recip, &peer) <= 0)
continue;
return rc;
}
-/* This is invoked during the first autocrypt initialization,
+/**
+ * mutt_autocrypt_scan_mailboxes - Scan mailboxes for Autocrypt headers
+ *
+ * This is invoked during the first autocrypt initialization,
* to scan one or more mailboxes for autocrypt headers.
*
* Due to the implementation, header-cached headers are not scanned,
scan = mutt_yesorno(_("Scan a mailbox for autocrypt headers?"), MUTT_YES);
while (scan == MUTT_YES)
{
- /* L10N:
- The prompt for a mailbox to scan for Autocrypt: headers
- */
+ // L10N: The prompt for a mailbox to scan for Autocrypt: headers
if ((!mutt_buffer_enter_fname(_("Scan mailbox"), folderbuf, 1)) &&
mutt_buffer_len(folderbuf))
{
/**
* @file
- * XXX
+ * Autocrypt feature
*
* @authors
* Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
struct Envelope;
WHERE sqlite3 *AutocryptDB;
+/**
+ * struct AutocryptAccount - Autocrypt account
+ */
struct AutocryptAccount
{
char *email_addr;
int enabled;
};
+/**
+ * struct AutocryptPeer - Autocrypt peer
+ */
struct AutocryptPeer
{
char *email_addr;
char *gossip_keydata;
};
+/**
+ * struct AutocryptPeerHistory - Autocrypt peer history
+ */
struct AutocryptPeerHistory
{
char *peer_email_addr;
char *keydata;
};
+/**
+ * struct AutocryptGossipHistory - Autocrypt gossip history
+ */
struct AutocryptGossipHistory
{
char *peer_email_addr;
char *gossip_keydata;
};
+/**
+ * enum AutocryptRec - Recommendation
+ */
enum AutocryptRec
{
- AUTOCRYPT_REC_OFF,
- AUTOCRYPT_REC_NO,
- AUTOCRYPT_REC_DISCOURAGE,
- AUTOCRYPT_REC_AVAILABLE,
- AUTOCRYPT_REC_YES
+ AUTOCRYPT_REC_OFF, ///< No recommendations
+ AUTOCRYPT_REC_NO, ///< Do no use Autocrypt
+ AUTOCRYPT_REC_DISCOURAGE, ///< Prefer not to use Autocrypt
+ AUTOCRYPT_REC_AVAILABLE, ///< Autocrypt is available
+ AUTOCRYPT_REC_YES, ///< Autocrypt should be used
};
int mutt_autocrypt_init (int);
/**
* @file
- * XXX
+ * Autocrypt account menu
*
* @authors
* Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
#include "muttlib.h"
#include "opcodes.h"
+/**
+ * struct Entry - An entry in the Autocrypt account Menu
+ */
struct Entry
{
int tagged; /* TODO */
{ NULL, 0 }
};
+/**
+ * account_format_str - Format a string for the Autocrypt account list - Implements ::format_t
+ *
+ * | Expando | Description
+ * |:--------|:-----------------------------------------------------------------
+ * | \%a | Email address
+ * | \%k | Gpg keyid
+ * | \%n | Current entry number
+ * | \%p | Prefer-encrypt flag
+ * | \%s | Status flag (active/inactive)
+ */
static const char *account_format_str(char *dest, size_t destlen, size_t col, int cols,
char op, const char *src, const char *fmt,
const char *ifstring, const char *elsestring,
return (src);
}
+/**
+ * account_entry - Create a line for the Autocrypt account menu
+ * @param buf Buffer to save the string
+ * @param buflen Length of the buffer
+ * @param menu Menu to use
+ * @param num Line in the Menu
+ */
static void account_entry(char *s, size_t slen, struct Menu *m, int num)
{
struct Entry *entry = &((struct Entry *) m->data)[num];
(unsigned long) entry, MUTT_FORMAT_ARROWCURSOR);
}
+/**
+ * create_menu - Create the Autocrypt account Menu
+ * @retval ptr New Menu
+ */
static struct Menu *create_menu(void)
{
struct Menu *menu = NULL;
menu = mutt_menu_new(MENU_AUTOCRYPT_ACCT);
menu->menu_make_entry = account_entry;
/* menu->tag = account_tag; */
- /* L10N:
- Autocrypt Account Management Menu title
- */
+ // L10N: Autocrypt Account Management Menu title
menu->title = _("Autocrypt Accounts");
helpstr = mutt_mem_malloc(256);
menu->help = mutt_compile_help(helpstr, 256, MENU_AUTOCRYPT_ACCT, AutocryptAcctHelp);
entries[i].num = i + 1;
/* note: we are transfering the account pointer to the entries
* array, and freeing the accounts array below. the account
- * will be freed in free_menu().
- */
+ * will be freed in free_menu(). */
entries[i].account = accounts[i];
entries[i].addr = mutt_addr_new();
return menu;
}
+/**
+ * free_menu - Free the Autocrypt account Menu
+ * @param menu Menu to free
+ */
static void free_menu(struct Menu **menu)
{
int i;
mutt_menu_destroy(menu);
}
+/**
+ * toggle_active - Toggle whether an Autocrypt account is active
+ * @param entry Menu Entry for the account
+ */
static void toggle_active(struct Entry *entry)
{
entry->account->enabled = !entry->account->enabled;
}
}
+/**
+ * toggle_prefer_encrypt - Toggle whether an Autocrypt account prefers encryption
+ * @param entry Menu Entry for the account
+ */
static void toggle_prefer_encrypt(struct Entry *entry)
{
entry->account->prefer_encrypt = !entry->account->prefer_encrypt;
}
}
+/**
+ * mutt_autocrypt_account_menu - Display the Autocrypt account Menu
+ */
void mutt_autocrypt_account_menu(void)
{
struct Menu *menu;
{
entry = (struct Entry *) (menu->data) + menu->current;
snprintf(msg, sizeof(msg),
- /* L10N:
- Confirmation message when deleting an autocrypt account
- */
+ // L10N: Confirmation message when deleting an autocrypt account
_("Really delete account \"%s\"?"), entry->addr->mailbox);
if (mutt_yesorno(msg, MUTT_NO) != MUTT_YES)
break;
/**
* @file
- * XXX
+ * Autocrypt database handling
*
* @authors
* Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
static sqlite3_stmt *PeerHistoryInsertStmt;
static sqlite3_stmt *GossipHistoryInsertStmt;
+/**
+ * autocrypt_db_create - Create an Autocrypt sqlite database
+ * @param db_path Path to database file
+ * @retval 0 Success
+ * @retval -1 Error
+ */
static int autocrypt_db_create(const char *db_path)
{
if (sqlite3_open_v2(db_path, &AutocryptDB,
SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL) != SQLITE_OK)
{
/* L10N:
- %s is the path to the database. For some reason sqlite3 failed
- to open that database file.
+ %s is the path to the database.
+ For some reason sqlite3 failed to open that database file.
*/
mutt_error(_("Unable to open autocrypt database %s"), db_path);
return -1;
return mutt_autocrypt_schema_init();
}
+/**
+ * mutt_autocrypt_db_init - Initialise the Autocrypt sqlite database
+ * @param can_create If true, the directory may be created
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_init(int can_create)
{
int rc = -1;
return rc;
}
+/**
+ * mutt_autocrypt_db_close - Close the Autocrypt sqlite database connection
+ */
void mutt_autocrypt_db_close(void)
{
if (!AutocryptDB)
AutocryptDB = NULL;
}
+/**
+ * mutt_autocrypt_db_normalize_addr - Normalise an Email Address
+ * @param a Address to normalise
+ */
void mutt_autocrypt_db_normalize_addr(struct Address *a)
{
mutt_addr_to_local(a);
mutt_addr_to_intl(a);
}
+/**
+ * mutt_autocrypt_db_normalize_addrlist - Normalise a list of Email Addresses
+ * @param al List of Addresses to normalise
+ */
void mutt_autocrypt_db_normalize_addrlist(struct AddressList *al)
{
mutt_addrlist_to_local(al);
mutt_addrlist_to_intl(al, NULL);
}
-/* The autocrypt spec says email addresses should be
+/**
+ * copy_normalize_addr - Copy a normalised Email Address
+ * @param addr Address to normalise and copy
+ * @retval ptr Copy of the Address
+ *
+ * The autocrypt spec says email addresses should be
* normalized to lower case and stored in idna form.
*
* In order to avoid visible changes to addresses in the index,
* we make a copy of the address before lowercasing it.
*
- * The return value must be freed.
+ * @note The return value must be freed
*/
static struct Address *copy_normalize_addr(struct Address *addr)
{
* this function we copy only the address passed in.
*
* The normalize_addrlist above is extended to work on a list
- * because of requirements in autocrypt.c
- */
+ * because of requirements in autocrypt.c */
norm_addr = mutt_addr_new();
norm_addr->mailbox = mutt_str_strdup(addr->mailbox);
return norm_addr;
}
-/* Helper that converts to char * and mutt_str_strdups the result */
+/**
+ * strdup_column_text - Copy a string from the database
+ * @param stmt Sqlite database statement
+ * @param index Database row
+ * @retval ptr Copy of string
+ */
static char *strdup_column_text(sqlite3_stmt *stmt, int index)
{
const char *val = (const char *) sqlite3_column_text(stmt, index);
return mutt_str_strdup(val);
}
+/**
+ * mutt_autocrypt_db_account_new - Create a new AutocryptAccount
+ * @retval ptr New AutocryptAccount
+ */
struct AutocryptAccount *mutt_autocrypt_db_account_new(void)
{
return mutt_mem_calloc(1, sizeof(struct AutocryptAccount));
}
+/**
+ * mutt_autocrypt_db_account_free - Free an AutocryptAccount
+ * @param account Account to free
+ */
void mutt_autocrypt_db_account_free(struct AutocryptAccount **account)
{
if (!account || !*account)
FREE(account);
}
+/**
+ * mutt_autocrypt_db_account_get - Get Autocrypt Account data from the database
+ * @param[in] addr Email Address to lookup
+ * @param[out] account Matched account
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_account_get(struct Address *addr, struct AutocryptAccount **account)
{
int rc = -1, result;
return rc;
}
+/**
+ * mutt_autocrypt_db_account_insert - Insert an Account into the Autocrypt database
+ * @param addr Email Address for the account
+ * @param keyid Autocrypt KeyID
+ * @param keydata Autocrypt key data
+ * @param prefer_encrypt Whether the account prefers encryption
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_account_insert(struct Address *addr, const char *keyid,
const char *keydata, int prefer_encrypt)
{
return rc;
}
+/**
+ * mutt_autocrypt_db_account_update - Update Account info in the Autocrypt database
+ * @param acct Autocrypt Account data
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_account_update(struct AutocryptAccount *acct)
{
int rc = -1;
return rc;
}
+/**
+ * mutt_autocrypt_db_account_delete - Delete an Account from the Autocrypt database
+ * @param acct Account to delete
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_account_delete(struct AutocryptAccount *acct)
{
int rc = -1;
return rc;
}
+/**
+ * mutt_autocrypt_db_account_get_all - Get all accounts from an Autocrypt database
+ * @param[out] accounts List of accounts
+ * @param[out] num_accounts Number of accounts
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_account_get_all(struct AutocryptAccount ***accounts, int *num_accounts)
{
int rc = -1, result;
return rc;
}
+/**
+ * mutt_autocrypt_db_peer_new - Create a new AutocryptPeer
+ * @retval ptr New AutocryptPeer
+ */
struct AutocryptPeer *mutt_autocrypt_db_peer_new(void)
{
return mutt_mem_calloc(1, sizeof(struct AutocryptPeer));
}
+/**
+ * mutt_autocrypt_db_peer_free - Free an AutocryptPeer
+ * @param peer AutocryptPeer to free
+ */
void mutt_autocrypt_db_peer_free(struct AutocryptPeer **peer)
{
if (!peer || !*peer)
FREE(peer);
}
+/**
+ * mutt_autocrypt_db_peer_get - Get peer info from the Autocrypt database
+ * @param[in] addr Email Address to look up
+ * @param[out] peer Matching Autocrypt Peer
+ * @retval 0 Success, no matches
+ * @retval 1 Success, a match
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_peer_get(struct Address *addr, struct AutocryptPeer **peer)
{
int rc = -1, result;
return rc;
}
+/**
+ * mutt_autocrypt_db_peer_insert - Insert a peer into the Autocrypt database
+ * @param addr Email Address
+ * @param peer AutocryptPeer to insert
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_peer_insert(struct Address *addr, struct AutocryptPeer *peer)
{
int rc = -1;
return rc;
}
+/**
+ * mutt_autocrypt_db_peer_update - Update the peer info in an Autocrypt database
+ * @param peer AutocryptPeer to update
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_peer_update(struct AutocryptPeer *peer)
{
int rc = -1;
return rc;
}
+/**
+ * mutt_autocrypt_db_peer_history_new - Create a new AutocryptPeerHistory
+ * @retval ptr New AutocryptPeerHistory
+ */
struct AutocryptPeerHistory *mutt_autocrypt_db_peer_history_new(void)
{
return mutt_mem_calloc(1, sizeof(struct AutocryptPeerHistory));
}
+/**
+ * mutt_autocrypt_db_peer_history_free - Free an AutocryptPeerHistory
+ * @param peerhist AutocryptPeerHistory to free
+ */
void mutt_autocrypt_db_peer_history_free(struct AutocryptPeerHistory **peerhist)
{
if (!peerhist || !*peerhist)
FREE(peerhist);
}
+/**
+ * mutt_autocrypt_db_peer_history_insert - Insert peer history into the Autocrypt database
+ * @param addr Email Address
+ * @param peerhist Peer history to insert
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_peer_history_insert(struct Address *addr,
struct AutocryptPeerHistory *peerhist)
{
return rc;
}
+/**
+ * mutt_autocrypt_db_gossip_history_new - Create a new AutocryptGossipHistory
+ * @retval ptr New AutocryptGossipHistory
+ */
struct AutocryptGossipHistory *mutt_autocrypt_db_gossip_history_new(void)
{
return mutt_mem_calloc(1, sizeof(struct AutocryptGossipHistory));
}
+/**
+ * mutt_autocrypt_db_gossip_history_free - Free an AutocryptGossipHistory
+ * @param gossip_hist AutocryptGossipHistory to free
+ */
void mutt_autocrypt_db_gossip_history_free(struct AutocryptGossipHistory **gossip_hist)
{
if (!gossip_hist || !*gossip_hist)
FREE(gossip_hist);
}
+/**
+ * mutt_autocrypt_db_gossip_history_insert - Insert a gossip history into the Autocrypt database
+ * @param addr Email Address
+ * @param gossip_hist Gossip history to insert
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_db_gossip_history_insert(struct Address *addr,
struct AutocryptGossipHistory *gossip_hist)
{
/**
* @file
- * XXX
+ * Autocrypt GPGME handler
*
* @authors
* Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
#include "globals.h"
#include "ncrypt/crypt_gpgme.h"
+/**
+ * create_gpgme_context - Create a GPGME context
+ * @param ctx GPGME context to initialise
+ * @retval 0 Success
+ * @retval -1 Error
+ */
static int create_gpgme_context(gpgme_ctx_t *ctx)
{
gpgme_error_t err;
return 0;
}
+/**
+ * mutt_autocrypt_gpgme_init - Initialise GPGME
+ */
int mutt_autocrypt_gpgme_init(void)
{
pgp_gpgme_init();
return 0;
}
+/**
+ * export_keydata - Export Key data from GPGME into a Buffer
+ * @param ctx GPGME context
+ * @param key GPGME key
+ * @param keydata Buffer for results
+ * @retval 0 Success
+ * @retval -1 Error
+ */
static int export_keydata(gpgme_ctx_t ctx, gpgme_key_t key, struct Buffer *keydata)
{
int rc = -1;
return rc;
}
-/* TODO: not sure if this function will be useful in the future. */
+/**
+ * mutt_autocrypt_gpgme_export_key - Export a GPGME key
+ * @param keyid GPGME Key id
+ * @param keydata Buffer for results
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_gpgme_export_key(const char *keyid, struct Buffer *keydata)
{
int rc = -1;
return rc;
}
+/**
+ * mutt_autocrypt_gpgme_create_key - Create a GPGME key
+ * @param addr Email Address
+ * @param keyid Key id
+ * @param keydata Key data
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_gpgme_create_key(struct Address *addr, struct Buffer *keyid,
struct Buffer *keydata)
{
return rc;
}
+/**
+ * mutt_autocrypt_gpgme_import_key - Read a key from GPGME
+ * @param keydata Buffer for key data
+ * @param keyid Buffer for key id
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_gpgme_import_key(const char *keydata, struct Buffer *keyid)
{
int rc = -1;
return rc;
}
+/**
+ * mutt_autocrypt_gpgme_is_valid_key - Is a key id valid?
+ * @param keyid Key id to check
+ * @retval true If key id is valid
+ */
int mutt_autocrypt_gpgme_is_valid_key(const char *keyid)
{
int rc = 0;
/**
* @file
- * XXX
+ * Shared constants/structs that are private to Autocrypt
*
* @authors
* Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
/**
* @file
- * XXX
+ * Autocrypt database schema
*
* @authors
* Copyright (C) 2019 Kevin J. McCarthy <kevin@8t8.us>
#include "autocrypt_private.h"
#include "mutt/mutt.h"
+/**
+ * mutt_autocrypt_schema_init - Set up an Autocrypt database
+ */
int mutt_autocrypt_schema_init(void)
{
const char *schema;
return 0;
}
+/**
+ * mutt_autocrypt_schema_update - Update the version number of the Autocrypt database schema
+ * @retval 0 Success
+ * @retval -1 Error
+ */
int mutt_autocrypt_schema_update(void)
{
sqlite3_stmt *stmt = NULL;
HDR_FOLLOWUPTO, ///< "Followup-To:" field
HDR_XCOMMENTTO, ///< "X-Comment-To:" field
#endif
- HDR_ATTACH_TITLE, /* the "-- Attachments" line */
- HDR_ATTACH /* where to start printing the attachments */
+ HDR_ATTACH_TITLE, ///< The "-- Attachments" line
+ HDR_ATTACH ///< Where to start printing the attachments
};
int HeaderPadding[HDR_ATTACH_TITLE] = { 0 };
than 15-20 character cells. */
N_("Sign as: "),
#ifdef USE_AUTOCRYPT
- /* L10N:
- The compose menu autocrypt line
- */
+ // L10N: The compose menu autocrypt line
N_("Autocrypt: "),
#endif
#ifdef USE_NNTP
};
#endif
+/**
+ * struct ComposeRedrawData - Keep track when the compose screen needs redrawing
+ */
struct ComposeRedrawData
{
struct Email *email;
}
#ifdef USE_AUTOCRYPT
+/**
+ * autocrypt_compose_menu - Autocrypt compose settings
+ * @param e Email
+ */
static void autocrypt_compose_menu(struct Email *e)
{
/* L10N:
/**
* redraw_crypt_lines - Update the encryption info in the compose window
- * @param e Email
+ * @param rd Email and other compose data
*/
static void redraw_crypt_lines(struct ComposeRedrawData *rd)
{
#endif
}
+/**
+ * update_crypt_info - Update the crypto info
+ * @param rd Email and other compose data
+ */
static void update_crypt_info(struct ComposeRedrawData *rd)
{
struct Email *e = rd->email;
rd->autocrypt_rec = mutt_autocrypt_ui_recommendation(e, NULL);
/* Anything that enables SEC_ENCRYPT or SEC_SIGN, or turns on SMIME
- * overrides autocrypt, be it oppenc or the user having turned on
- * those flags manually. */
+ * overrides autocrypt, be it oppenc or the user having turned on
+ * those flags manually. */
if (e->security & (SEC_ENCRYPT | SEC_SIGN | APPLICATION_SMIME))
e->security &= ~(SEC_AUTOCRYPT | SEC_AUTOCRYPT_OVERRIDE);
else
/**
* draw_envelope - Write the email headers to the compose window
- * @param e Email
- * @param fcc Fcc field
+ * @param rd Email and other compose data
*/
static void draw_envelope(struct ComposeRedrawData *rd)
{
#ifdef USE_AUTOCRYPT
/* This is a fail-safe to make sure the bit isn't somehow turned
* on. The user could have disabled the option after setting SEC_AUTOCRYPT,
- * or perhaps resuming or replying to an autocrypt message.
- */
+ * or perhaps resuming or replying to an autocrypt message. */
if (!C_Autocrypt)
e->security &= ~SEC_AUTOCRYPT;
#endif
}
#ifdef USE_AUTOCRYPT
+/**
+ * mutt_free_autocrypthdr - Free an AutocryptHeader
+ * @param p AutocryptHeader to free
+ */
void mutt_free_autocrypthdr(struct AutocryptHeader **p)
{
struct AutocryptHeader *cur;
#define MUTT_ENV_CHANGED_SUBJECT (1 << 3) ///< Protected header update
#ifdef USE_AUTOCRYPT
+/**
+ * struct AutocryptHeader - Parse Autocrypt header info
+ */
struct AutocryptHeader
{
char *addr;
/**
* parse_parameters - Parse a list of Parameters
- * @param param Parameter list for the results
- * @param s String to parse
+ * @param param Parameter list for the results
+ * @param s String to parse
+ * @param allow_value_spaces Allow values with spaces
*
* Autocrypt defines an irregular parameter format that doesn't follow the
* rfc. It splits keydata across multiple lines without parameter continuations.
{
if (C_AssumedCharset)
{
- /* As iso-2022-* has a character of '"' with non-ascii state,
- * ignore it. */
+ // As iso-2022-* has a character of '"' with non-ascii state, ignore it
if (*s == 0x1b)
{
if ((s[1] == '(') && ((s[2] == 'B') || (s[2] == 'J')))
}
#ifdef USE_AUTOCRYPT
+/**
+ * parse_autocrypt - Parse an Autocrypt header line
+ * @param head Autocrypt header to insert before
+ * @param s Header string to parse
+ * @retval ptr New AutocryptHeader inserted before head
+ */
static struct AutocryptHeader *parse_autocrypt(struct AutocryptHeader *head, const char *s)
{
struct AutocryptHeader *autocrypt = mutt_new_autocrypthdr();
#endif /* MIXMASTER */
#ifdef USE_AUTOCRYPT
+/**
+ * OpAutocryptAcct - Key bindings for the autocrypt account
+ */
const struct Binding OpAutocryptAcct[] = { /* map: autocrypt account */
{ "create-account", OP_AUTOCRYPT_CREATE_ACCT, "c" },
{ "delete-account", OP_AUTOCRYPT_DELETE_ACCT, "D" },
WHERE char *C_AttributionLocale; ///< Config: Locale for dates in the attribution message
WHERE char *C_AttachFormat; ///< Config: printf-like format string for the attachment menu
#ifdef USE_AUTOCRYPT
-WHERE char *C_AutocryptAcctFormat;
-WHERE char *C_AutocryptDir;
+WHERE char *C_AutocryptAcctFormat; ///< Config: Format of the autocrypt account menu
+WHERE char *C_AutocryptDir; ///< Config: Location of autocrypt files, including the GPG keyring and sqlite database
WHERE char *AutocryptSignAs; /* This is used in ncrypt/crypt_gpgme.c */
WHERE char *AutocryptDefaultKey; /* Used for postponing messages */
#endif
WHERE bool C_Askbcc; ///< Config: Ask the user for the blind-carbon-copy recipients
WHERE bool C_Askcc; ///< Config: Ask the user for the carbon-copy recipients
#ifdef USE_AUTOCRYPT
-WHERE bool C_Autocrypt;
+WHERE bool C_Autocrypt; ///< Config: Enables the Autocrypt feature
#endif
WHERE bool C_Autoedit; ///< Config: Skip the initial compose menu and edit the email
WHERE bool C_AutoTag; ///< Config: Automatically apply actions to all tagged messages
* @param str String to apply regex on
* @param nmatch Length of matches
* @param matches regmatch_t to hold match indices
- * @param flags Type flags, e.g. #DT_REGEX_MATCH_CASE
* @retval bool true if str match, false if str does not match
*/
bool mutt_regex_capture(const struct Regex *regex, const char *str,
/**
* mutt_protect - Encrypt and/or sign a message
- * @param e Email
- * @param keylist List of keys to encrypt to (space-separated)
+ * @param e Email
+ * @param keylist List of keys to encrypt to (space-separated)
+ * @param postpone When true, signing is automatically disabled
* @retval 0 Success
* @retval -1 Error
- *
- * In postpone mode, signing is automatically disabled.
*/
int mutt_protect(struct Email *e, char *keylist, int postpone)
{
ciphertext = NULL;
if (err != 0)
{
- /* Abort right away and silently. Autocrypt will retry on the
- * normal keyring. */
+ /* Abort right away and silently.
+ * Autocrypt will retry on the normal keyring. */
if (OptAutocryptGpgme)
goto cleanup;
if (is_smime && !maybe_signed && (gpg_err_code(err) == GPG_ERR_NO_DATA))
/**
* mutt_edit_address - Edit an email address
- * @param[in,out] al AddressList to edit
- * @param[in] field Prompt for user
+ * @param[in,out] al AddressList to edit
+ * @param[in] field Prompt for user
+ * @param[in] expand_aliases If true, expand Address aliases
* @retval 0 Success
* @retval -1 Failure
*/