static int tls_socket_close(struct Connection *conn);
+#ifndef HAVE_GNUTLS_PRIORITY_SET_DIRECT
+/* This array needs to be large enough to hold all the possible values support
+ * by NeoMutt. The initialized values are just placeholders--the array gets
+ * overwrriten in tls_negotiate() depending on the $ssl_use_* options.
+ *
+ * Note: gnutls_protocol_set_priority() was removed in GnuTLS version
+ * 3.4 (2015-04). TLS 1.3 support wasn't added until version 3.6.5.
+ * Therefore, no attempt is made to support $ssl_use_tlsv1_3 in this code.
+ */
+static int protocol_priority[] = { GNUTLS_TLS1_2, GNUTLS_TLS1_1, GNUTLS_TLS1,
+ GNUTLS_SSL3, 0 };
+#endif
+
/**
* struct TlsSockData - TLS socket data
*/
mutt_buffer_pool_release(&priority);
return rv;
}
-#else
-/* This array needs to be large enough to hold all the possible values support
- * by NeoMutt. The initialized values are just placeholders--the array gets
- * overwrriten in tls_negotiate() depending on the $ssl_use_* options.
- *
- * Note: gnutls_protocol_set_priority() was removed in GnuTLS version
- * 3.4 (2015-04). TLS 1.3 support wasn't added until version 3.6.5.
- * Therefore, no attempt is made to support $ssl_use_tlsv1_3 in this code.
- */
-static int protocol_priority[] = { GNUTLS_TLS1_2, GNUTLS_TLS1_1, GNUTLS_TLS1,
- GNUTLS_SSL3, 0 };
+#else
/**
* tls_set_priority - Set the priority of various protocols
* @param data TLS socket data
}
else if ((chflags & CH_NOQFROM) && mutt_str_startswith(buf, ">From ", CASE_IGNORE))
continue;
-
else if ((buf[0] == '\n') || ((buf[0] == '\r') && (buf[1] == '\n')))
break; /* end of header */
}
}
- mutt_debug(LL_DEBUG1, "WEED is %s\n", (chflags & CH_WEED) ? "Set" : "Not");
+ mutt_debug(LL_DEBUG1, "WEED is %sset\n", (chflags & CH_WEED) ? "" : "not ");
headers = mutt_mem_calloc(hdr_count, sizeof(char *));
{
if (cmflags & MUTT_CM_PREFIX)
chflags |= CH_PREFIX;
-
else if (e->attach_del && (chflags & CH_UPDATE_LEN))
{
int new_lines;
replace_part(state, 0, buf);
}
-
#endif
else
goto self_insert;
FLAG_CHAR_CRYPT_NO_CRYPTO, ///< Character denoting a message has no cryptography information
};
+/**
+ * enum FieldType - Header types
+ *
+ * Strings for printing headers
+ */
+enum FieldType
+{
+ DISP_TO, ///< To: string
+ DISP_CC, ///< Cc: string
+ DISP_BCC, ///< Bcc: string
+ DISP_FROM, ///< From: string
+ DISP_PLAIN, ///< Empty string
+ DISP_MAX,
+};
+
/**
* mutt_is_mail_list - Is this the email address of a mailing list?
* @param addr Address to test
return 2;
}
-/**
- * enum FieldType - Header types
- *
- * Strings for printing headers
- */
-enum FieldType
-{
- DISP_TO, ///< To: string
- DISP_CC, ///< Cc: string
- DISP_BCC, ///< Bcc: string
- DISP_FROM, ///< From: string
- DISP_PLAIN, ///< Empty string
- DISP_MAX,
-};
-
/**
* get_nth_wchar - Extract one char from a multi-byte table
* @param table Multi-byte table
struct Keymap *Keymaps[MENU_MAX];
+#ifdef NCURSES_VERSION
+/**
+ * struct Extkey - Map key names from NeoMutt's style to Curses style
+ */
+struct Extkey
+{
+ const char *name;
+ const char *sym;
+};
+
+static const struct Extkey ExtKeys[] = {
+ { "<c-up>", "kUP5" },
+ { "<s-up>", "kUP" },
+ { "<a-up>", "kUP3" },
+
+ { "<s-down>", "kDN" },
+ { "<a-down>", "kDN3" },
+ { "<c-down>", "kDN5" },
+
+ { "<c-right>", "kRIT5" },
+ { "<s-right>", "kRIT" },
+ { "<a-right>", "kRIT3" },
+
+ { "<s-left>", "kLFT" },
+ { "<a-left>", "kLFT3" },
+ { "<c-left>", "kLFT5" },
+
+ { "<s-home>", "kHOM" },
+ { "<a-home>", "kHOM3" },
+ { "<c-home>", "kHOM5" },
+
+ { "<s-end>", "kEND" },
+ { "<a-end>", "kEND3" },
+ { "<c-end>", "kEND5" },
+
+ { "<s-next>", "kNXT" },
+ { "<a-next>", "kNXT3" },
+ { "<c-next>", "kNXT5" },
+
+ { "<s-prev>", "kPRV" },
+ { "<a-prev>", "kPRV3" },
+ { "<c-prev>", "kPRV5" },
+
+ { 0, 0 },
+};
+#endif
+
/**
* alloc_keys - Allocate space for a sequence of keys
* @param len Number of keys
}
#ifdef NCURSES_VERSION
-/**
- * struct Extkey - Map key names from NeoMutt's style to Curses style
- */
-struct Extkey
-{
- const char *name;
- const char *sym;
-};
-
-static const struct Extkey ExtKeys[] = {
- { "<c-up>", "kUP5" },
- { "<s-up>", "kUP" },
- { "<a-up>", "kUP3" },
-
- { "<s-down>", "kDN" },
- { "<a-down>", "kDN3" },
- { "<c-down>", "kDN5" },
-
- { "<c-right>", "kRIT5" },
- { "<s-right>", "kRIT" },
- { "<a-right>", "kRIT3" },
-
- { "<s-left>", "kLFT" },
- { "<a-left>", "kLFT3" },
- { "<c-left>", "kLFT5" },
-
- { "<s-home>", "kHOM" },
- { "<a-home>", "kHOM3" },
- { "<c-home>", "kHOM5" },
-
- { "<s-end>", "kEND" },
- { "<a-end>", "kEND3" },
- { "<c-end>", "kEND5" },
-
- { "<s-next>", "kNXT" },
- { "<a-next>", "kNXT3" },
- { "<c-next>", "kNXT5" },
-
- { "<s-prev>", "kPRV" },
- { "<a-prev>", "kPRV3" },
- { "<c-prev>", "kPRV5" },
-
- { 0, 0 },
-};
-
/**
* find_ext_name - Find the curses name for a key
* @param key Key name
}
/**
- * mbox_open_readwrite - Open an mbox read-only
+ * mbox_open_readonly - Open an mbox read-only
* @param m Mailbox
* @retval ptr FILE handle
*
static struct LookupList Lookups = TAILQ_HEAD_INITIALIZER(Lookups);
-/**
- * lookup_new - Create a new Lookup
- * @retval ptr New Lookup
- */
-struct Lookup *lookup_new(void)
-{
- return mutt_mem_calloc(1, sizeof(struct Lookup));
-}
-
-/**
- * lookup_free - Free a Lookup
- * @param ptr Lookup to free
- */
-void lookup_free(struct Lookup **ptr)
-{
- if (!ptr || !*ptr)
- return;
-
- struct Lookup *l = *ptr;
- FREE(&l->replacement);
- FREE(&l->regex.pattern);
- if (l->regex.regex)
- regfree(l->regex.regex);
- FREE(&l->regex.regex);
- FREE(&l->regex);
-
- FREE(ptr);
-}
-
// clang-format off
/**
* PreferredMimeNames - Lookup table of preferred charsets
};
// clang-format on
+/**
+ * lookup_new - Create a new Lookup
+ * @retval ptr New Lookup
+ */
+struct Lookup *lookup_new(void)
+{
+ return mutt_mem_calloc(1, sizeof(struct Lookup));
+}
+
+/**
+ * lookup_free - Free a Lookup
+ * @param ptr Lookup to free
+ */
+void lookup_free(struct Lookup **ptr)
+{
+ if (!ptr || !*ptr)
+ return;
+
+ struct Lookup *l = *ptr;
+ FREE(&l->replacement);
+ FREE(&l->regex.pattern);
+ if (l->regex.regex)
+ regfree(l->regex.regex);
+ FREE(&l->regex.regex);
+ FREE(&l->regex);
+
+ FREE(ptr);
+}
+
/**
* lookup_charset - Look for a preferred character set name
* @param type Type, e.g. #MUTT_LOOKUP_CHARSET
#include <sysexits.h>
#endif
+/**
+ * char_cmp - Pointer to a function taking two characters and returning bool
+ */
+typedef bool (*char_cmp)(char, char);
+
/**
* struct SysExits - Lookup table of error messages
*/
return tolower((unsigned char) a) == tolower((unsigned char) b);
}
-/**
- * char_cmp - Pointer to a function taking two characters and returning bool
- */
-typedef bool (*char_cmp)(char, char);
-
/**
* get_char_cmp - Retrieve the correct function to compare characters according to a case sensitivity setting
* @param cs Case sensitivity setting
(void) luaL_dostring(l, buf);
}
+lua_State *LuaState = NULL;
+
static const luaL_Reg luaMuttDecl[] = {
{ "set", lua_mutt_set }, { "get", lua_mutt_get },
{ "call", lua_mutt_call }, { "enter", lua_mutt_enter },
return true;
}
-/* Public API --------------------------------------------------------------- */
-
-lua_State *LuaState = NULL;
-
/**
* mutt_lua_parse - Parse the 'lua' command - Implements ::command_t
*/
/* These Config Variables are only used in muttlib.c */
struct Regex *C_GecosMask; ///< Config: Regex for parsing GECOS field of /etc/passwd
+static FILE *fp_random;
+
+static const unsigned char base32[] = "abcdefghijklmnopqrstuvwxyz234567";
+
static const char *xdg_env_vars[] = {
[XDG_CONFIG_HOME] = "XDG_CONFIG_HOME",
[XDG_CONFIG_DIRS] = "XDG_CONFIG_DIRS",
return false;
}
-static FILE *fp_random;
-
/**
* mutt_randbuf - Fill a buffer with randomness
* @param buf Buffer for result
return 0;
}
-static const unsigned char base32[] = "abcdefghijklmnopqrstuvwxyz234567";
-
/**
* mutt_rand_base32 - Fill a buffer with a base32-encoded random string
* @param buf Buffer for result
/* These Config Variables are only used in muttlib.c */
extern struct Regex *C_GecosMask;
-#define MUTT_RANDTAG_LEN 16
-
void mutt_adv_mktemp(struct Buffer *buf);
void mutt_buffer_mktemp_full(struct Buffer *buf, const char *prefix, const char *suffix, const char *src, int line);
void mutt_buffer_encode_path(struct Buffer *buf, const char *src);
struct PgpCache *next;
};
+/**
+ * struct PgpEntry - An entry in a PGP key menu
+ */
+struct PgpEntry
+{
+ size_t num;
+ struct PgpUid *uid;
+};
+
static struct PgpCache *id_defaults = NULL;
static const char trust_flags[] = "?- +";
return key;
}
-/**
- * struct PgpEntry - An entry in a PGP key menu
- */
-struct PgpEntry
-{
- size_t num;
- struct PgpUid *uid;
-};
-
/**
* pgp_entry_fmt - Format an entry on the PGP key selection menu - Implements ::format_t
*
if (*buf == '5')
continue;
}
-
else
{
#ifdef USE_SASL
}
else if (strcmp(item->name, "type") == 0)
mdata->query_type = string_to_query_type(item->value);
-
else if (strcmp(item->name, "query") == 0)
mdata->db_query = mutt_str_strdup(item->value);
}
static char LastSearch[256] = { 0 }; /**< last pattern searched for */
static char LastSearchExpn[1024] = { 0 }; /**< expanded version of LastSearch */
+/**
+ * typedef addr_predicate_t - Test an Address for some condition
+ * @param a Address to test
+ * @retval bool True if Address matches the test
+ */
+typedef bool (*addr_predicate_t)(const struct Address *a);
+
/**
* eat_regex - Parse a regex - Implements ::pattern_eat_t
*/
return false;
}
-/**
- * typedef addr_predicate_t - Test an Address for some condition
- * @param a Address to test
- * @retval bool True if Address matches the test
- */
-typedef bool (*addr_predicate_t)(const struct Address *a);
-
/**
* mutt_is_predicate_recipient - Test an Envelopes Addresses using a predicate function
* @param all_addr If true, ALL Addresses must match
const char *c = mutt_str_skip_email_wsp(line + 4);
mutt_buffer_strcpy(&adata->auth_list, c);
}
-
else if (mutt_str_startswith(line, "STLS", CASE_IGNORE))
adata->cmd_stls = true;
-
else if (mutt_str_startswith(line, "USER", CASE_IGNORE))
adata->cmd_user = 1;
-
else if (mutt_str_startswith(line, "UIDL", CASE_IGNORE))
adata->cmd_uidl = 1;
-
else if (mutt_str_startswith(line, "TOP", CASE_IGNORE))
adata->cmd_top = 1;
hdr->security = mutt_parse_crypt_hdr(strchr(np->data, ':') + 1, true, APPLICATION_SMIME);
hdr->security |= APPLICATION_SMIME;
}
-
#ifdef MIXMASTER
else if (mutt_str_startswith(np->data, "X-Mutt-Mix:", CASE_MATCH))
{
}
}
#endif
-
else
{
// skip header removal
struct Email *e_parent = NULL;
FILE *fp_parent = NULL;
struct Email *e_tmp = NULL;
- struct State st;
FILE *fp_tmp = NULL;
struct Buffer *tmpbody = NULL;
{
mutt_make_attribution(Context->mailbox, e_parent, fp_tmp);
+ struct State st;
memset(&st, 0, sizeof(struct State));
st.fp_out = fp_tmp;
short c; /**< column */
};
+static const struct Mapping RemailerHelp[] = {
+ { N_("Append"), OP_MIX_APPEND }, { N_("Insert"), OP_MIX_INSERT },
+ { N_("Delete"), OP_MIX_DELETE }, { N_("Abort"), OP_EXIT },
+ { N_("OK"), OP_MIX_USE }, { NULL, 0 },
+};
+
/**
* mix_get_caps - Get Mixmaster Capabilities
* @param capstr Capability string to parse
return 0;
}
-static const struct Mapping RemailerHelp[] = {
- { N_("Append"), OP_MIX_APPEND }, { N_("Insert"), OP_MIX_INSERT },
- { N_("Delete"), OP_MIX_DELETE }, { N_("Abort"), OP_EXIT },
- { N_("OK"), OP_MIX_USE }, { NULL, 0 },
-};
-
/**
* mix_make_chain - Create a Mixmaster chain
* @param win Window
return 0;
}
+/**
+ * choose_default_to - Pick the best 'to:' value
+ * @param from From Address
+ * @param env Envelope
+ * @retval ptr Addresses to use
+ */
static const struct AddressList *choose_default_to(const struct Address *from,
const struct Envelope *env)
{
bool C_UserAgent; ///< Config: Add a 'User-Agent' head to outgoing mail
short C_WrapHeaders; ///< Config: Width to wrap headers in outgoing messages
+#define MUTT_RANDTAG_LEN 16
+
+/**
+ * struct B64Context - Cursor for the Base64 conversion
+ */
+struct B64Context
+{
+ char buffer[3];
+ short size;
+ short linelen;
+};
+
+/**
+ * struct ContentState - Info about the body of an email
+ */
+struct ContentState
+{
+ bool from;
+ int whitespace;
+ bool dot;
+ int linelen;
+ bool was_cr;
+};
+
+/**
+ * The next array/enum pair is used to to keep track of user headers that
+ * override pre-defined headers NeoMutt would emit. Keep the array sorted and
+ * in sync with the enum.
+ */
+static const char *const userhdrs_override_headers[] = {
+ "content-type:",
+ "user-agent:",
+};
+
+enum UserHdrsOverrideIdx
+{
+ USERHDRS_OVERRIDE_CONTENT_TYPE,
+ USERHDRS_OVERRIDE_USER_AGENT,
+};
+
+struct UserHdrsOverride
+{
+ bool is_overridden[mutt_array_size(userhdrs_override_headers)];
+};
+
/**
* encode_quoted - Encode text as quoted printable
* @param fc Cursor for converting a file's encoding
}
}
-/**
- * struct B64Context - Cursor for the Base64 conversion
- */
-struct B64Context
-{
- char buffer[3];
- short size;
- short linelen;
-};
-
/**
* b64_init - Set up the base64 conversion
* @param bctx Cursor for the base64 conversion
mutt_param_set(pl, "boundary", rs);
}
-/**
- * struct ContentState - Info about the body of an email
- */
-struct ContentState
-{
- bool from;
- int whitespace;
- bool dot;
- int linelen;
- bool was_cr;
-};
-
/**
* update_content_info - Cache some info about an email
* @param info Info about an Attachment
return rc;
}
-/**
- * The next array/enum pair is used to to keep track of user headers that
- * override pre-defined headers NeoMutt would emit. Keep the array sorted and
- * in sync with the enum.
- */
-static const char *const userhdrs_override_headers[] = {
- "content-type:",
- "user-agent:",
-};
-
-enum UserHdrsOverrideIdx
-{
- USERHDRS_OVERRIDE_CONTENT_TYPE,
- USERHDRS_OVERRIDE_USER_AGENT,
-};
-
-struct UserHdrsOverride
-{
- bool is_overridden[mutt_array_size(userhdrs_override_headers)];
-};
-
/**
* userhdrs_override_cmp - Compare a user-defined header with an element of the userhdrs_override_headers list
* @param a Pointer to the string containing the user-defined header