25#ifndef MUTT_IMAP_PRIVATE_H
26#define MUTT_IMAP_PRIVATE_H
45#define IMAP_SSL_PORT 993
48#define IMAP_LOG_LTRL 3
49#define IMAP_LOG_PASS 5
53#define IMAP_RES_BAD -1
55#define IMAP_RES_CONTINUE 1
56#define IMAP_RES_RESPOND 2
101#define IMAP_DATELEN 27
159#define IMAP_CAP_ALL ((1 << 21) - 1)
206bool imap_has_flag(
struct ListHead *flag_list,
const char *flag);
247void imap_error(
const char *where,
const char *msg);
257void imap_quote_string(
char *dest,
size_t dlen,
const char *src,
bool quote_backtick);
265void imap_get_parent(
const char *mbox,
char delim,
char *buf,
size_t buflen);
Convenience wrapper for the config headers.
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() -.
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_cmd_start(struct ImapAccountData *adata, const char *cmdstr)
Given an IMAP command, send it to the server.
void imap_unmunge_mbox_name(bool unicode, char *s)
Remove quoting from a mailbox name.
int imap_cache_clean(struct Mailbox *m)
Delete all the entries in the message cache.
void imap_close_connection(struct ImapAccountData *adata)
Close an IMAP connection.
void imap_qualify_path(char *buf, size_t buflen, struct ConnAccount *conn_account, char *path)
Make an absolute IMAP folder target.
char * imap_set_flags(struct Mailbox *m, struct Email *e, char *s, bool *server_changes)
Fill the message header according to the server flags.
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.
ImapState
IMAP connection state.
@ 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.
void imap_hcache_open(struct ImapAccountData *adata, struct ImapMboxData *mdata, bool create)
Open a header cache.
int imap_hcache_store_uid_seqset(struct ImapMboxData *mdata)
Store a UID Sequence Set in the header cache.
int imap_hcache_put(struct ImapMboxData *mdata, struct Email *e)
Add an entry to the header cache.
int imap_reopen_mailbox(struct ImapAccountData *adata)
Re-SELECT the current mailbox after reconnecting.
void imap_mdata_cache_reset(struct ImapMboxData *mdata)
Release and clear cache data of ImapMboxData structure.
void imap_get_parent(const char *mbox, char delim, char *buf, size_t buflen)
Get an IMAP folder's parent.
struct SeqsetIterator * mutt_seqset_iterator_new(const char *seqset)
Create a new Sequence Set Iterator.
bool mutt_account_match(const struct ConnAccount *a1, const struct ConnAccount *a2)
void imap_utf_encode(bool unicode, char **s)
Encode email from local charset to UTF-8.
void imap_quote_string(char *dest, size_t dlen, const char *src, bool quote_backtick)
Quote string according to IMAP rules.
char * imap_hcache_get_uid_seqset(struct ImapMboxData *mdata)
Get a UID Sequence Set from the header cache.
enum QuadOption imap_continue(const char *msg, const char *resp)
Display a message and ask the user if they want to go on.
void imap_unquote_string(char *s)
Equally stupid unquoting routine.
struct Email * imap_hcache_get(struct ImapMboxData *mdata, unsigned int uid)
Get a header cache entry by its UID.
const char * imap_cmd_trailer(struct ImapAccountData *adata)
Extra information after tagged command response if any.
int imap_append_message(struct Mailbox *m, struct Message *msg)
Write an email back to the server.
void imap_buf_qualify_path(struct Buffer *buf, struct ConnAccount *conn_account, char *path)
Make an absolute IMAP folder target to a buffer.
int mutt_seqset_iterator_next(struct SeqsetIterator *iter, unsigned int *next)
Get the next UID from a Sequence Set.
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.
void mutt_seqset_iterator_free(struct SeqsetIterator **ptr)
Free a Sequence Set Iterator.
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_get_literal_count(char *buf, unsigned int *bytes)
Write number of bytes in an IMAP literal into bytes.
void imap_expunge_mailbox(struct Mailbox *m, bool resort)
Purge messages from the server.
int imap_open_connection(struct ImapAccountData *adata)
Open an IMAP connection.
#define SEQ_LEN
Length of IMAP sequence buffer.
void imap_cachepath(char delim, const char *mailbox, struct Buffer *dest)
Generate a cache path for a mailbox.
int imap_rename_mailbox(struct ImapAccountData *adata, char *oldname, const char *newname)
Rename a mailbox.
int imap_create_mailbox(struct ImapAccountData *adata, const char *mailbox)
Create a new mailbox.
void imap_utf_decode(bool unicode, char **s)
Decode email from UTF-8 to local charset.
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.
void imap_hcache_close(struct ImapMboxData *mdata)
Close the header cache.
int imap_cache_del(struct Mailbox *m, struct Email *e)
Delete an email from the body cache.
ImapFlags
IMAP server responses.
@ 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.
int imap_hcache_del(struct ImapMboxData *mdata, unsigned int uid)
Delete an item from the header cache.
int imap_read_headers(struct Mailbox *m, unsigned int msn_begin, unsigned int msn_end, bool initial_download)
Read headers from the server.
ImapOpenFlag
State flags for IMAP mailbox reopen and sync handling.
@ IMAP_EXPUNGE_PENDING
Messages on the server have been expunged.
@ IMAP_NEWMAIL_PENDING
New mail is waiting on the server.
@ IMAP_SYNC_IN_PROGRESS
Sync is in progress, block expunge/newmail processing.
@ IMAP_EXPUNGE_EXPECTED
Messages will be expunged from the server.
@ IMAP_OPEN_NONE
No flags are set.
@ IMAP_FLAGS_PENDING
Flags have changed on the server.
@ IMAP_REOPEN_ALLOW
Allow re-opening a folder upon expunge.
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.
bool imap_code(const char *s)
Was the command successful.
int imap_hcache_clear_uid_seqset(struct ImapMboxData *mdata)
Delete a UID Sequence Set from the header cache.
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 cmd_parse_search(struct ImapAccountData *adata, const char *s)
Store SEARCH response for later use.
void imap_munge_mbox_name(bool unicode, char *dest, size_t dlen, const char *src)
Quote awkward characters in a mailbox name.
int imap_read_literal(FILE *fp, struct ImapAccountData *adata, unsigned long bytes, struct Progress *progress)
Read bytes bytes from server into file.
int imap_authenticate(struct ImapAccountData *adata)
Authenticate to an IMAP server.
ImapCapFlag
Capabilities we are interested in.
@ IMAP_CAP_CONDSTORE
RFC7162.
@ IMAP_CAP_QRESYNC
RFC7162.
@ IMAP_CAP_NONE
No flags are set.
@ IMAP_CAP_STARTTLS
RFC2595: STARTTLS.
@ IMAP_CAP_AUTH_CRAM_MD5
RFC2195: CRAM-MD5 authentication.
@ IMAP_CAP_AUTH_ANONYMOUS
AUTH=ANONYMOUS.
@ IMAP_CAP_X_GM_EXT_1
https://developers.google.com/gmail/imap/imap-extensions
@ IMAP_CAP_COMPRESS
RFC4978: COMPRESS=DEFLATE.
@ IMAP_CAP_ENABLE
RFC5161.
@ IMAP_CAP_IMAP4REV1
Server supports IMAP4rev1.
@ IMAP_CAP_IMAP4
Server supports IMAP4.
@ IMAP_CAP_NAMESPACE
RFC2342: IMAP4 Namespace.
@ IMAP_CAP_LOGINDISABLED
RFC2595: LOGINDISABLED.
@ IMAP_CAP_ID
RFC2971: IMAP4 ID extension.
@ IMAP_CAP_AUTH_XOAUTH2
AUTH=XOAUTH2, deprecated but used by OWA.
@ IMAP_CAP_AUTH_GSSAPI
RFC1731: GSSAPI authentication.
@ IMAP_CAP_ACL
RFC2086: IMAP4 ACL extension.
@ IMAP_CAP_STATUS
Server supports STATUS command.
@ IMAP_CAP_AUTH_OAUTHBEARER
RFC7628: AUTH=OAUTHBEARER.
@ IMAP_CAP_SASL_IR
SASL initial response draft.
@ IMAP_CAP_LIST_EXTENDED
RFC5258: IMAP4 LIST Command Extensions.
@ IMAP_CAP_IDLE
RFC2177: IDLE.
bool imap_has_flag(struct ListHead *flag_list, const char *flag)
Does the flag exist in the list.
char * imap_next_word(char *s)
Find where the next IMAP word begins.
int imap_exec(struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags)
Execute a command and wait for the response from the server.
ImapCmdFlag
Flags for imap_exec(), e.g.
@ IMAP_CMD_POLL
Poll the tcp connection before running the imap command.
@ IMAP_CMD_SINGLE
Run a single command.
@ IMAP_CMD_NONE
No flags are set.
@ IMAP_CMD_QUEUE
Queue a command, do not execute.
@ IMAP_CMD_PASS
Command contains a password. Suppress logging.
int imap_login(struct ImapAccountData *adata)
Open an IMAP connection.
void imap_cmd_finish(struct ImapAccountData *adata)
Attempt to perform cleanup.
char * imap_get_qualifier(char *buf)
Get the qualifier from a tagged response.
QuadOption
Possible values for a quad-option.
String manipulation buffer.
Login details for a remote server.
The envelope/body of an email.
char * path
Path of Email (for local Mailboxes)
IMAP-specific Account data -.
int state
Command state, e.g. IMAP_RES_NEW.
char seq[SEQ_LEN+1]
Command tag, e.g. 'a0001'.
Items in an IMAP browser.
bool noselect
Mailbox is not selectable.
bool noinferiors
Mailbox has no children.
char delim
Hierarchy delimiter.
IMAP-specific Mailbox data -.
A local copy of an email.
UID Sequence Set Iterator.
char * eostr
End of string.
char * substr_end
End of substring.
unsigned int range_end
End of range.
char * substr_cur
Current position in substring.
int in_range
Currently in a range.
char * full_seqset
Full sequence set string.
unsigned int range_cur
Current range value.