117 mutt_error(
_(
"This IMAP server is ancient. NeoMutt does not work with it."));
151 while (*s && (*s !=
')'))
155 const char *flag_word = s;
156 while (*s && (*s !=
')') && !isspace(*s))
158 const char ctmp = *s;
188 const char *str,
struct Buffer *flags)
231 bool changed,
bool invert,
struct UidArray *uida)
233 if (!emails || !uida)
236 for (
int i = 0; i < num_emails; i++)
238 struct Email *e = emails[i];
264 match = invert ^ e->
old;
268 match = invert ^ e->
read;
307 if ((m->
rights & right) == 0)
314 char buf[1024] = { 0 };
320 snprintf(buf,
sizeof(buf),
"+FLAGS.SILENT (%s)", name);
353 while ((pos < len) && buf->
data[pos] && (buf->
data[pos] == src[pos]))
355 buf->
data[pos] =
'\0';
400 struct Url url = { 0 };
401 char urlstr[1024] = { 0 };
438 char buf[2048] = { 0 };
439 char mbox[1024] = { 0 };
442 snprintf(buf,
sizeof(buf),
"CREATE %s", mbox);
480 char oldmbox[1024] = { 0 };
481 char newmbox[1024] = { 0 };
488 buf_printf(buf,
"RENAME %s %s", oldmbox, newmbox);
516 snprintf(
buf,
sizeof(
buf),
"DELETE %s", mbox);
539 if ((c_imap_poll_timeout <= 0) ||
567 if (!conn || (conn->
fd < 0))
591 unsigned long bytes,
struct Progress *progress)
595 struct Buffer buf = { 0 };
603 for (
unsigned long pos = 0; pos < bytes; pos++)
614 if (r && (c !=
'\n'))
629 if ((pos % 1024) == 0)
653 if (!mdata || !
edata)
673 if (!adata || !
mdata)
676 struct Email *e = NULL;
688 if (e->
index == INT_MAX)
789 mutt_error(
_(
"Could not negotiate TLS connection"));
802 if (c_ssl_force_tls && (adata->
conn->
ssf == 0))
819 if ((adata->
conn->
ssf == 0) && c_ssl_force_tls)
883 const size_t nplen = strlen(np->
data);
884 if ((flaglen >= nplen) && ((flag[nplen] ==
'\0') || (flag[nplen] ==
' ')) &&
902 const struct Email *ea = *(
struct Email const *
const *) a;
903 const struct Email *eb = *(
struct Email const *
const *) b;
932 if (!adata || (adata->
mailbox != m) || !e)
1002 err_continue && (*err_continue !=
MUTT_YES))
1004 *err_continue =
imap_continue(
"imap_sync_message: STORE failed", adata->
buf);
1107 char *uidvalidity_flag = NULL;
1108 char cmd[2048] = { 0 };
1110 if (!adata || !
mdata)
1120 return mdata->messages;
1124 return mdata->messages;
1128 uidvalidity_flag =
"UIDVALIDITY";
1132 uidvalidity_flag =
"UID-VALIDITY";
1140 snprintf(cmd,
sizeof(cmd),
"STATUS %s (UIDNEXT %s UNSEEN RECENT MESSAGES)",
1141 mdata->munge_name, uidvalidity_flag);
1149 return mdata->messages;
1176 const bool is_temp = !m;
1211 if (!adata || !
mdata)
1236 char buf[2048] = { 0 };
1237 snprintf(buf,
sizeof(buf),
"%sSUBSCRIBE %s", subscribe ?
"" :
"UN",
mdata->munge_name);
1246 if (c_imap_check_subscribed)
1248 char mbox[1024] = { 0 };
1249 size_t len = snprintf(mbox,
sizeof(mbox),
"%smailboxes ", subscribe ?
"" :
"un");
1279 char tmp[2048] = { 0 };
1281 struct Buffer *completion_buf = NULL;
1283 int completions = 0;
1294 snprintf(tmp,
sizeof(tmp),
"%s \"\" \"%s%%\"",
1295 c_imap_list_subscribed ?
"LSUB" :
"LIST", mdata->
real_name);
1307 listresp.
name = NULL;
1316 clen = strlen(listresp.
name);
1318 listresp.
name[clen] =
'\0';
1358 char prompt[1024] = { 0 };
1360 bool triedcreate =
false;
1415 mutt_message(ngettext(
"Copying %d message to %s...",
"Copying %d messages to %s...", rc),
1416 rc, dest_mdata->
name);
1433 snprintf(prompt,
sizeof(prompt),
_(
"Create %s?"), dest_mdata->
name);
1435 if (c_confirm_create &&
1476 struct Email **emails = NULL;
1525 "Marking %d messages deleted...", rc),
1563 mutt_message(ngettext(
"Saving changed message... [%d/%d]",
1564 "Saving changed messages... [%d/%d]", m->
msg_count),
1567 bool save_append = m->
append;
1646 mdata->
reopen &= ~IMAP_EXPUNGE_EXPECTED;
1650 mdata->
reopen &= ~IMAP_EXPUNGE_EXPECTED;
1653 if (expunge && close)
1661 if (c_message_cache_clean)
1728 char buf[1024] = { 0 };
1748 if (!adata || !
mdata)
1751 const char *condstore = NULL;
1755 condstore =
" (CONDSTORE)";
1761 snprintf(buf,
sizeof(buf),
"%s %s%s", m->
readonly ?
"EXAMINE" :
"SELECT",
1762 mdata->munge_name, condstore);
1825 imap_exec(adata,
"ID (\"name\" \"NeoMutt\" \"version\" \"" PACKAGE_VERSION
"\")",
1840 if (c_imap_rfc5161 && c_imap_qresync)
1887 mdata->new_mail_count = 0;
1895 snprintf(buf,
sizeof(buf),
"MYRIGHTS %s",
mdata->munge_name);
1909 if (postponed_adata &&
1916 if (c_imap_check_subscribed)
2091 snprintf(buf,
sizeof(buf),
_(
"Create %s?"),
mdata->name);
2093 if (c_confirm_create &&
2129 if (!adata || !
mdata)
2167 bool success =
false;
2196 char *new_tag = NULL;
2197 char *checker = NULL;
2202 mutt_error(
_(
"IMAP server doesn't support custom flags"));
2226 new_tag = buf->
data;
2227 checker = buf->
data;
2229 while (*checker !=
'\0')
2231 if ((*checker < 32) || (*checker >= 127) ||
2251 while ((checker[0] ==
' ') && (checker[1] ==
' '))
2255 *new_tag++ = *checker++;
2258 new_tag = buf->
data;
2279 char uid[11] = { 0 };
2420 .msg_padding_size = NULL,
#define ARRAY_SORT(head, fn, sdata)
Sort an array.
#define ARRAY_ADD(head, elem)
Add an element at the end of the array.
#define ARRAY_SIZE(head)
The number of elements stored.
#define ARRAY_FREE(head)
Release all memory.
#define ARRAY_HEAD_INITIALIZER
Static initializer for arrays.
const char * mutt_str_atoull(const char *str, unsigned long long *dst)
Convert ASCII string to an unsigned long long.
const char * mutt_str_atoui(const char *str, unsigned int *dst)
Convert ASCII string to an unsigned integer.
IMAP authenticator multiplexor.
@ IMAP_AUTH_SUCCESS
Authentication successful.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
int buf_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
size_t buf_len(const struct Buffer *buf)
Calculate the length of a Buffer.
void buf_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
void buf_fix_dptr(struct Buffer *buf)
Move the dptr to end of the Buffer.
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
char * buf_strdup(const struct Buffer *buf)
Copy a Buffer's string.
void buf_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Functions to parse commands in a config file.
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Convenience wrapper for the config headers.
void mutt_account_unsetpass(struct ConnAccount *cac)
Unset ConnAccount's password.
void commands_register(const struct Command *cmds, const size_t num_cmds)
Add commands to Commands array.
Convenience wrapper for the core headers.
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
void mailbox_changed(struct Mailbox *m, enum NotifyMailbox action)
Notify observers of a change to a Mailbox.
#define MUTT_ACL_CREATE
Create a mailbox.
@ NT_MAILBOX_RESORT
Email list needs resorting.
@ NT_MAILBOX_UPDATE
Update internal tables.
#define MUTT_ACL_POST
Post (submit messages to the server)
#define MUTT_ACL_LOOKUP
Lookup mailbox (visible to 'list')
#define MUTT_ACL_INSERT
Add/copy into the mailbox (used when editing a message)
#define MUTT_ACL_DELETE
Delete a message.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
uint16_t AclFlags
ACL Rights - These show permission to...
#define MUTT_ACL_WRITE
Write to a message (for flagging or linking threads)
MailboxType
Supported mailbox formats.
@ MUTT_IMAP
'IMAP' Mailbox type
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
#define MUTT_ACL_SEEN
Change the 'seen' status of a message.
#define MUTT_ACL_READ
Read the mailbox.
Structs that make up an email.
int mutt_save_message_mbox(struct Mailbox *m_src, struct Email *e, enum MessageSaveOpt save_opt, enum MessageTransformOpt transform_opt, struct Mailbox *m_dst)
Save a message to a given mailbox.
Manage where the email is piped to external commands.
@ TRANSFORM_NONE
No transformation.
@ SAVE_MOVE
Move message to another mailbox, removing the original.
#define mutt_file_fopen(PATH, MODE)
int mutt_ssl_starttls(struct Connection *conn)
Negotiate TLS over an already opened connection.
void imap_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free() -.
enum CommandResult parse_unsubscribe_from(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'unsubscribe-from' command - Implements Command::parse() -.
enum CommandResult parse_subscribe_to(struct Buffer *buf, struct Buffer *s, intptr_t data, struct Buffer *err)
Parse the 'subscribe-to' command - Implements Command::parse() -.
void imap_edata_free(void **ptr)
Free the private Email data - Implements Email::edata_free() -.
int mw_get_field(const char *prompt, struct Buffer *buf, CompletionFlags complete, enum HistoryClass hclass, const struct CompleteOps *comp_api, void *cdata)
Ask the user for a string -.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
void imap_mdata_free(void **ptr)
Free the private Mailbox data - Implements Mailbox::mdata_free() -.
static bool imap_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Implements MxOps::ac_add() -.
static bool imap_ac_owns_path(struct Account *a, const char *path)
Check whether an Account owns a Mailbox path - Implements MxOps::ac_owns_path() -.
const struct MxOps MxImapOps
IMAP Mailbox - Implements MxOps -.
static enum MxStatus imap_mbox_check_stats(struct Mailbox *m, uint8_t flags)
Check the Mailbox statistics - Implements MxOps::mbox_check_stats() -.
static enum MxStatus imap_mbox_check(struct Mailbox *m)
Check for new mail - Implements MxOps::mbox_check() -.
static enum MxStatus imap_mbox_close(struct Mailbox *m)
Close a Mailbox - Implements MxOps::mbox_close() -.
static bool imap_mbox_open_append(struct Mailbox *m, OpenMailboxFlags flags)
Open a Mailbox for appending - Implements MxOps::mbox_open_append() -.
static enum MxOpenReturns imap_mbox_open(struct Mailbox *m)
Open a mailbox - Implements MxOps::mbox_open() -.
int imap_msg_close(struct Mailbox *m, struct Message *msg)
Close an email - Implements MxOps::msg_close() -.
int imap_msg_commit(struct Mailbox *m, struct Message *msg)
Save changes to an email - Implements MxOps::msg_commit() -.
static bool imap_msg_open_new(struct Mailbox *m, struct Message *msg, const struct Email *e)
Open a new message in a Mailbox - Implements MxOps::msg_open_new() -.
bool imap_msg_open(struct Mailbox *m, struct Message *msg, struct Email *e)
Open an email message in a Mailbox - Implements MxOps::msg_open() -.
int imap_msg_save_hcache(struct Mailbox *m, struct Email *e)
Save message to the header cache - Implements MxOps::msg_save_hcache() -.
int imap_path_canon(struct Buffer *path)
Canonicalise a Mailbox path - Implements MxOps::path_canon() -.
static int imap_path_is_empty(struct Buffer *path)
Is the mailbox empty - Implements MxOps::path_is_empty() -.
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe() -.
int imap_sort_uid(const void *a, const void *b, void *sdata)
Compare two UIDs - Implements sort_t -.
static int imap_sort_email_uid(const void *a, const void *b, void *sdata)
Compare two Emails by UID - Implements sort_t -.
void mutt_hash_int_delete(struct HashTable *table, unsigned int intkey, const void *data)
Remove an element from a Hash Table.
Read/write command history from/to a file.
@ HC_OTHER
Miscellaneous strings.
void mutt_account_hook(const char *url)
Perform an account hook.
Parse and execute user-defined hooks.
struct ImapAccountData * imap_adata_new(struct Account *a)
Allocate and initialise a new ImapAccountData structure.
struct ImapAccountData * imap_adata_get(struct Mailbox *m)
Get the Account data for this mailbox.
int imap_authenticate(struct ImapAccountData *adata)
Authenticate to an IMAP server.
int imap_cmd_start(struct ImapAccountData *adata, const char *cmdstr)
Given an IMAP command, send it to the server.
const char * imap_cmd_trailer(struct ImapAccountData *adata)
Extra information after tagged command response if any.
int imap_cmd_idle(struct ImapAccountData *adata)
Enter the IDLE state.
int imap_cmd_step(struct ImapAccountData *adata)
Reads server responses from an IMAP command.
int imap_exec(struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags)
Execute a command and wait for the response from the server.
void imap_cmd_finish(struct ImapAccountData *adata)
Attempt to perform cleanup.
struct ImapEmailData * imap_edata_get(struct Email *e)
Get the private data for this Email.
int imap_parse_path(const char *path, struct ConnAccount *cac, char *mailbox, size_t mailboxlen)
Parse an IMAP mailbox name into ConnAccount, name.
struct ImapMboxData * imap_mdata_new(struct ImapAccountData *adata, const char *name)
Allocate and initialise a new ImapMboxData structure.
struct ImapMboxData * imap_mdata_get(struct Mailbox *m)
Get the Mailbox data for this mailbox.
int imap_cache_clean(struct Mailbox *m)
Delete all the entries in the message cache.
int imap_cache_del(struct Mailbox *m, struct Email *e)
Delete an email from the body cache.
int imap_read_headers(struct Mailbox *m, unsigned int msn_begin, unsigned int msn_end, bool initial_download)
Read headers from the server.
#define IMAP_CAP_ENABLE
RFC5161.
#define IMAP_CAP_IDLE
RFC2177: IDLE.
#define IMAP_CMD_NO_FLAGS
No flags are set.
void imap_qualify_path(char *buf, size_t buflen, struct ConnAccount *conn_account, char *path)
Make an absolute IMAP folder target.
#define IMAP_CAP_ID
RFC2971: IMAP4 ID extension.
void imap_allow_reopen(struct Mailbox *m)
Allow re-opening a folder upon expunge.
void imap_disallow_reopen(struct Mailbox *m)
Disallow re-opening a folder upon expunge.
@ IMAP_DISCONNECTED
Disconnected from server.
@ IMAP_IDLE
Connection is idle.
@ IMAP_AUTHENTICATED
Connection is authenticated.
@ IMAP_SELECTED
Mailbox is selected.
@ IMAP_CONNECTED
Connected to server.
#define IMAP_EXPUNGE_PENDING
Messages on the server have been expunged.
void imap_hcache_open(struct ImapAccountData *adata, struct ImapMboxData *mdata, bool create)
Open a header cache.
#define IMAP_RES_OK
<tag> OK ...
#define IMAP_OPEN_NO_FLAGS
No flags are set.
#define IMAP_EXPUNGE_EXPECTED
Messages will be expunged from the server.
int imap_hcache_put(struct ImapMboxData *mdata, struct Email *e)
Add an entry to the header cache.
#define IMAP_CMD_POLL
Poll the tcp connection before running the imap command.
void imap_mdata_cache_reset(struct ImapMboxData *mdata)
Release and clear cache data of ImapMboxData structure.
#define IMAP_CAP_IMAP4
Server supports IMAP4.
#define IMAP_CAP_STARTTLS
RFC2595: STARTTLS.
#define IMAP_CAP_IMAP4REV1
Server supports IMAP4rev1.
#define IMAP_CAP_STATUS
Server supports STATUS command.
void imap_quote_string(char *dest, size_t dlen, const char *src, bool quote_backtick)
Quote string according to IMAP rules.
enum QuadOption imap_continue(const char *msg, const char *resp)
Display a message and ask the user if they want to go on.
#define IMAP_CMD_PASS
Command contains a password. Suppress logging.
void imap_buf_qualify_path(struct Buffer *buf, struct ConnAccount *conn_account, char *path)
Make an absolute IMAP folder target to a buffer.
ImapExecResult
Imap_exec return code.
@ IMAP_EXEC_SUCCESS
Imap command executed or queued successfully.
@ IMAP_EXEC_ERROR
Imap command failure.
@ IMAP_EXEC_FATAL
Imap connection failure.
#define IMAP_CAP_ACL
RFC2086: IMAP4 ACL extension.
#define IMAP_CAP_QRESYNC
RFC7162.
#define IMAP_NEWMAIL_PENDING
New mail is waiting on the server.
char * imap_fix_path(const char *mailbox, char *path, size_t plen)
Fix up the imap path.
void imap_error(const char *where, const char *msg)
Show an error and abort.
#define IMAP_FLAGS_PENDING
Flags have changed on the server.
void imap_hcache_close(struct ImapMboxData *mdata)
Close the header cache.
@ IMAP_BYE
Logged out from server.
@ IMAP_FATAL
Unrecoverable error occurred.
char * imap_fix_path_with_delim(char delim, const char *mailbox, char *path, size_t plen)
Fix up the imap path.
#define IMAP_CAP_COMPRESS
RFC4978: COMPRESS=DEFLATE.
int imap_hcache_del(struct ImapMboxData *mdata, unsigned int uid)
Delete an item from the header cache.
#define IMAP_RES_NO
<tag> NO ...
int imap_adata_find(const char *path, struct ImapAccountData **adata, struct ImapMboxData **mdata)
Find the Account data for this path.
bool imap_account_match(const struct ConnAccount *a1, const struct ConnAccount *a2)
Compare two Accounts.
void imap_munge_mbox_name(bool unicode, char *dest, size_t dlen, const char *src)
Quote awkward characters in a mailbox name.
#define IMAP_CMD_SINGLE
Run a single command.
#define IMAP_RES_CONTINUE
* ...
char * imap_next_word(char *s)
Find where the next IMAP word begins.
#define IMAP_CAP_CONDSTORE
RFC7162.
#define IMAP_CMD_QUEUE
Queue a command, do not execute.
char * imap_get_qualifier(char *buf)
Get the qualifier from a tagged response.
static void imap_logout(struct ImapAccountData *adata)
Gracefully log out of server.
int imap_mailbox_status(struct Mailbox *m, bool queue)
Refresh the number of total and new messages.
int imap_path_status(const char *path, bool queue)
Refresh the number of total and new messages.
void imap_notify_delete_email(struct Mailbox *m, struct Email *e)
Inform IMAP that an Email has been deleted.
void imap_close_connection(struct ImapAccountData *adata)
Close an IMAP connection.
static int imap_status(struct ImapAccountData *adata, struct ImapMboxData *mdata, bool queue)
Refresh the number of total and new messages.
int imap_complete(struct Buffer *buf, const char *path)
Try to complete an IMAP folder path.
int imap_subscribe(const char *path, bool subscribe)
Subscribe to a mailbox.
int imap_delete_mailbox(struct Mailbox *m, char *path)
Delete a mailbox.
void imap_expunge_mailbox(struct Mailbox *m, bool resort)
Purge messages from the server.
static size_t longest_common_prefix(struct Buffer *buf, const char *src, size_t start)
Find longest prefix common to two strings.
int imap_open_connection(struct ImapAccountData *adata)
Open an IMAP connection.
static int sync_helper(struct Mailbox *m, struct Email **emails, int num_emails, AclFlags right, enum MessageType flag, const char *name)
Sync flag changes to the server.
int imap_rename_mailbox(struct ImapAccountData *adata, char *oldname, const char *newname)
Rename a mailbox.
static int complete_hosts(struct Buffer *buf)
Look for completion matches for mailboxes.
int imap_create_mailbox(struct ImapAccountData *adata, const char *mailbox)
Create a new mailbox.
static int check_capabilities(struct ImapAccountData *adata)
Make sure we can log in to this server.
int imap_fast_trash(struct Mailbox *m, const char *dest)
Use server COPY command to copy deleted messages to trash.
int imap_sync_message_for_copy(struct Mailbox *m, struct Email *e, struct Buffer *cmd, enum QuadOption *err_continue)
Update server to reflect the flags of a single message.
static int select_email_uids(struct Email **emails, int num_emails, enum MessageType flag, bool changed, bool invert, struct UidArray *uida)
Create a list of Email UIDs by type.
enum MxStatus imap_sync_mailbox(struct Mailbox *m, bool expunge, bool close)
Sync all the changes to the server.
int imap_access(const char *path)
Check permissions on an IMAP mailbox with a new connection.
void imap_logout_all(void)
Close all open connections.
enum MxStatus imap_check_mailbox(struct Mailbox *m, bool force)
Use the NOOP or IDLE command to poll for new mail.
static char * get_flags(struct ListHead *hflags, char *s)
Make a simple list out of a FLAGS response.
int imap_read_literal(FILE *fp, struct ImapAccountData *adata, unsigned long bytes, struct Progress *progress)
Read bytes bytes from server into file.
bool imap_has_flag(struct ListHead *flag_list, const char *flag)
Does the flag exist in the list.
static void set_flag(struct Mailbox *m, AclFlags aclflag, bool flag, const char *str, struct Buffer *flags)
Append str to flags if we currently have permission according to aclflag.
static void imap_mbox_select(struct Mailbox *m)
Select a Mailbox.
int imap_login(struct ImapAccountData *adata)
Open an IMAP connection.
static const struct Command ImapCommands[]
Imap Commands.
void imap_init(void)
Setup feature commands.
static bool compare_flags_for_copy(struct Email *e)
Compare local flags against the server.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
@ LL_DEBUG3
Log at debug level 3.
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
#define mutt_array_size(x)
int imap_exec_msg_set(struct ImapAccountData *adata, const char *pre, const char *post, struct UidArray *uida)
Execute a command using a set of UIDs.
void imap_msn_remove(struct MSNArray *msn, size_t idx)
Remove an entry from the cache.
IMAP MSN helper functions.
time_t mutt_date_now(void)
Return the number of seconds since the Unix epoch.
Convenience wrapper for the library headers.
void mutt_str_remove_trailing_ws(char *s)
Trim trailing whitespace from a string.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
char * mutt_str_dup(const char *str)
Copy a string, safely.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
bool mutt_istrn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings ignoring case (to a maximum), safely.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Many unsorted constants and some structs.
#define MUTT_COMP_NO_FLAGS
No flags are set.
MessageType
To set flags or match patterns.
@ MUTT_TRASH
Trashed messages.
@ MUTT_READ
Messages that have been read.
@ MUTT_FLAG
Flagged messages.
@ MUTT_DELETED
Deleted messages.
@ MUTT_REPLIED
Messages that have been replied to.
void mutt_account_tourl(struct ConnAccount *cac, struct Url *url)
Fill URL with info from account.
@ MUTT_ACCT_TYPE_IMAP
Imap Account.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
struct Connection * mutt_conn_new(const struct ConnAccount *cac)
Create a new Connection.
void buf_pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
Some miscellaneous functions.
void mx_alloc_memory(struct Mailbox *m, int req_size)
Create storage for the emails.
int mx_ac_remove(struct Mailbox *m, bool keep_account)
Remove a Mailbox from an Account and delete Account if empty.
struct Mailbox * mx_mbox_find2(const char *path)
Find a Mailbox on an Account.
bool mx_mbox_ac_link(struct Mailbox *m)
Link a Mailbox to an existing or new Account.
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
uint8_t OpenMailboxFlags
Flags for mutt_open_mailbox(), e.g. MUTT_NOSORT.
MxOpenReturns
Return values for mbox_open()
@ MX_OPEN_ERROR
Open failed with an error.
@ MX_OPEN_OK
Open succeeded.
#define MUTT_MAILBOX_CHECK_IMMEDIATE
Don't postpone the actual checking.
MxStatus
Return values from mbox_check(), mbox_check_stats(), mbox_sync(), and mbox_close()
@ MX_STATUS_ERROR
An error occurred.
@ MX_STATUS_OK
No changes.
@ MX_STATUS_FLAGS
Nondestructive flags change (IMAP)
@ MX_STATUS_REOPENED
Mailbox was reopened.
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
Notmuch-specific Mailbox data.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Pop-specific Account data.
bool progress_update(struct Progress *progress, size_t pos, int percent)
Update the state of the progress bar.
void mutt_qsort_r(void *base, size_t nmemb, size_t size, sort_t compar, void *sdata)
Sort an array, where the comparator has access to opaque data rather than requiring global variables.
QuadOption
Possible values for a quad-option.
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
@ MUTT_NO
User answered 'No', or assume 'No'.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
enum QuadOption query_yesorno_help(const char *prompt, enum QuadOption def, struct ConfigSubset *sub, const char *name)
Ask the user a Yes/No question offering help.
enum QuadOption query_quadoption(const char *prompt, struct ConfigSubset *sub, const char *name)
Ask the user a quad-question.
enum QuadOption query_yesorno(const char *prompt, enum QuadOption def)
Ask the user a Yes/No question.
#define TAILQ_FOREACH(var, head, field)
#define STAILQ_HEAD_INITIALIZER(head)
#define STAILQ_FOREACH(var, head, field)
#define STAILQ_EMPTY(head)
enum CommandResult parse_rc_line(const char *line, struct Buffer *err)
Parse a line of user config.
int mutt_socket_close(struct Connection *conn)
Close a socket.
int mutt_socket_poll(struct Connection *conn, time_t wait_secs)
Checks whether reads would block.
int mutt_socket_readchar(struct Connection *conn, char *c)
Simple read buffering to speed things up.
void mutt_socket_empty(struct Connection *conn)
Clear out any queued data.
int mutt_socket_open(struct Connection *conn)
Simple wrapper.
Assorted sorting methods.
#define mutt_numeric_cmp(a, b)
A group of associated Mailboxes.
enum MailboxType type
Type of Mailboxes this Account contains.
char * name
Name of Account.
void(* adata_free)(void **ptr)
void * adata
Private data (for Mailbox backends)
String manipulation buffer.
char * data
Pointer to data.
Login details for a remote server.
char host[128]
Server to login to.
unsigned int ssf
Security strength factor, in bits (see notes)
struct ConnAccount account
Account details: username, password, etc.
int fd
Socket file descriptor.
The envelope/body of an email.
bool purge
Skip trash folder when deleting.
struct Envelope * env
Envelope information.
void * edata
Driver-specific data.
bool active
Message is not to be removed.
bool old
Email is seen, but unread.
bool changed
Email has been edited.
bool attach_del
Has an attachment marked for deletion.
bool flagged
Marked important?
bool replied
Email has been replied to.
struct TagList tags
For drivers that support server tagging.
char * path
Path of Email (for local Mailboxes)
bool deleted
Email is deleted.
int index
The absolute (unsorted) message number.
unsigned char changed
Changed fields, e.g. MUTT_ENV_CHANGED_SUBJECT.
IMAP-specific Account data -.
char delim
Path delimiter.
struct Mailbox * prev_mailbox
Previously selected mailbox.
struct ImapList * cmdresult
int lastcmd
Last command in the queue.
bool closing
If true, we are waiting for CLOSE completion.
time_t lastread
last time we read a command for the server
bool unicode
If true, we can send UTF-8, and the server will use UTF8 rather than mUTF7.
ImapCapFlags capabilities
Capability flags.
int nextcmd
Next command to be sent.
unsigned char state
ImapState, e.g. IMAP_AUTHENTICATED.
struct Mailbox * mailbox
Current selected mailbox.
char * capstr
Capability string from the server.
struct ImapCommand * cmds
Queue of commands for the server.
unsigned char status
ImapFlags, e.g. IMAP_FATAL.
int cmdslots
Size of the command queue.
unsigned int seqno
tag sequence number, e.g. '{seqid}0001'
struct Connection * conn
Connection to IMAP server.
IMAP-specific Email data -.
unsigned int uid
32-bit Message UID
bool deleted
Email has been deleted.
Items in an IMAP browser.
IMAP-specific Mailbox data -.
ImapOpenFlags reopen
Flags, e.g. IMAP_REOPEN_ALLOW.
char * real_name
Original Mailbox name, e.g.: INBOX can be just \0.
unsigned int new_mail_count
Set when EXISTS notifies of new mail.
struct HashTable * uid_hash
Hash Table: "uid" -> Email.
unsigned long long modseq
char * munge_name
Munged version of the mailbox name.
struct Mailbox * mailbox
Mailbox in the list.
void(* mdata_free)(void **ptr)
int vcount
The number of virtual messages.
bool changed
Mailbox has been modified.
bool has_new
Mailbox has new mail.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
bool append
Mailbox is opened in append mode.
int msg_new
Number of new messages.
time_t last_checked
Last time we checked this mailbox for new mail.
int msg_count
Total number of messages.
AclFlags rights
ACL bits, see AclFlags.
bool poll_new_mail
Check for new mail.
void * mdata
Driver specific data.
struct Email ** emails
Array of Emails.
struct Buffer pathbuf
Path of the Mailbox.
int msg_deleted
Number of deleted messages.
struct Account * account
Account that owns this Mailbox.
off_t size
Size of the Mailbox.
int msg_flagged
Number of flagged messages.
bool readonly
Don't allow changes to the mailbox.
bool verbose
Display status messages?
int msg_unread
Number of unread messages.
A local copy of an email.
FILE * fp
pointer to the message data
char * path
path to temp file
enum MailboxType type
Mailbox type, e.g. MUTT_IMAP.
Container for Accounts, Notifications.
struct AccountList accounts
List of all Accounts.
struct ConfigSubset * sub
Inherited config items.
A parsed URL proto://user:password@host:port/path?a=1&b=2
struct Url * url_parse(const char *src)
Fill in Url.
void url_free(struct Url **ptr)
Free the contents of a URL.
int url_tostring(const struct Url *url, char *dest, size_t len, uint8_t flags)
Output the URL string for a given Url object.
void mutt_zstrm_wrap_conn(struct Connection *conn)
Wrap a compression layer around a Connection.