Shared constants/structs that are private to IMAP. More...
#include "config.h"
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "config/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 | SeqsetIterator |
UID Sequence Set Iterator. More... | |
Macros | |
#define | IMAP_PORT 143 |
Default port for IMAP. | |
#define | IMAP_SSL_PORT 993 |
Port for IMAP over SSL/TLS. | |
#define | IMAP_LOG_CMD 2 |
#define | IMAP_LOG_LTRL 3 |
#define | IMAP_LOG_PASS 5 |
#define | IMAP_RES_NO -2 |
<tag> NO ... | |
#define | IMAP_RES_BAD -1 |
<tag> BAD ... | |
#define | IMAP_RES_OK 0 |
<tag> OK ... | |
#define | IMAP_RES_CONTINUE 1 |
* ... | |
#define | IMAP_RES_RESPOND 2 |
+ | |
#define | IMAP_RES_NEW 3 |
ImapCommand.state additions. | |
#define | SEQ_LEN 16 |
#define | IMAP_OPEN_NO_FLAGS 0 |
No flags are set. | |
#define | IMAP_REOPEN_ALLOW (1 << 0) |
Allow re-opening a folder upon expunge. | |
#define | IMAP_EXPUNGE_EXPECTED (1 << 1) |
Messages will be expunged from the server. | |
#define | IMAP_EXPUNGE_PENDING (1 << 2) |
Messages on the server have been expunged. | |
#define | IMAP_NEWMAIL_PENDING (1 << 3) |
New mail is waiting on the server. | |
#define | IMAP_FLAGS_PENDING (1 << 4) |
Flags have changed on the server. | |
#define | IMAP_CMD_NO_FLAGS 0 |
No flags are set. | |
#define | IMAP_CMD_PASS (1 << 0) |
Command contains a password. Suppress logging. | |
#define | IMAP_CMD_QUEUE (1 << 1) |
Queue a command, do not execute. | |
#define | IMAP_CMD_POLL (1 << 2) |
Poll the tcp connection before running the imap command. | |
#define | IMAP_CMD_SINGLE (1 << 3) |
Run a single command. | |
#define | IMAP_DATELEN 27 |
#define | IMAP_CAP_NO_FLAGS 0 |
No flags are set. | |
#define | IMAP_CAP_IMAP4 (1 << 0) |
Server supports IMAP4. | |
#define | IMAP_CAP_IMAP4REV1 (1 << 1) |
Server supports IMAP4rev1. | |
#define | IMAP_CAP_STATUS (1 << 2) |
Server supports STATUS command. | |
#define | IMAP_CAP_ACL (1 << 3) |
RFC2086: IMAP4 ACL extension. | |
#define | IMAP_CAP_NAMESPACE (1 << 4) |
RFC2342: IMAP4 Namespace. | |
#define | IMAP_CAP_AUTH_CRAM_MD5 (1 << 5) |
RFC2195: CRAM-MD5 authentication. | |
#define | IMAP_CAP_AUTH_GSSAPI (1 << 6) |
RFC1731: GSSAPI authentication. | |
#define | IMAP_CAP_AUTH_ANONYMOUS (1 << 7) |
AUTH=ANONYMOUS. | |
#define | IMAP_CAP_AUTH_OAUTHBEARER (1 << 8) |
RFC7628: AUTH=OAUTHBEARER. | |
#define | IMAP_CAP_AUTH_XOAUTH2 (1 << 9) |
AUTH=XOAUTH2, deprecated but used by OWA. | |
#define | IMAP_CAP_STARTTLS (1 << 10) |
RFC2595: STARTTLS. | |
#define | IMAP_CAP_LOGINDISABLED (1 << 11) |
RFC2595: LOGINDISABLED. | |
#define | IMAP_CAP_IDLE (1 << 12) |
RFC2177: IDLE. | |
#define | IMAP_CAP_SASL_IR (1 << 13) |
SASL initial response draft. | |
#define | IMAP_CAP_ENABLE (1 << 14) |
RFC5161. | |
#define | IMAP_CAP_CONDSTORE (1 << 15) |
RFC7162. | |
#define | IMAP_CAP_QRESYNC (1 << 16) |
RFC7162. | |
#define | IMAP_CAP_LIST_EXTENDED (1 << 17) |
RFC5258: IMAP4 LIST Command Extensions. | |
#define | IMAP_CAP_COMPRESS (1 << 18) |
RFC4978: COMPRESS=DEFLATE. | |
#define | IMAP_CAP_X_GM_EXT_1 (1 << 19) |
https://developers.google.com/gmail/imap/imap-extensions | |
#define | IMAP_CAP_ID (1 << 20) |
RFC2971: IMAP4 ID extension. | |
#define | IMAP_CAP_ALL ((1 << 21) - 1) |
Typedefs | |
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. | |
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, const char *mailbox) |
Create a new mailbox. | |
int | imap_rename_mailbox (struct ImapAccountData *adata, char *oldname, const char *newname) |
Rename a mailbox. | |
int | imap_open_connection (struct ImapAccountData *adata) |
Open an IMAP connection. | |
void | imap_close_connection (struct ImapAccountData *adata) |
Close an IMAP connection. | |
int | imap_read_literal (FILE *fp, struct ImapAccountData *adata, unsigned long bytes, struct Progress *progress) |
Read bytes bytes from server into file. | |
void | imap_expunge_mailbox (struct Mailbox *m, bool resort) |
Purge messages from the server. | |
int | imap_login (struct ImapAccountData *adata) |
Open an IMAP connection. | |
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_has_flag (struct ListHead *flag_list, const char *flag) |
Does the flag exist in the list. | |
int | imap_adata_find (const char *path, struct ImapAccountData **adata, struct ImapMboxData **mdata) |
Find the Account data for this path. | |
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. | |
int | imap_cmd_step (struct ImapAccountData *adata) |
Reads server responses from an IMAP command. | |
void | imap_cmd_finish (struct ImapAccountData *adata) |
Attempt to perform cleanup. | |
bool | imap_code (const char *s) |
Was the command successful. | |
const char * | imap_cmd_trailer (struct ImapAccountData *adata) |
Extra information after tagged command response if any. | |
int | imap_exec (struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags) |
Execute a command and wait for the response from the server. | |
int | imap_cmd_idle (struct ImapAccountData *adata) |
Enter the IDLE state. | |
int | imap_read_headers (struct Mailbox *m, unsigned int msn_begin, unsigned int msn_end, bool initial_download) |
Read headers from the server. | |
char * | imap_set_flags (struct Mailbox *m, struct Email *e, char *s, bool *server_changes) |
Fill the message header according to the server flags. | |
int | imap_cache_del (struct Mailbox *m, struct Email *e) |
Delete an email from the body cache. | |
int | imap_cache_clean (struct Mailbox *m) |
Delete all the entries in the message cache. | |
int | imap_append_message (struct Mailbox *m, struct Message *msg) |
Write an email back to the server. | |
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_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() -. | |
int | imap_msg_save_hcache (struct Mailbox *m, struct Email *e) |
Save message to the header cache - Implements MxOps::msg_save_hcache() -. | |
void | imap_hcache_open (struct ImapAccountData *adata, struct ImapMboxData *mdata, bool create) |
Open a header cache. | |
void | imap_hcache_close (struct ImapMboxData *mdata) |
Close the header cache. | |
struct Email * | imap_hcache_get (struct ImapMboxData *mdata, unsigned int uid) |
Get a header cache entry by its UID. | |
int | imap_hcache_put (struct ImapMboxData *mdata, struct Email *e) |
Add an entry to the header cache. | |
int | imap_hcache_del (struct ImapMboxData *mdata, unsigned int uid) |
Delete an item from the header cache. | |
int | imap_hcache_store_uid_seqset (struct ImapMboxData *mdata) |
Store a UID Sequence Set in the header cache. | |
int | imap_hcache_clear_uid_seqset (struct ImapMboxData *mdata) |
Delete a UID Sequence Set from the header cache. | |
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_error (const char *where, const char *msg) |
Show an error and abort. | |
void | imap_mdata_cache_reset (struct ImapMboxData *mdata) |
Release and clear cache data of ImapMboxData structure. | |
char * | imap_fix_path (const char *mailbox, char *path, size_t plen) |
Fix up the imap path. | |
char * | imap_fix_path_with_delim (char delim, const char *mailbox, char *path, size_t plen) |
Fix up the imap path. | |
void | imap_cachepath (char delim, const char *mailbox, struct Buffer *dest) |
Generate a cache path for a mailbox. | |
int | imap_get_literal_count (const char *buf, unsigned int *bytes) |
Write number of bytes in an IMAP literal into bytes. | |
char * | imap_get_qualifier (char *buf) |
Get the qualifier from a tagged response. | |
char * | imap_next_word (char *s) |
Find where the next IMAP word begins. | |
void | imap_qualify_path (char *buf, size_t buflen, struct ConnAccount *conn_account, char *path) |
Make an absolute IMAP folder target. | |
void | imap_buf_qualify_path (struct Buffer *buf, struct ConnAccount *conn_account, char *path) |
Make an absolute IMAP folder target to a buffer. | |
void | imap_quote_string (char *dest, size_t dlen, const char *src, bool quote_backtick) |
Quote string according to IMAP rules. | |
void | imap_unquote_string (char *s) |
Equally stupid unquoting routine. | |
void | imap_munge_mbox_name (bool unicode, char *dest, size_t dlen, const char *src) |
Quote awkward characters in a mailbox name. | |
void | imap_unmunge_mbox_name (bool unicode, char *s) |
Remove quoting from a mailbox name. | |
struct SeqsetIterator * | mutt_seqset_iterator_new (const char *seqset) |
Create a new Sequence Set Iterator. | |
int | mutt_seqset_iterator_next (struct SeqsetIterator *iter, unsigned int *next) |
Get the next UID from a Sequence Set. | |
void | mutt_seqset_iterator_free (struct SeqsetIterator **ptr) |
Free a Sequence Set Iterator. | |
bool | imap_account_match (const struct ConnAccount *a1, const struct ConnAccount *a2) |
Compare two Accounts. | |
void | imap_get_parent (const char *mbox, char delim, char *buf, size_t buflen) |
Get an IMAP folder's parent. | |
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_utf_decode (bool unicode, char **s) |
Decode email from UTF-8 to local charset. | |
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. | |
void | cmd_parse_search (struct ImapAccountData *adata, const char *s) |
Store SEARCH response for later use. | |
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_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_AUTH_XOAUTH2 (1 << 9) |
#define IMAP_CAP_LOGINDISABLED (1 << 11) |
#define IMAP_CAP_SASL_IR (1 << 13) |
#define IMAP_CAP_LIST_EXTENDED (1 << 17) |
#define IMAP_CAP_COMPRESS (1 << 18) |
#define IMAP_CAP_X_GM_EXT_1 (1 << 19) |
#define IMAP_CAP_ID (1 << 20) |
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 |
Imap_exec return code.
Enumerator | |
---|---|
IMAP_EXEC_SUCCESS | Imap command executed or queued successfully. |
IMAP_EXEC_ERROR | Imap command failure. |
IMAP_EXEC_FATAL | Imap connection failure. |
Definition at line 80 of file private.h.
enum ImapFlags |
IMAP server responses.
Enumerator | |
---|---|
IMAP_FATAL | Unrecoverable error occurred. |
IMAP_BYE | Logged out from server. |
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 102 of file private.h.
int imap_create_mailbox | ( | struct ImapAccountData * | adata, |
const char * | mailbox | ||
) |
Create a new mailbox.
0 | Success |
-1 | Failure |
Definition at line 436 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 478 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 741 of file imap.c.
void imap_close_connection | ( | struct ImapAccountData * | adata | ) |
Close an IMAP connection.
adata | Imap Account data |
Definition at line 849 of file imap.c.
int imap_read_literal | ( | FILE * | fp, |
struct ImapAccountData * | adata, | ||
unsigned long | bytes, | ||
struct Progress * | progress | ||
) |
Read bytes bytes from server into file.
fp | File handle for email file |
adata | Imap Account data |
bytes | Number of bytes to read |
progress | 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, |
bool | resort | ||
) |
Purge messages from the server.
m | Mailbox |
resort | Trigger a resort? |
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 669 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 1777 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 926 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 874 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 73 of file util.c.
int imap_authenticate | ( | struct ImapAccountData * | adata | ) |
Authenticate to an IMAP server.
adata | Imap Account data |
enum | ImapAuthRes, e.g. IMAP_AUTH_SUCCESS |
Attempt to authenticate using either user-specified authentication method if specified, or any.
Definition at line 115 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 1115 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 1129 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 1369 of file command.c.
bool imap_code | ( | const char * | s | ) |
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 1267 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 1304 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 1436 of file command.c.
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 1340 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 1920 of file message.c.
Delete an email from the body cache.
0 | Success |
-1 | Failure |
Definition at line 1869 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 1888 of file message.c.
Write an email back to the server.
0 | Success |
-1 | Failure |
Definition at line 1529 of file message.c.
void imap_hcache_open | ( | struct ImapAccountData * | adata, |
struct ImapMboxData * | mdata, | ||
bool | create | ||
) |
Open a header cache.
adata | Imap Account data |
mdata | Imap Mailbox data |
create | Create a new header cache if missing? |
Definition at line 303 of file util.c.
void imap_hcache_close | ( | struct ImapMboxData * | mdata | ) |
Close the header cache.
mdata | Imap Mailbox data |
Definition at line 344 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 359 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 384 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 402 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 419 of file util.c.
int imap_hcache_clear_uid_seqset | ( | struct ImapMboxData * | mdata | ) |
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 454 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 650 of file util.c.
void imap_error | ( | const char * | where, |
const char * | msg | ||
) |
void imap_mdata_cache_reset | ( | struct ImapMboxData * | mdata | ) |
Release and clear cache data of ImapMboxData structure.
mdata | Imap Mailbox data |
Definition at line 110 of file util.c.
char * imap_fix_path | ( | const char * | mailbox, |
char * | path, | ||
size_t | plen | ||
) |
Fix up the imap path.
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 682 of file util.c.
char * imap_fix_path_with_delim | ( | const char | delim, |
const char * | mailbox, | ||
char * | path, | ||
size_t | plen | ||
) |
Fix up the imap path.
delim | Delimiter specified by the server |
mailbox | Mailbox path |
path | Buffer for the result |
plen | Length of buffer |
ptr | Fixed-up path |
Definition at line 714 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 750 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 781 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 808 of file util.c.
char * imap_next_word | ( | char * | s | ) |
Find where the next IMAP word begins.
s | Command string to process |
ptr | Next IMAP word |
Definition at line 825 of file util.c.
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 856 of file util.c.
void imap_buf_qualify_path | ( | struct Buffer * | buf, |
struct ConnAccount * | cac, | ||
char * | path | ||
) |
Make an absolute IMAP folder target to a buffer.
buf | Buffer for the result |
cac | ConnAccount of the account |
path | Path relative to the mailbox |
Definition at line 870 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 887 of file util.c.
void imap_unquote_string | ( | char * | s | ) |
Equally stupid unquoting routine.
s | String to be unquoted |
Definition at line 924 of file util.c.
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 961 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 978 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 1126 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 1147 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 1094 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 124 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 397 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 430 of file utf7.c.
void imap_allow_reopen | ( | struct Mailbox * | m | ) |
void imap_disallow_reopen | ( | struct Mailbox * | m | ) |
void cmd_parse_search | ( | struct ImapAccountData * | adata, |
const char * | s | ||
) |
Store SEARCH response for later use.
Definition at line 256 of file search.c.