Shared constants/structs that are private to IMAP. More...
#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "hcache/lib.h"
Go to the source code of this file.
Data Structures | |
struct | ImapList |
Items in an IMAP browser. More... | |
struct | ImapCommand |
IMAP command structure. More... | |
struct | ImapAccountData |
IMAP-specific Account data -. More... | |
struct | ImapMboxData |
IMAP-specific Mailbox data -. More... | |
struct | SeqsetIterator |
UID Sequence Set Iterator. More... | |
Macros | |
#define | IMAP_PORT 143 |
Default port for IMAP. More... | |
#define | IMAP_SSL_PORT 993 |
Port for IMAP over SSL/TLS. More... | |
#define | IMAP_LOG_CMD 2 |
#define | IMAP_LOG_LTRL 3 |
#define | IMAP_LOG_PASS 5 |
#define | IMAP_RES_NO -2 |
<tag> NO ... More... | |
#define | IMAP_RES_BAD -1 |
<tag> BAD ... More... | |
#define | IMAP_RES_OK 0 |
<tag> OK ... More... | |
#define | IMAP_RES_CONTINUE 1 |
* ... More... | |
#define | IMAP_RES_RESPOND 2 |
+ More... | |
#define | IMAP_RES_NEW 3 |
ImapCommand.state additions. More... | |
#define | SEQ_LEN 16 |
#define | IMAP_MAX_CMDLEN 1024 |
Maximum length of command lines before they must be split (for lazy servers) More... | |
#define | IMAP_OPEN_NO_FLAGS 0 |
No flags are set. More... | |
#define | IMAP_REOPEN_ALLOW (1 << 0) |
Allow re-opening a folder upon expunge. More... | |
#define | IMAP_EXPUNGE_EXPECTED (1 << 1) |
Messages will be expunged from the server. More... | |
#define | IMAP_EXPUNGE_PENDING (1 << 2) |
Messages on the server have been expunged. More... | |
#define | IMAP_NEWMAIL_PENDING (1 << 3) |
New mail is waiting on the server. More... | |
#define | IMAP_FLAGS_PENDING (1 << 4) |
Flags have changed on the server. More... | |
#define | IMAP_CMD_NO_FLAGS 0 |
No flags are set. More... | |
#define | IMAP_CMD_PASS (1 << 0) |
Command contains a password. Suppress logging. More... | |
#define | IMAP_CMD_QUEUE (1 << 1) |
Queue a command, do not execute. More... | |
#define | IMAP_CMD_POLL (1 << 2) |
Poll the tcp connection before running the imap command. More... | |
#define | IMAP_CMD_SINGLE (1 << 3) |
Run a single command. More... | |
#define | IMAP_DATELEN 27 |
#define | IMAP_CAP_NO_FLAGS 0 |
No flags are set. More... | |
#define | IMAP_CAP_IMAP4 (1 << 0) |
Server supports IMAP4. More... | |
#define | IMAP_CAP_IMAP4REV1 (1 << 1) |
Server supports IMAP4rev1. More... | |
#define | IMAP_CAP_STATUS (1 << 2) |
Server supports STATUS command. More... | |
#define | IMAP_CAP_ACL (1 << 3) |
RFC2086: IMAP4 ACL extension. More... | |
#define | IMAP_CAP_NAMESPACE (1 << 4) |
RFC2342: IMAP4 Namespace. More... | |
#define | IMAP_CAP_AUTH_CRAM_MD5 (1 << 5) |
RFC2195: CRAM-MD5 authentication. More... | |
#define | IMAP_CAP_AUTH_GSSAPI (1 << 6) |
RFC1731: GSSAPI authentication. More... | |
#define | IMAP_CAP_AUTH_ANONYMOUS (1 << 7) |
AUTH=ANONYMOUS. More... | |
#define | IMAP_CAP_AUTH_OAUTHBEARER (1 << 8) |
RFC7628: AUTH=OAUTHBEARER. More... | |
#define | IMAP_CAP_STARTTLS (1 << 9) |
RFC2595: STARTTLS. More... | |
#define | IMAP_CAP_LOGINDISABLED (1 << 10) |
RFC2595: LOGINDISABLED. More... | |
#define | IMAP_CAP_IDLE (1 << 11) |
RFC2177: IDLE. More... | |
#define | IMAP_CAP_SASL_IR (1 << 12) |
SASL initial response draft. More... | |
#define | IMAP_CAP_ENABLE (1 << 13) |
RFC5161. More... | |
#define | IMAP_CAP_CONDSTORE (1 << 14) |
RFC7162. More... | |
#define | IMAP_CAP_QRESYNC (1 << 15) |
RFC7162. More... | |
#define | IMAP_CAP_LIST_EXTENDED (1 << 16) |
RFC5258: IMAP4 LIST Command Extensions. More... | |
#define | IMAP_CAP_COMPRESS (1 << 17) |
RFC4978: COMPRESS=DEFLATE. More... | |
#define | IMAP_CAP_X_GM_EXT_1 (1 << 18) |
https://developers.google.com/gmail/imap/imap-extensions More... | |
#define | IMAP_CAP_ALL ((1 << 19) - 1) |
Typedefs | |
typedef uint8_t | ImapOpenFlags |
Flags, e.g. MUTT_THREAD_COLLAPSE. More... | |
typedef uint8_t | ImapCmdFlags |
Flags for imap_exec(), e.g. IMAP_CMD_PASS. More... | |
typedef uint32_t | ImapCapFlags |
Capabilities we are interested in. More... | |
Enumerations | |
enum | ImapExecResult { IMAP_EXEC_SUCCESS = 0, IMAP_EXEC_ERROR, IMAP_EXEC_FATAL } |
imap_exec return code More... | |
enum | ImapFlags { IMAP_FATAL = 1, IMAP_BYE } |
IMAP server responses. More... | |
enum | ImapState { IMAP_DISCONNECTED = 0, IMAP_CONNECTED, IMAP_AUTHENTICATED, IMAP_SELECTED, IMAP_IDLE } |
IMAP connection state. More... | |
Functions | |
int | imap_create_mailbox (struct ImapAccountData *adata, char *mailbox) |
Create a new mailbox. More... | |
int | imap_rename_mailbox (struct ImapAccountData *adata, char *oldname, const char *newname) |
Rename a mailbox. More... | |
int | imap_exec_msgset (struct Mailbox *m, const char *pre, const char *post, int flag, bool changed, bool invert) |
Prepare commands for all messages matching conditions. More... | |
int | imap_open_connection (struct ImapAccountData *adata) |
Open an IMAP connection. More... | |
void | imap_close_connection (struct ImapAccountData *adata) |
Close an IMAP connection. More... | |
int | imap_read_literal (FILE *fp, struct ImapAccountData *adata, unsigned long bytes, struct Progress *pbar) |
Read bytes bytes from server into file. More... | |
void | imap_expunge_mailbox (struct Mailbox *m) |
Purge messages from the server. More... | |
int | imap_login (struct ImapAccountData *adata) |
Open an IMAP connection. More... | |
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. More... | |
bool | imap_has_flag (struct ListHead *flag_list, const char *flag) |
Does the flag exist in the list. More... | |
int | imap_adata_find (const char *path, struct ImapAccountData **adata, struct ImapMboxData **mdata) |
Find the Account data for this path. More... | |
int | imap_authenticate (struct ImapAccountData *adata) |
Authenticate to an IMAP server. More... | |
int | imap_cmd_start (struct ImapAccountData *adata, const char *cmdstr) |
Given an IMAP command, send it to the server. More... | |
int | imap_cmd_step (struct ImapAccountData *adata) |
Reads server responses from an IMAP command. More... | |
void | imap_cmd_finish (struct ImapAccountData *adata) |
Attempt to perform cleanup. More... | |
bool | imap_code (const char *s) |
Was the command successful. More... | |
const char * | imap_cmd_trailer (struct ImapAccountData *adata) |
Extra information after tagged command response if any. More... | |
int | imap_exec (struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags) |
Execute a command and wait for the response from the server. More... | |
int | imap_cmd_idle (struct ImapAccountData *adata) |
Enter the IDLE state. More... | |
void | imap_edata_free (void **ptr) |
Free the private Email data - Implements Email::edata_free() More... | |
struct ImapEmailData * | imap_edata_get (struct Email *e) |
Get the private data for this Email. More... | |
int | imap_read_headers (struct Mailbox *m, unsigned int msn_begin, unsigned int msn_end, bool initial_download) |
Read headers from the server. More... | |
char * | imap_set_flags (struct Mailbox *m, struct Email *e, char *s, bool *server_changes) |
fill the message header according to the server flags More... | |
int | imap_cache_del (struct Mailbox *m, struct Email *e) |
Delete an email from the body cache. More... | |
int | imap_cache_clean (struct Mailbox *m) |
Delete all the entries in the message cache. More... | |
int | imap_append_message (struct Mailbox *m, struct Message *msg) |
Write an email back to the server. More... | |
int | imap_msg_open (struct Mailbox *m, struct Message *msg, int msgno) |
Open an email message in a Mailbox - Implements MxOps::msg_open() More... | |
int | imap_msg_close (struct Mailbox *m, struct Message *msg) |
Close an email - Implements MxOps::msg_close() More... | |
int | imap_msg_commit (struct Mailbox *m, struct Message *msg) |
Save changes to an email - Implements MxOps::msg_commit() More... | |
int | imap_msg_save_hcache (struct Mailbox *m, struct Email *e) |
Save message to the header cache - Implements MxOps::msg_save_hcache() More... | |
struct ImapAccountData * | imap_adata_get (struct Mailbox *m) |
Get the Account data for this mailbox. More... | |
struct ImapMboxData * | imap_mdata_get (struct Mailbox *m) |
Get the Mailbox data for this mailbox. More... | |
void | imap_hcache_open (struct ImapAccountData *adata, struct ImapMboxData *mdata) |
Open a header cache. More... | |
void | imap_hcache_close (struct ImapMboxData *mdata) |
Close the header cache. More... | |
struct Email * | imap_hcache_get (struct ImapMboxData *mdata, unsigned int uid) |
Get a header cache entry by its UID. More... | |
int | imap_hcache_put (struct ImapMboxData *mdata, struct Email *e) |
Add an entry to the header cache. More... | |
int | imap_hcache_del (struct ImapMboxData *mdata, unsigned int uid) |
Delete an item from the header cache. More... | |
int | imap_hcache_store_uid_seqset (struct ImapMboxData *mdata) |
Store a UID Sequence Set in the header cache. More... | |
int | imap_hcache_clear_uid_seqset (struct ImapMboxData *mdata) |
Delete a UID Sequence Set from the header cache. More... | |
char * | imap_hcache_get_uid_seqset (struct ImapMboxData *mdata) |
Get a UID Sequence Set from the header cache. More... | |
enum QuadOption | imap_continue (const char *msg, const char *resp) |
display a message and ask the user if they want to go on More... | |
void | imap_error (const char *where, const char *msg) |
show an error and abort More... | |
struct ImapAccountData * | imap_adata_new (struct Account *a) |
Allocate and initialise a new ImapAccountData structure. More... | |
void | imap_adata_free (void **ptr) |
Free the private Account data - Implements Account::adata_free() More... | |
struct ImapMboxData * | imap_mdata_new (struct ImapAccountData *adata, const char *name) |
Allocate and initialise a new ImapMboxData structure. More... | |
void | imap_mdata_free (void **ptr) |
Free the private Mailbox data - Implements Mailbox::mdata_free() More... | |
void | imap_mdata_cache_reset (struct ImapMboxData *mdata) |
Release and clear cache data of ImapMboxData structure. More... | |
char * | imap_fix_path (char delim, const char *mailbox, char *path, size_t plen) |
Fix up the imap path. More... | |
void | imap_cachepath (char delim, const char *mailbox, struct Buffer *dest) |
Generate a cache path for a mailbox. More... | |
int | imap_get_literal_count (const char *buf, unsigned int *bytes) |
write number of bytes in an IMAP literal into bytes More... | |
char * | imap_get_qualifier (char *buf) |
Get the qualifier from a tagged response. More... | |
char * | imap_next_word (char *s) |
Find where the next IMAP word begins. More... | |
void | imap_qualify_path (char *buf, size_t buflen, struct ConnAccount *conn_account, char *path) |
Make an absolute IMAP folder target. More... | |
void | imap_quote_string (char *dest, size_t dlen, const char *src, bool quote_backtick) |
quote string according to IMAP rules More... | |
void | imap_unquote_string (char *s) |
equally stupid unquoting routine More... | |
void | imap_munge_mbox_name (bool unicode, char *dest, size_t dlen, const char *src) |
Quote awkward characters in a mailbox name. More... | |
void | imap_unmunge_mbox_name (bool unicode, char *s) |
Remove quoting from a mailbox name. More... | |
struct SeqsetIterator * | mutt_seqset_iterator_new (const char *seqset) |
Create a new Sequence Set Iterator. More... | |
int | mutt_seqset_iterator_next (struct SeqsetIterator *iter, unsigned int *next) |
Get the next UID from a Sequence Set. More... | |
void | mutt_seqset_iterator_free (struct SeqsetIterator **ptr) |
Free a Sequence Set Iterator. More... | |
bool | imap_account_match (const struct ConnAccount *a1, const struct ConnAccount *a2) |
Compare two Accounts. More... | |
void | imap_get_parent (const char *mbox, char delim, char *buf, size_t buflen) |
Get an IMAP folder's parent. More... | |
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. More... | |
void | imap_utf_decode (bool unicode, char **s) |
Decode email from UTF-8 to local charset. More... | |
void | imap_allow_reopen (struct Mailbox *m) |
Allow re-opening a folder upon expunge. More... | |
void | imap_disallow_reopen (struct Mailbox *m) |
Disallow re-opening a folder upon expunge. More... | |
void | cmd_parse_search (struct ImapAccountData *adata, const char *s) |
store SEARCH response for later use More... | |
Variables | |
struct Slist * | C_ImapAuthenticators |
Config: (imap) List of allowed IMAP authentication methods. More... | |
bool | C_ImapCheckSubscribed |
Config: (imap) When opening a mailbox, ask the server for a list of subscribed folders. More... | |
bool | C_ImapCondstore |
Config: (imap) Enable the CONDSTORE extension. More... | |
bool | C_ImapDeflate |
Config: (imap) Compress network traffic. More... | |
char * | C_ImapDelimChars |
Config: (imap) Characters that denote separators in IMAP folders. More... | |
long | C_ImapFetchChunkSize |
Config: (imap) Download headers in blocks of this size. More... | |
char * | C_ImapHeaders |
Config: (imap) Additional email headers to download when getting index. More... | |
bool | C_ImapIdle |
Config: (imap) Use the IMAP IDLE extension to check for new mail. More... | |
char * | C_ImapLogin |
Config: (imap) Login name for the IMAP server (defaults to $imap_user ) More... | |
char * | C_ImapOauthRefreshCommand |
Config: (imap) External command to generate OAUTH refresh token. More... | |
char * | C_ImapPass |
Config: (imap) Password for the IMAP server. More... | |
short | C_ImapPipelineDepth |
Config: (imap) Number of IMAP commands that may be queued up. More... | |
short | C_ImapPollTimeout |
Config: (imap) Maximum time to wait for a server response. More... | |
bool | C_ImapQresync |
Config: (imap) Enable the QRESYNC extension. More... | |
bool | C_ImapRfc5161 |
Config: (imap) Use the IMAP ENABLE extension to select capabilities. More... | |
bool | C_ImapServernoise |
Config: (imap) Display server warnings as error messages. More... | |
char * | C_ImapUser |
Config: (imap) Username for the IMAP server. More... | |
Shared constants/structs that are private to IMAP.
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 private.h.
#define IMAP_RES_NEW 3 |
ImapCommand.state additions.
#define IMAP_MAX_CMDLEN 1024 |
#define IMAP_REOPEN_ALLOW (1 << 0) |
#define IMAP_EXPUNGE_EXPECTED (1 << 1) |
#define IMAP_EXPUNGE_PENDING (1 << 2) |
#define IMAP_NEWMAIL_PENDING (1 << 3) |
#define IMAP_FLAGS_PENDING (1 << 4) |
#define IMAP_CMD_PASS (1 << 0) |
#define IMAP_CMD_QUEUE (1 << 1) |
#define IMAP_CMD_POLL (1 << 2) |
#define IMAP_CAP_IMAP4REV1 (1 << 1) |
#define IMAP_CAP_STATUS (1 << 2) |
#define IMAP_CAP_ACL (1 << 3) |
#define IMAP_CAP_NAMESPACE (1 << 4) |
#define IMAP_CAP_AUTH_CRAM_MD5 (1 << 5) |
#define IMAP_CAP_AUTH_GSSAPI (1 << 6) |
#define IMAP_CAP_AUTH_OAUTHBEARER (1 << 8) |
#define IMAP_CAP_LOGINDISABLED (1 << 10) |
#define IMAP_CAP_SASL_IR (1 << 12) |
#define IMAP_CAP_LIST_EXTENDED (1 << 16) |
#define IMAP_CAP_COMPRESS (1 << 17) |
#define IMAP_CAP_X_GM_EXT_1 (1 << 18) |
typedef uint8_t ImapOpenFlags |
Flags, e.g. MUTT_THREAD_COLLAPSE.
typedef uint8_t ImapCmdFlags |
Flags for imap_exec(), e.g. IMAP_CMD_PASS.
typedef uint32_t ImapCapFlags |
Capabilities we are interested in.
enum ImapExecResult |
enum ImapFlags |
enum ImapState |
IMAP connection state.
Enumerator | |
---|---|
IMAP_DISCONNECTED | Disconnected from server. |
IMAP_CONNECTED | Connected to server. |
IMAP_AUTHENTICATED | Connection is authenticated. |
IMAP_SELECTED | Mailbox is selected. |
IMAP_IDLE | Connection is idle. |
Definition at line 104 of file private.h.
int imap_create_mailbox | ( | struct ImapAccountData * | adata, |
char * | mailbox | ||
) |
Create a new mailbox.
0 | Success |
-1 | Failure |
Definition at line 441 of file imap.c.
int imap_rename_mailbox | ( | struct ImapAccountData * | adata, |
char * | oldname, | ||
const char * | newname | ||
) |
Rename a mailbox.
adata | Imap Account data |
oldname | Existing mailbox |
newname | New name for mailbox |
0 | Success |
-1 | Failure |
Definition at line 482 of file imap.c.
int imap_exec_msgset | ( | struct Mailbox * | m, |
const char * | pre, | ||
const char * | post, | ||
int | flag, | ||
bool | changed, | ||
bool | invert | ||
) |
Prepare commands for all messages matching conditions.
m | Selected Imap Mailbox |
pre | prefix commands |
post | postfix commands |
flag | flag type on which to filter, e.g. MUTT_REPLIED |
changed | include only changed messages in message set |
invert | invert sense of flag, eg MUTT_READ matches unread messages |
num | Matched messages |
-1 | Failure |
pre/post: commands are of the form "%s %s %s %s", tag, pre, message set, post Prepares commands for all messages matching conditions (must be flushed with imap_exec)
Definition at line 911 of file imap.c.
int imap_open_connection | ( | struct ImapAccountData * | adata | ) |
Open an IMAP connection.
adata | Imap Account data |
0 | Success |
-1 | Failure |
Definition at line 734 of file imap.c.
void imap_close_connection | ( | struct ImapAccountData * | adata | ) |
Close an IMAP connection.
adata | Imap Account data |
Definition at line 837 of file imap.c.
int imap_read_literal | ( | FILE * | fp, |
struct ImapAccountData * | adata, | ||
unsigned long | bytes, | ||
struct Progress * | pbar | ||
) |
Read bytes bytes from server into file.
fp | File handle for email file |
adata | Imap Account data |
bytes | Number of bytes to read |
pbar | Progress bar |
0 | Success |
-1 | Failure |
Not explicitly buffered, relies on FILE buffering.
\r
from \r\n
. Apparently even literals use \r\n
-terminated strings ?! Definition at line 590 of file imap.c.
void imap_expunge_mailbox | ( | struct Mailbox * | m | ) |
Purge messages from the server.
m | Mailbox |
Purge IMAP portion of expunged messages from the context. Must not be done while something has a handle on any headers (eg inside pager or editor). That is, check IMAP_REOPEN_ALLOW.
Definition at line 665 of file imap.c.
int imap_login | ( | struct ImapAccountData * | adata | ) |
Open an IMAP connection.
adata | Imap Account data |
0 | Success |
-1 | Failure |
Ensure ImapAccountData is connected and logged into the imap server.
Definition at line 1823 of file imap.c.
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.
[in] | m | Mailbox |
[in] | e | |
[in] | cmd | Buffer for the command string |
[out] | err_continue | Did the user force a continue? |
0 | Success |
-1 | Failure |
Update the IMAP server to reflect the flags for a single message before performing a "UID COPY".
Definition at line 989 of file imap.c.
bool imap_has_flag | ( | struct ListHead * | flag_list, |
const char * | flag | ||
) |
Does the flag exist in the list.
flag_list | List of server flags |
flag | Flag to find |
true | Flag exists |
Do a caseless comparison of the flag against a flag list, return true if found or flag list has '*'. Note that "flag" might contain additional whitespace at the end, so we really need to compare up to the length of each element in "flag_list".
Definition at line 862 of file imap.c.
int imap_adata_find | ( | const char * | path, |
struct ImapAccountData ** | adata, | ||
struct ImapMboxData ** | mdata | ||
) |
Find the Account data for this path.
0 | Success |
-1 | Failure |
Definition at line 129 of file util.c.
int imap_authenticate | ( | struct ImapAccountData * | adata | ) |
Authenticate to an IMAP server.
adata | Imap Account data |
num | Result, e.g. IMAP_AUTH_SUCCESS |
Attempt to authenticate using either user-specified authentication method if specified, or any.
Definition at line 105 of file auth.c.
int imap_cmd_start | ( | struct ImapAccountData * | adata, |
const char * | cmdstr | ||
) |
Given an IMAP command, send it to the server.
0 | Success |
<0 | Failure, e.g. IMAP_RES_BAD |
If cmdstr is NULL, sends queued commands.
Definition at line 1057 of file command.c.
int imap_cmd_step | ( | struct ImapAccountData * | adata | ) |
Reads server responses from an IMAP command.
adata | Imap Account data |
0 | Success |
<0 | Failure, e.g. IMAP_RES_BAD |
detects tagged completion response, handles untagged messages, can read arbitrarily large strings (using malloc, so don't make it too large!).
Definition at line 1071 of file command.c.
void imap_cmd_finish | ( | struct ImapAccountData * | adata | ) |
Attempt to perform cleanup.
adata | Imap Account data |
If a reopen is allowed, it attempts to perform cleanup (eg fetch new mail if detected, do expunge). Called automatically by imap_cmd_step(), but may be called at any time.
mdata->check_status is set and will be used later by imap_check_mailbox().
Definition at line 1306 of file command.c.
bool imap_code | ( | const char * | s | ) |
Was the command successful.
s | IMAP command status |
1 | Command result was OK |
0 | If NO or BAD |
Definition at line 1194 of file command.c.
const char* imap_cmd_trailer | ( | struct ImapAccountData * | adata | ) |
Extra information after tagged command response if any.
adata | Imap Account data |
ptr | Extra command information (pointer into adata->buf) |
"" | Error (static string) |
Definition at line 1205 of file command.c.
int imap_exec | ( | struct ImapAccountData * | adata, |
const char * | cmdstr, | ||
ImapCmdFlags | flags | ||
) |
Execute a command and wait for the response from the server.
adata | Imap Account data |
cmdstr | Command to execute |
flags | Flags, see ImapCmdFlags |
IMAP_EXEC_SUCCESS | Command successful or queued |
IMAP_EXEC_ERROR | Command returned an error |
IMAP_EXEC_FATAL | Imap connection failure |
Also, handle untagged responses.
Definition at line 1242 of file command.c.
int imap_cmd_idle | ( | struct ImapAccountData * | adata | ) |
Enter the IDLE state.
adata | Imap Account data |
0 | Success |
<0 | Failure, e.g. IMAP_RES_BAD |
Definition at line 1373 of file command.c.
void imap_edata_free | ( | void ** | ptr | ) |
Free the private Email data - Implements Email::edata_free()
Definition at line 72 of file message.c.
struct ImapEmailData* imap_edata_get | ( | struct Email * | e | ) |
int imap_read_headers | ( | struct Mailbox * | m, |
unsigned int | msn_begin, | ||
unsigned int | msn_end, | ||
bool | initial_download | ||
) |
Read headers from the server.
m | Imap Selected Mailbox |
msn_begin | First Message Sequence Number |
msn_end | Last Message Sequence Number |
initial_download | true, if this is the first opening of the mailbox |
num | Last MSN |
-1 | Failure |
Changed to read many headers instead of just one. It will return the msn of the last message read. It will return a value other than msn_end if mail comes in while downloading headers (in theory).
Definition at line 1243 of file message.c.
fill the message header according to the server flags
[in] | m | Imap Selected Mailbox |
[in] | e | |
[in] | s | Command string |
[out] | server_changes | Set to true if the flags have changed |
ptr | The end of flags string |
NULL | Failure |
Expects a flags line of the form "FLAGS (flag flag ...)"
imap_set_flags: fill out the message header according to the flags from the server. Expects a flags line of the form "FLAGS (flag flag ...)"
Sets server_changes to 1 if a change to a flag is made, or in the case of e->changed, if a change to a flag would have been made.
Definition at line 1783 of file message.c.
Delete an email from the body cache.
0 | Success |
-1 | Failure |
Definition at line 1732 of file message.c.
int imap_cache_clean | ( | struct Mailbox * | m | ) |
Delete all the entries in the message cache.
m | SelectedImap Mailbox |
0 | Always |
Definition at line 1751 of file message.c.
Write an email back to the server.
0 | Success |
-1 | Failure |
Definition at line 1430 of file message.c.
Open an email message in a Mailbox - Implements MxOps::msg_open()
Definition at line 1840 of file message.c.
Close an email - Implements MxOps::msg_close()
Definition at line 2055 of file message.c.
Save changes to an email - Implements MxOps::msg_commit()
Definition at line 2041 of file message.c.
Save message to the header cache - Implements MxOps::msg_save_hcache()
Definition at line 2063 of file message.c.
struct ImapAccountData* imap_adata_get | ( | struct Mailbox * | m | ) |
struct ImapMboxData* imap_mdata_get | ( | struct Mailbox * | m | ) |
void imap_hcache_open | ( | struct ImapAccountData * | adata, |
struct ImapMboxData * | mdata | ||
) |
Open a header cache.
Definition at line 435 of file util.c.
void imap_hcache_close | ( | struct ImapMboxData * | mdata | ) |
Close the header cache.
mdata | Imap Mailbox data |
Definition at line 475 of file util.c.
struct Email* imap_hcache_get | ( | struct ImapMboxData * | mdata, |
unsigned int | uid | ||
) |
Get a header cache entry by its UID.
mdata | Imap Mailbox data |
uid | UID to find |
ptr | |
NULL | Failure |
Definition at line 491 of file util.c.
int imap_hcache_put | ( | struct ImapMboxData * | mdata, |
struct Email * | e | ||
) |
Add an entry to the header cache.
0 | Success |
-1 | Failure |
Definition at line 516 of file util.c.
int imap_hcache_del | ( | struct ImapMboxData * | mdata, |
unsigned int | uid | ||
) |
Delete an item from the header cache.
mdata | Imap Mailbox data |
uid | UID of entry to delete |
0 | Success |
-1 | Failure |
Definition at line 534 of file util.c.
int imap_hcache_store_uid_seqset | ( | struct ImapMboxData * | mdata | ) |
Store a UID Sequence Set in the header cache.
mdata | Imap Mailbox data |
0 | Success |
-1 | Error |
Definition at line 551 of file util.c.
int imap_hcache_clear_uid_seqset | ( | struct ImapMboxData * | mdata | ) |
Delete a UID Sequence Set from the header cache.
mdata | Imap Mailbox data |
0 | Success |
-1 | Error |
Definition at line 573 of file util.c.
char* imap_hcache_get_uid_seqset | ( | struct ImapMboxData * | mdata | ) |
Get a UID Sequence Set from the header cache.
mdata | Imap Mailbox data |
ptr | UID Sequence Set |
NULL | Error |
Definition at line 587 of file util.c.
enum QuadOption imap_continue | ( | const char * | msg, |
const char * | resp | ||
) |
display a message and ask the user if they want to go on
msg | Location of the error |
resp | Message for user |
QuadOption | Result, e.g. MUTT_NO |
Definition at line 787 of file util.c.
void imap_error | ( | const char * | where, |
const char * | msg | ||
) |
struct ImapAccountData* imap_adata_new | ( | struct Account * | a | ) |
Allocate and initialise a new ImapAccountData structure.
ptr | New ImapAccountData |
Definition at line 92 of file util.c.
void imap_adata_free | ( | void ** | ptr | ) |
Free the private Account data - Implements Account::adata_free()
Definition at line 66 of file util.c.
struct ImapMboxData* imap_mdata_new | ( | struct ImapAccountData * | adata, |
const char * | name | ||
) |
Allocate and initialise a new ImapMboxData structure.
ptr | New ImapMboxData |
Definition at line 165 of file util.c.
void imap_mdata_free | ( | void ** | ptr | ) |
Free the private Mailbox data - Implements Mailbox::mdata_free()
Definition at line 225 of file util.c.
void imap_mdata_cache_reset | ( | struct ImapMboxData * | mdata | ) |
Release and clear cache data of ImapMboxData structure.
mdata | Imap Mailbox data |
Definition at line 215 of file util.c.
char* imap_fix_path | ( | char | delim, |
const char * | mailbox, | ||
char * | path, | ||
size_t | plen | ||
) |
Fix up the imap path.
delim | Delimiter specified by the server, '\0' for $imap_delim_chars |
mailbox | Mailbox path |
path | Buffer for the result |
plen | Length of buffer |
ptr | Fixed-up path |
$imap_delim_chars
is used as a delimiter.This is necessary because the rest of neomutt assumes a hierarchy delimiter of '/', which is not necessarily true in IMAP. Additionally, the filesystem converts multiple hierarchy delimiters into a single one, ie "///" is equal to "/". IMAP servers are not required to do this. Moreover, IMAP servers may dislike the path ending with the delimiter.
Definition at line 820 of file util.c.
void imap_cachepath | ( | char | delim, |
const char * | mailbox, | ||
struct Buffer * | dest | ||
) |
Generate a cache path for a mailbox.
Definition at line 850 of file util.c.
int imap_get_literal_count | ( | const char * | buf, |
unsigned int * | bytes | ||
) |
write number of bytes in an IMAP literal into bytes
[in] | buf | Number as a string |
[out] | bytes | Resulting number |
0 | Success |
-1 | Failure |
Definition at line 879 of file util.c.
char* imap_get_qualifier | ( | char * | buf | ) |
Get the qualifier from a tagged response.
buf | Command string to process |
ptr | Start of the qualifier |
In a tagged response, skip tag and status for the qualifier message. Used by imap_copy_message for TRYCREATE
Definition at line 906 of file util.c.
char* imap_next_word | ( | char * | s | ) |
void imap_qualify_path | ( | char * | buf, |
size_t | buflen, | ||
struct ConnAccount * | cac, | ||
char * | path | ||
) |
Make an absolute IMAP folder target.
buf | Buffer for the result |
buflen | Length of buffer |
cac | ConnAccount of the account |
path | Path relative to the mailbox |
Definition at line 954 of file util.c.
void imap_quote_string | ( | char * | dest, |
size_t | dlen, | ||
const char * | src, | ||
bool | quote_backtick | ||
) |
quote string according to IMAP rules
dest | Buffer for the result |
dlen | Length of the buffer |
src | String to be quoted |
quote_backtick | If true, quote backticks too |
Surround string with quotes, escape " and \ with backslash
Definition at line 971 of file util.c.
void imap_unquote_string | ( | char * | s | ) |
void imap_munge_mbox_name | ( | bool | unicode, |
char * | dest, | ||
size_t | dlen, | ||
const char * | src | ||
) |
Quote awkward characters in a mailbox name.
unicode | true if Unicode is allowed |
dest | Buffer to store safe mailbox name |
dlen | Length of buffer |
src | Mailbox name |
Definition at line 1045 of file util.c.
void imap_unmunge_mbox_name | ( | bool | unicode, |
char * | s | ||
) |
Remove quoting from a mailbox name.
unicode | true if Unicode is allowed |
s | Mailbox name |
The string will be altered in-place.
Definition at line 1062 of file util.c.
struct SeqsetIterator* mutt_seqset_iterator_new | ( | const char * | seqset | ) |
Create a new Sequence Set Iterator.
seqset | Source Sequence Set |
ptr | Newly allocated Sequence Set Iterator |
Definition at line 1209 of file util.c.
int mutt_seqset_iterator_next | ( | struct SeqsetIterator * | iter, |
unsigned int * | next | ||
) |
Get the next UID from a Sequence Set.
[in] | iter | Sequence Set Iterator |
[out] | next | Next UID in set |
0 | Next sequence is generated |
1 | Iterator is finished |
-1 | error |
Definition at line 1230 of file util.c.
void mutt_seqset_iterator_free | ( | struct SeqsetIterator ** | ptr | ) |
bool imap_account_match | ( | const struct ConnAccount * | a1, |
const struct ConnAccount * | a2 | ||
) |
Compare two Accounts.
a1 | First ConnAccount |
a2 | Second ConnAccount |
true | Accounts match |
Definition at line 1178 of file util.c.
void imap_get_parent | ( | const char * | mbox, |
char | delim, | ||
char * | buf, | ||
size_t | buflen | ||
) |
Get an IMAP folder's parent.
mbox | Mailbox whose parent is to be determined |
delim | Path delimiter |
buf | Buffer for the result |
buflen | Length of the buffer |
Definition at line 258 of file util.c.
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.
[in] | unicode | true if Unicode is allowed |
[out] | s | Email to convert |
Definition at line 316 of file utf7.c.
void imap_utf_decode | ( | bool | unicode, |
char ** | s | ||
) |
Decode email from UTF-8 to local charset.
[in] | unicode | true if Unicode is allowed |
[out] | s | Email to convert |
Definition at line 345 of file utf7.c.
void imap_allow_reopen | ( | struct Mailbox * | m | ) |
Allow re-opening a folder upon expunge.
m | Mailbox |
Definition at line 1150 of file util.c.
void imap_disallow_reopen | ( | struct Mailbox * | m | ) |
Disallow re-opening a folder upon expunge.
m | Mailbox |
Definition at line 1163 of file util.c.
void cmd_parse_search | ( | struct ImapAccountData * | adata, |
const char * | s | ||
) |
store SEARCH response for later use
Definition at line 258 of file search.c.
struct Slist* C_ImapAuthenticators |
bool C_ImapCheckSubscribed |
bool C_ImapCondstore |
char* C_ImapDelimChars |
long C_ImapFetchChunkSize |
char* C_ImapHeaders |
bool C_ImapIdle |
char* C_ImapLogin |
char* C_ImapOauthRefreshCommand |
char* C_ImapPass |
short C_ImapPipelineDepth |
short C_ImapPollTimeout |
bool C_ImapQresync |
bool C_ImapRfc5161 |
bool C_ImapServernoise |