#include "config.h"
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "private.h"
#include "mutt/lib.h"
#include "config/lib.h"
#include "email/lib.h"
#include "core/lib.h"
#include "conn/lib.h"
#include "gui/lib.h"
#include "mutt.h"
#include "lib.h"
#include "bcache/lib.h"
#include "pattern/lib.h"
#include "adata.h"
#include "auth.h"
#include "command_parse.h"
#include "commands.h"
#include "edata.h"
#include "hook.h"
#include "init.h"
#include "mdata.h"
#include "message.h"
#include "msn.h"
#include "mutt_globals.h"
#include "mutt_logging.h"
#include "mutt_socket.h"
#include "muttlib.h"
#include "mx.h"
#include "progress.h"
#include "sort.h"
#include <libintl.h>
Go to the source code of this file.
|
void | imap_init (void) |
| Setup feature commands. More...
|
|
static int | check_capabilities (struct ImapAccountData *adata) |
| Make sure we can log in to this server. More...
|
|
static char * | get_flags (struct ListHead *hflags, char *s) |
| Make a simple list out of a FLAGS response. More...
|
|
static void | set_flag (struct Mailbox *m, AclFlags aclflag, bool flag, const char *str, char *flags, size_t flsize) |
| append str to flags if we currently have permission according to aclflag More...
|
|
static int | make_msg_set (struct Mailbox *m, struct Buffer *buf, enum MessageType flag, bool changed, bool invert, int *pos) |
| Make a message set. More...
|
|
static bool | compare_flags_for_copy (struct Email *e) |
| Compare local flags against the server. More...
|
|
static int | sync_helper (struct Mailbox *m, AclFlags right, enum MessageType flag, const char *name) |
| Sync flag changes to the server. More...
|
|
static size_t | longest_common_prefix (char *dest, const char *src, size_t start, size_t dlen) |
| Find longest prefix common to two strings. More...
|
|
static int | complete_hosts (char *buf, size_t buflen) |
| Look for completion matches for mailboxes. More...
|
|
int | imap_create_mailbox (struct ImapAccountData *adata, char *mailbox) |
| Create a new mailbox. More...
|
|
int | imap_access (const char *path) |
| Check permissions on an IMAP mailbox with a new connection. More...
|
|
int | imap_rename_mailbox (struct ImapAccountData *adata, char *oldname, const char *newname) |
| Rename a mailbox. More...
|
|
int | imap_delete_mailbox (struct Mailbox *m, char *path) |
| Delete a mailbox. More...
|
|
static void | imap_logout (struct ImapAccountData *adata) |
| Gracefully log out of server. More...
|
|
void | imap_logout_all (void) |
| close all open connections 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_notify_delete_email (struct Mailbox *m, struct Email *e) |
| Inform IMAP that an Email has been deleted. More...
|
|
void | imap_expunge_mailbox (struct Mailbox *m) |
| Purge messages from the server. 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...
|
|
bool | imap_has_flag (struct ListHead *flag_list, const char *flag) |
| Does the flag exist in the list. More...
|
|
static int | compare_uid (const void *a, const void *b) |
| Compare two Emails by UID - Implements sort_t. More...
|
|
int | imap_exec_msgset (struct Mailbox *m, const char *pre, const char *post, enum MessageType flag, bool changed, bool invert) |
| Prepare commands for all messages matching conditions. 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...
|
|
enum MxStatus | imap_check_mailbox (struct Mailbox *m, bool force) |
| use the NOOP or IDLE command to poll for new mail More...
|
|
static int | imap_status (struct ImapAccountData *adata, struct ImapMboxData *mdata, bool queue) |
| Refresh the number of total and new messages. More...
|
|
static enum MxStatus | imap_mbox_check_stats (struct Mailbox *m, uint8_t flags) |
| Check the Mailbox statistics - Implements MxOps::mbox_check_stats() More...
|
|
int | imap_path_status (const char *path, bool queue) |
| Refresh the number of total and new messages. More...
|
|
int | imap_mailbox_status (struct Mailbox *m, bool queue) |
| Refresh the number of total and new messages. More...
|
|
int | imap_subscribe (char *path, bool subscribe) |
| Subscribe to a mailbox. More...
|
|
int | imap_complete (char *buf, size_t buflen, const char *path) |
| Try to complete an IMAP folder path. More...
|
|
int | imap_fast_trash (struct Mailbox *m, char *dest) |
| Use server COPY command to copy deleted messages to trash. More...
|
|
enum MxStatus | imap_sync_mailbox (struct Mailbox *m, bool expunge, bool close) |
| Sync all the changes to the server. More...
|
|
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() More...
|
|
static bool | imap_ac_add (struct Account *a, struct Mailbox *m) |
| Add a Mailbox to an Account - Implements MxOps::ac_add() More...
|
|
static void | imap_mbox_select (struct Mailbox *m) |
| Select a Mailbox. More...
|
|
int | imap_login (struct ImapAccountData *adata) |
| Open an IMAP connection. More...
|
|
static enum MxOpenReturns | imap_mbox_open (struct Mailbox *m) |
| Open a mailbox - Implements MxOps::mbox_open() More...
|
|
static bool | imap_mbox_open_append (struct Mailbox *m, OpenMailboxFlags flags) |
| Open a Mailbox for appending - Implements MxOps::mbox_open_append() More...
|
|
static enum MxStatus | imap_mbox_check (struct Mailbox *m) |
| Check for new mail - Implements MxOps::mbox_check() More...
|
|
static enum MxStatus | imap_mbox_close (struct Mailbox *m) |
| Close a Mailbox - Implements MxOps::mbox_close() More...
|
|
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() More...
|
|
static int | imap_tags_edit (struct Mailbox *m, const char *tags, char *buf, size_t buflen) |
| Prompt and validate new messages tags - Implements MxOps::tags_edit() More...
|
|
static int | imap_tags_commit (struct Mailbox *m, struct Email *e, char *buf) |
| Save the tags to a message - Implements MxOps::tags_commit() More...
|
|
enum MailboxType | imap_path_probe (const char *path, const struct stat *st) |
| Is this an IMAP Mailbox? - Implements MxOps::path_probe() More...
|
|
int | imap_path_canon (char *buf, size_t buflen) |
| Canonicalise a Mailbox path - Implements MxOps::path_canon() More...
|
|
int | imap_expand_path (struct Buffer *buf) |
| Buffer wrapper around imap_path_canon() More...
|
|
static int | imap_path_pretty (char *buf, size_t buflen, const char *folder) |
| Abbreviate a Mailbox path - Implements MxOps::path_pretty() More...
|
|
static int | imap_path_parent (char *buf, size_t buflen) |
| Find the parent of a Mailbox path - Implements MxOps::path_parent() More...
|
|
static int | imap_path_is_empty (const char *path) |
| Is the mailbox empty - Implements MxOps::path_is_empty() More...
|
|
IMAP network mailbox
- Authors
- Michael R. Elkins
- Brandon Long
- Brendan Cully
- Richard Russon
- Copyright
- This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
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 imap.c.
◆ imap_init()
Setup feature commands.
Definition at line 82 of file imap.c.
◆ check_capabilities()
Make sure we can log in to this server.
- Parameters
-
- Return values
-
Definition at line 93 of file imap.c.
104 _(
"This IMAP server is ancient. NeoMutt does not work with it."));
◆ get_flags()
static char* get_flags |
( |
struct ListHead * |
hflags, |
|
|
char * |
s |
|
) |
| |
|
static |
Make a simple list out of a FLAGS response.
- Parameters
-
hflags | List to store flags |
s | String containing flags |
- Return values
-
ptr | End of the flags |
NULL | Failure |
return stream following FLAGS response
Definition at line 120 of file imap.c.
138 while (*s && (*s !=
')'))
142 const char *flag_word = s;
143 while (*s && (*s !=
')') && !
IS_SPACE(*s))
145 const char ctmp = *s;
◆ set_flag()
static void set_flag |
( |
struct Mailbox * |
m, |
|
|
AclFlags |
aclflag, |
|
|
bool |
flag, |
|
|
const char * |
str, |
|
|
char * |
flags, |
|
|
size_t |
flsize |
|
) |
| |
|
static |
append str to flags if we currently have permission according to aclflag
- Parameters
-
[in] | m | Selected Imap Mailbox |
[in] | aclflag | Permissions, see AclFlags |
[in] | flag | Does the email have the flag set? |
[in] | str | Server flag name |
[out] | flags | Buffer for server command |
[in] | flsize | Length of buffer |
Definition at line 175 of file imap.c.
◆ make_msg_set()
static int make_msg_set |
( |
struct Mailbox * |
m, |
|
|
struct Buffer * |
buf, |
|
|
enum MessageType |
flag, |
|
|
bool |
changed, |
|
|
bool |
invert, |
|
|
int * |
pos |
|
) |
| |
|
static |
Make a message set.
- Parameters
-
[in] | m | Selected Imap Mailbox |
[in] | buf | Buffer to store message set |
[in] | flag | Flags to match, e.g. MUTT_DELETED |
[in] | changed | Matched messages that have been altered |
[in] | invert | Flag matches should be inverted |
[out] | pos | Cursor used for multiple calls to this function |
- Return values
-
- Note
- Headers must be in SORT_ORDER. See imap_exec_msgset() for args. Pos is an opaque pointer a la strtok(). It should be 0 at first call.
Definition at line 196 of file imap.c.
200 unsigned int setstart = 0;
202 bool started =
false;
232 match = invert ^ e->
old;
236 match = invert ^ e->
read;
◆ compare_flags_for_copy()
static bool compare_flags_for_copy |
( |
struct Email * |
e | ) |
|
|
static |
Compare local flags against the server.
- Parameters
-
- Return values
-
true | Flags have changed |
false | Flags match cached server flags |
The comparison of flags EXCLUDES the deleted flag.
Definition at line 298 of file imap.c.
◆ sync_helper()
Sync flag changes to the server.
- Parameters
-
- Return values
-
>=0 | Success, number of messages |
-1 | Failure |
Definition at line 323 of file imap.c.
333 if ((m->
rights & right) == 0)
339 snprintf(buf,
sizeof(buf),
"+FLAGS.SILENT (%s)", name);
◆ longest_common_prefix()
static size_t longest_common_prefix |
( |
char * |
dest, |
|
|
const char * |
src, |
|
|
size_t |
start, |
|
|
size_t |
dlen |
|
) |
| |
|
static |
Find longest prefix common to two strings.
- Parameters
-
dest | Destination buffer |
src | Source buffer |
start | Starting offset into string |
dlen | Destination buffer length |
- Return values
-
num | Length of the common string |
Trim dest to the length of the longest prefix it shares with src.
Definition at line 364 of file imap.c.
368 while ((pos < dlen) && dest[pos] && (dest[pos] == src[pos]))
◆ complete_hosts()
static int complete_hosts |
( |
char * |
buf, |
|
|
size_t |
buflen |
|
) |
| |
|
static |
Look for completion matches for mailboxes.
- Parameters
-
buf | Partial mailbox name to complete |
buflen | Length of buffer |
- Return values
-
look for IMAP URLs to complete from defined mailboxes. Could be extended to complete over open connections and account/folder hooks too.
Definition at line 385 of file imap.c.
413 struct Url url = { 0 };
◆ imap_create_mailbox()
Create a new mailbox.
- Parameters
-
- Return values
-
Definition at line 447 of file imap.c.
449 char buf[2048], mbox[1024];
452 snprintf(buf,
sizeof(buf),
"CREATE %s", mbox);
◆ imap_access()
int imap_access |
( |
const char * |
path | ) |
|
Check permissions on an IMAP mailbox with a new connection.
- Parameters
-
- Return values
-
TODO: ACL checks. Right now we assume if it exists we can mess with it. TODO: This method should take a Mailbox as parameter to be able to reuse the existing connection.
Definition at line 473 of file imap.c.
◆ imap_rename_mailbox()
int imap_rename_mailbox |
( |
struct ImapAccountData * |
adata, |
|
|
char * |
oldname, |
|
|
const char * |
newname |
|
) |
| |
Rename a mailbox.
- Parameters
-
adata | Imap Account data |
oldname | Existing mailbox |
newname | New name for mailbox |
- Return values
-
Definition at line 488 of file imap.c.
◆ imap_delete_mailbox()
int imap_delete_mailbox |
( |
struct Mailbox * |
m, |
|
|
char * |
path |
|
) |
| |
Delete a mailbox.
- Parameters
-
m | Mailbox |
path | name of the mailbox to delete |
- Return values
-
Definition at line 515 of file imap.c.
524 snprintf(
buf,
sizeof(
buf),
"DELETE %s", mbox);
◆ imap_logout()
Gracefully log out of server.
- Parameters
-
Definition at line 535 of file imap.c.
◆ imap_logout_all()
void imap_logout_all |
( |
void |
| ) |
|
close all open connections
Quick and dirty until we can make sure we've got all the context we need.
Definition at line 560 of file imap.c.
573 if (!conn || (conn->
fd < 0))
◆ imap_read_literal()
Read bytes bytes from server into file.
- Parameters
-
fp | File handle for email file |
adata | Imap Account data |
bytes | Number of bytes to read |
pbar | Progress bar |
- Return values
-
Not explicitly buffered, relies on FILE buffering.
- Note
- Strips
\r
from \r\n
. Apparently even literals use \r\n
-terminated strings ?!
Definition at line 596 of file imap.c.
601 struct Buffer buf = { 0 };
608 for (
unsigned long pos = 0; pos < bytes; pos++)
619 if (r && (c !=
'\n'))
632 if (pbar && !(pos % 1024))
◆ imap_notify_delete_email()
void imap_notify_delete_email |
( |
struct Mailbox * |
m, |
|
|
struct Email * |
e |
|
) |
| |
Inform IMAP that an Email has been deleted.
- Parameters
-
Definition at line 651 of file imap.c.
656 if (!mdata || !
edata)
◆ imap_expunge_mailbox()
void imap_expunge_mailbox |
( |
struct Mailbox * |
m | ) |
|
Purge messages from the server.
- Parameters
-
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 671 of file imap.c.
675 if (!adata || !
mdata)
678 struct Email *e = NULL;
690 if (e->
index == INT_MAX)
◆ imap_open_connection()
Open an IMAP connection.
- Parameters
-
- Return values
-
Definition at line 740 of file imap.c.
784 mutt_error(
_(
"Could not negotiate TLS connection"));
◆ imap_close_connection()
Close an IMAP connection.
- Parameters
-
Definition at line 843 of file imap.c.
◆ imap_has_flag()
bool imap_has_flag |
( |
struct ListHead * |
flag_list, |
|
|
const char * |
flag |
|
) |
| |
Does the flag exist in the list.
- Parameters
-
flag_list | List of server flags |
flag | Flag to find |
- Return values
-
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 868 of file imap.c.
877 const size_t nplen = strlen(np->
data);
878 if ((flaglen >= nplen) && ((flag[nplen] ==
'\0') || (flag[nplen] ==
' ')) &&
◆ compare_uid()
static int compare_uid |
( |
const void * |
a, |
|
|
const void * |
b |
|
) |
| |
|
static |
Compare two Emails by UID - Implements sort_t.
Definition at line 894 of file imap.c.
896 const struct Email *ea = *(
struct Email const *
const *) a;
897 const struct Email *eb = *(
struct Email const *
const *) b;
◆ imap_exec_msgset()
int imap_exec_msgset |
( |
struct Mailbox * |
m, |
|
|
const char * |
pre, |
|
|
const char * |
post, |
|
|
enum MessageType |
flag, |
|
|
bool |
changed, |
|
|
bool |
invert |
|
) |
| |
Prepare commands for all messages matching conditions.
- Parameters
-
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 |
- Return values
-
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 917 of file imap.c.
924 struct Email **emails = NULL;
953 rc =
make_msg_set(m, &cmd, flag, changed, invert, &pos);
◆ imap_sync_message_for_copy()
Update server to reflect the flags of a single message.
- Parameters
-
[in] | m | Mailbox |
[in] | e | Email |
[in] | cmd | Buffer for the command string |
[out] | err_continue | Did the user force a continue? |
- Return values
-
Update the IMAP server to reflect the flags for a single message before performing a "UID COPY".
- Note
- This does not sync the "deleted" flag state, because it is not desirable to propagate that flag into the copy.
Definition at line 995 of file imap.c.
1052 flags,
sizeof(flags));
1071 err_continue && (*err_continue !=
MUTT_YES))
◆ imap_check_mailbox()
use the NOOP or IDLE command to poll for new mail
- Parameters
-
m | Mailbox |
force | Don't wait return enum MxStatus |
Definition at line 1094 of file imap.c.
◆ imap_status()
Refresh the number of total and new messages.
- Parameters
-
adata | IMAP Account data |
mdata | IMAP Mailbox data |
queue | Queue the STATUS command |
- Return values
-
num | Total number of messages |
Definition at line 1163 of file imap.c.
1165 char *uidvalidity_flag = NULL;
1168 if (!adata || !
mdata)
1178 return mdata->messages;
1182 uidvalidity_flag =
"UIDVALIDITY";
1184 uidvalidity_flag =
"UID-VALIDITY";
1191 snprintf(cmd,
sizeof(cmd),
"STATUS %s (UIDNEXT %s UNSEEN RECENT MESSAGES)",
1192 mdata->munge_name, uidvalidity_flag);
1200 return mdata->messages;
◆ imap_mbox_check_stats()
static enum MxStatus imap_mbox_check_stats |
( |
struct Mailbox * |
m, |
|
|
uint8_t |
flags |
|
) |
| |
|
static |
◆ imap_path_status()
int imap_path_status |
( |
const char * |
path, |
|
|
bool |
queue |
|
) |
| |
Refresh the number of total and new messages.
- Parameters
-
path | Mailbox path |
queue | Queue the STATUS command |
- Return values
-
num | Total number of messages |
Definition at line 1222 of file imap.c.
1226 const bool is_temp = !m;
◆ imap_mailbox_status()
int imap_mailbox_status |
( |
struct Mailbox * |
m, |
|
|
bool |
queue |
|
) |
| |
Refresh the number of total and new messages.
- Parameters
-
m | Mailbox |
queue | Queue the STATUS command |
- Return values
-
num | Total number of messages |
-1 | Error |
- Note
- Prepare the mailbox if we are not connected
Definition at line 1256 of file imap.c.
1260 if (!adata || !
mdata)
◆ imap_subscribe()
int imap_subscribe |
( |
char * |
path, |
|
|
bool |
subscribe |
|
) |
| |
Subscribe to a mailbox.
- Parameters
-
path | Mailbox path |
subscribe | True: subscribe, false: unsubscribe |
- Return values
-
Definition at line 1272 of file imap.c.
1287 snprintf(buf,
sizeof(buf),
"%sSUBSCRIBE %s", subscribe ?
"" :
"UN", mdata->
munge_name);
1301 size_t len = snprintf(mbox,
sizeof(mbox),
"%smailboxes ", subscribe ?
"" :
"un");
◆ imap_complete()
int imap_complete |
( |
char * |
buf, |
|
|
size_t |
buflen, |
|
|
const char * |
path |
|
) |
| |
Try to complete an IMAP folder path.
- Parameters
-
buf | Buffer for result |
buflen | Length of buffer |
path | Partial mailbox name to complete |
- Return values
-
Given a partial IMAP folder path, return a string which adds as much to the path as is unique
Definition at line 1327 of file imap.c.
1333 char completion[1024];
1335 size_t matchlen = 0;
1336 int completions = 0;
1346 snprintf(tmp,
sizeof(tmp),
"%s \"\" \"%s%%\"",
1358 listresp.
name = NULL;
1367 clen = strlen(listresp.
name);
1369 listresp.
name[clen] =
'\0';
1375 matchlen = strlen(completion);
◆ imap_fast_trash()
int imap_fast_trash |
( |
struct Mailbox * |
m, |
|
|
char * |
dest |
|
) |
| |
Use server COPY command to copy deleted messages to trash.
- Parameters
-
- Return values
-
-1 | Error |
0 | Success |
1 | Non-fatal error - try fetch/append |
Definition at line 1405 of file imap.c.
1409 bool triedcreate =
false;
1461 mutt_message(ngettext(
"Copying %d message to %s...",
"Copying %d messages to %s...", rc),
1462 rc, dest_mdata->
name);
1478 snprintf(prompt,
sizeof(prompt),
_(
"Create %s?"), dest_mdata->
name);
◆ imap_sync_mailbox()
enum MxStatus imap_sync_mailbox |
( |
struct Mailbox * |
m, |
|
|
bool |
expunge, |
|
|
bool |
close |
|
) |
| |
Sync all the changes to the server.
- Parameters
-
m | Mailbox |
expunge | if true do expunge |
close | if true we move imap state to CLOSE |
- Return values
-
- Note
- The flag retvals come from a call to imap_check_mailbox()
Definition at line 1514 of file imap.c.
1519 struct Email **emails = NULL;
1566 "Marking %d messages deleted...", rc),
1605 mutt_message(ngettext(
"Saving changed message... [%d/%d]",
1606 "Saving changed messages... [%d/%d]", m->
msg_count),
1609 bool save_append = m->
append;
1707 if (expunge && close)
◆ imap_ac_owns_path()
static bool imap_ac_owns_path |
( |
struct Account * |
a, |
|
|
const char * |
path |
|
) |
| |
|
static |
◆ imap_ac_add()
◆ imap_mbox_select()
static void imap_mbox_select |
( |
struct Mailbox * |
m | ) |
|
|
static |
Select a Mailbox.
- Parameters
-
Definition at line 1795 of file imap.c.
1799 if (!adata || !
mdata)
1802 const char *condstore = NULL;
1805 condstore =
" (CONDSTORE)";
1811 snprintf(buf,
sizeof(buf),
"%s %s%s", m->
readonly ?
"EXAMINE" :
"SELECT",
1812 mdata->munge_name, condstore);
◆ imap_login()
Open an IMAP connection.
- Parameters
-
- Return values
-
Ensure ImapAccountData is connected and logged into the imap server.
Definition at line 1827 of file imap.c.
◆ imap_mbox_open()
Open a mailbox - Implements MxOps::mbox_open()
Definition at line 1904 of file imap.c.
1924 mdata->new_mail_count = 0;
1932 snprintf(buf,
sizeof(buf),
"MYRIGHTS %s",
mdata->munge_name);
1945 if (postponed_adata &&
1964 pc =
adata->buf + 2;
2059 struct Buffer flag_buffer;
2067 FREE(&flag_buffer.data);
◆ imap_mbox_open_append()
◆ imap_mbox_check()
◆ imap_mbox_close()
◆ imap_msg_open_new()
static bool imap_msg_open_new |
( |
struct Mailbox * |
m, |
|
|
struct Message * |
msg, |
|
|
const struct Email * |
e |
|
) |
| |
|
static |
◆ imap_tags_edit()
static int imap_tags_edit |
( |
struct Mailbox * |
m, |
|
|
const char * |
tags, |
|
|
char * |
buf, |
|
|
size_t |
buflen |
|
) |
| |
|
static |
Prompt and validate new messages tags - Implements MxOps::tags_edit()
Definition at line 2220 of file imap.c.
2226 char *new_tag = NULL;
2227 char *checker = NULL;
2232 mutt_error(
_(
"IMAP server doesn't support custom flags"));
2259 while (*checker !=
'\0')
2261 if ((*checker < 32) || (*checker >= 127) ||
2281 while ((checker[0] ==
' ') && (checker[1] ==
' '))
2285 *new_tag++ = *checker++;
◆ imap_tags_commit()
static int imap_tags_commit |
( |
struct Mailbox * |
m, |
|
|
struct Email * |
e, |
|
|
char * |
buf |
|
) |
| |
|
static |
Save the tags to a message - Implements MxOps::tags_commit()
This method update the server flags on the server by removing the last know custom flags of a header and adds the local flags
If everything success we push the local flags to the last know custom flags (flags_remote).
Also this method check that each flags is support by the server first and remove unsupported one.
Definition at line 2307 of file imap.c.
◆ imap_path_probe()
enum MailboxType imap_path_probe |
( |
const char * |
path, |
|
|
const struct stat * |
st |
|
) |
| |
◆ imap_path_canon()
int imap_path_canon |
( |
char * |
buf, |
|
|
size_t |
buflen |
|
) |
| |
◆ imap_expand_path()
int imap_expand_path |
( |
struct Buffer * |
buf | ) |
|
◆ imap_path_pretty()
static int imap_path_pretty |
( |
char * |
buf, |
|
|
size_t |
buflen, |
|
|
const char * |
folder |
|
) |
| |
|
static |
◆ imap_path_parent()
static int imap_path_parent |
( |
char * |
buf, |
|
|
size_t |
buflen |
|
) |
| |
|
static |
◆ imap_path_is_empty()
static int imap_path_is_empty |
( |
const char * |
path | ) |
|
|
static |
◆ imap_commands
const struct Command imap_commands[] |
|
static |
Initial value:
Definition at line 72 of file imap.c.
◆ MxImapOps
Initial value:= {
.name = "imap",
.is_local = false,
.mbox_sync = NULL,
.msg_padding_size = NULL,
}
IMAP Mailbox - Implements MxOps.
Definition at line 2459 of file imap.c.
bool C_SslForceTls
Config: (ssl) Require TLS encryption for all connections.
#define IMAP_RES_OK
<tag> OK ...
void(* mdata_free)(void **ptr)
Free the private data attached to the Mailbox.
bool C_ImapDeflate
Config: (imap) Compress network traffic.
int imap_cache_del(struct Mailbox *m, struct Email *e)
Delete an email from the body cache.
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()
char * real_name
Original Mailbox name, e.g.: INBOX can be just \0.
static int imap_tags_commit(struct Mailbox *m, struct Email *e, char *buf)
Save the tags to a message - Implements MxOps::tags_commit()
struct Connection * mutt_conn_new(const struct ConnAccount *cac)
Create a new Connection.
Login details for a remote server.
WHERE short C_Timeout
Config: Time to wait for user input in menus.
AclFlags rights
ACL bits, see AclFlags.
short C_ImapKeepalive
Config: (imap) Time to wait before polling an open IMAP connection.
enum CommandResult mutt_parse_rc_line(const char *line, struct Buffer *err)
Parse a line of user config.
An open network connection (socket)
@ MUTT_FLAG
Flagged messages.
void imap_hcache_open(struct ImapAccountData *adata, struct ImapMboxData *mdata)
Open a header cache.
QuadOption
Possible values for a quad-option.
int imap_hcache_put(struct ImapMboxData *mdata, struct Email *e)
Add an entry to the header cache.
MxStatus
Return values from mx_mbox_check(), mx_mbox_sync(), and mx_mbox_close()
char host[128]
Server to login to.
ImapExecResult
imap_exec return code
struct AccountList accounts
List of all Accounts.
void imap_quote_string(char *dest, size_t dlen, const char *src, bool quote_backtick)
quote string according to IMAP rules
#define IMAP_CAP_ACL
RFC2086: IMAP4 ACL extension.
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.
char * munge_name
Munged version of the mailbox name.
void imap_pretty_mailbox(char *path, size_t pathlen, const char *folder)
Prettify an IMAP mailbox name.
@ TRANSFORM_NONE
No transformation.
bool C_ImapCheckSubscribed
Config: (imap) When opening a mailbox, ask the server for a list of subscribed folders.
void imap_disallow_reopen(struct Mailbox *m)
Disallow re-opening a folder upon expunge.
#define IMAP_EXPUNGE_PENDING
Messages on the server have been expunged.
struct Email ** emails
Array of Emails.
bool mutt_strn_equal(const char *a, const char *b, size_t num)
Check for equality of two strings (to a maximum), safely.
bool append
Mailbox is opened in append mode.
#define MUTT_ACL_CREATE
Create a mailbox.
@ IMAP_FATAL
Unrecoverable error occurred.
static size_t longest_common_prefix(char *dest, const char *src, size_t start, size_t dlen)
Find longest prefix common to two strings.
void imap_mdata_free(void **ptr)
Free the private Mailbox data - Implements Mailbox::mdata_free()
struct HashTable * uid_hash
unsigned int new_mail_count
Set when EXISTS notifies of new mail.
@ IMAP_EXEC_SUCCESS
Imap command executed or queued successfully.
#define MUTT_ACL_LOOKUP
Lookup mailbox (visible to 'list')
String manipulation buffer.
@ IMAP_BYE
Logged out from server.
enum MailboxType type
Type of Mailboxes this Account contains.
bool closing
If true, we are waiting for CLOSE completion.
@ LL_DEBUG3
Log at debug level 3.
struct ConnAccount account
Account details: username, password, etc.
@ IMAP_DISCONNECTED
Disconnected from server.
#define MUTT_ACL_INSERT
Add/copy into the mailbox (used when editing a message)
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()
@ IMAP_IDLE
Connection is idle.
int msg_deleted
Number of deleted messages.
struct ImapAccountData * imap_adata_new(struct Account *a)
Allocate and initialise a new ImapAccountData structure.
void mutt_socket_empty(struct Connection *conn)
Clear out any queued data.
#define MUTT_ACL_DELETE
Delete a message.
void mutt_buffer_dealloc(struct Buffer *buf)
Release the memory allocated by a buffer.
int imap_authenticate(struct ImapAccountData *adata)
Authenticate to an IMAP server.
bool C_ImapQresync
Config: (imap) Enable the QRESYNC extension.
unsigned char C_SslStarttls
Config: (ssl) Use STARTTLS on servers advertising the capability.
bool C_ImapIdle
Config: (imap) Use the IMAP IDLE extension to check for new mail.
int mutt_buffer_add_printf(struct Buffer *buf, const char *fmt,...)
Format a string appending a Buffer.
void mutt_account_tourl(struct ConnAccount *cac, struct Url *url)
Fill URL with info from account.
void imap_munge_mbox_name(bool unicode, char *dest, size_t dlen, const char *src)
Quote awkward characters in a mailbox name.
int imap_msg_save_hcache(struct Mailbox *m, struct Email *e)
Save message to the header cache - Implements MxOps::msg_save_hcache()
static int make_msg_set(struct Mailbox *m, struct Buffer *buf, enum MessageType flag, bool changed, bool invert, int *pos)
Make a message set.
struct ImapMboxData * imap_mdata_new(struct ImapAccountData *adata, const char *name)
Allocate and initialise a new ImapMboxData structure.
struct ImapList * cmdresult
void imap_qualify_path(char *buf, size_t buflen, struct ConnAccount *conn_account, char *path)
Make an absolute IMAP folder target.
#define IMAP_CAP_ENABLE
RFC5161.
#define mutt_buffer_mktemp(buf)
ImapCapFlags capabilities
int mutt_socket_readchar(struct Connection *conn, char *c)
simple read buffering to speed things up
#define TAILQ_FOREACH(var, head, field)
unsigned char status
ImapFlags, e.g. IMAP_FATAL.
int imap_cmd_step(struct ImapAccountData *adata)
Reads server responses from an IMAP command.
struct Buffer * mutt_buffer_init(struct Buffer *buf)
Initialise a new Buffer.
int mutt_socket_close(struct Connection *conn)
Close a socket.
size_t neomutt_mailboxlist_get_all(struct MailboxList *head, struct NeoMutt *n, enum MailboxType type)
Get a List of all Mailboxes.
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
static int check_capabilities(struct ImapAccountData *adata)
Make sure we can log in to this server.
char * mutt_str_dup(const char *str)
Copy a string, safely.
#define IMAP_FLAGS_PENDING
Flags have changed on the server.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
@ LL_DEBUG1
Log at debug level 1.
int imap_msg_close(struct Mailbox *m, struct Message *msg)
Close an email - Implements MxOps::msg_close()
#define MUTT_ACL_READ
Read the mailbox.
#define IMAP_CMD_POLL
Poll the tcp connection before running the imap command.
off_t size
Size of the Mailbox.
bool has_new
Mailbox has new mail.
@ SAVE_MOVE
Move message to another mailbox, removing the original.
@ MX_OPEN_OK
Open succeeded.
static enum MxStatus imap_mbox_close(struct Mailbox *m)
Close a Mailbox - Implements MxOps::mbox_close()
@ MUTT_DELETED
Deleted messages.
static bool imap_mbox_open_append(struct Mailbox *m, OpenMailboxFlags flags)
Open a Mailbox for appending - Implements MxOps::mbox_open_append()
sort_t mutt_get_sort_func(enum SortType method)
Get the sort function for a given sort id.
int imap_hcache_del(struct ImapMboxData *mdata, unsigned int uid)
Delete an item from the header cache.
Items in an IMAP browser.
struct Mailbox * mailbox
Mailbox in the list.
@ MUTT_ABORT
User aborted the question (with Ctrl-G)
time_t lastread
last time we read a command for the server
void mutt_buffer_reset(struct Buffer *buf)
Reset an existing Buffer.
int mutt_socket_poll(struct Connection *conn, time_t wait_secs)
Checks whether reads would block.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
#define STAILQ_EMPTY(head)
int imap_exec_msgset(struct Mailbox *m, const char *pre, const char *post, enum MessageType flag, bool changed, bool invert)
Prepare commands for all messages matching conditions.
struct ImapAccountData * imap_adata_get(struct Mailbox *m)
Get the Account data for this mailbox.
void mailbox_free(struct Mailbox **ptr)
Free a Mailbox.
struct Url * url_parse(const char *src)
Fill in Url.
struct Mailbox * mx_path_resolve(const char *path)
Get a Mailbox for a path.
struct ListNode * mutt_list_insert_tail(struct ListHead *h, char *s)
Append a string to the end of a List.
bool C_MessageCacheClean
Config: (imap/pop) Clean out obsolete entries from the message cache.
#define STAILQ_FOREACH(var, head, field)
int vcount
The number of virtual messages.
@ MX_STATUS_REOPENED
Mailbox was reopened.
void mutt_buffer_alloc(struct Buffer *buf, size_t new_size)
Make sure a buffer can store at least new_size bytes.
void imap_cmd_finish(struct ImapAccountData *adata)
Attempt to perform cleanup.
int imap_open_connection(struct ImapAccountData *adata)
Open an IMAP connection.
void imap_get_parent_path(const char *path, char *buf, size_t buflen)
Get the path of the parent folder.
void(* adata_free)(void **ptr)
Free the private data attached to the Account.
@ MUTT_READ
Messages that have been read.
bool mutt_istr_equal(const char *a, const char *b)
Compare two strings, ignoring case.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
@ MX_STATUS_NEW_MAIL
New mail received in Mailbox.
#define IMAP_CAP_IMAP4REV1
Server supports IMAP4rev1.
int fd
Socket file descriptor.
bool old
Email is seen, but unread.
bool active
Message is not to be removed.
enum QuadOption query_quadoption(enum QuadOption opt, const char *prompt)
Ask the user a quad-question.
bool imap_account_match(const struct ConnAccount *a1, const struct ConnAccount *a2)
Compare two Accounts.
void mx_alloc_memory(struct Mailbox *m)
Create storage for the emails.
static int imap_status(struct ImapAccountData *adata, struct ImapMboxData *mdata, bool queue)
Refresh the number of total and new messages.
size_t mutt_buffer_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
void mutt_account_unsetpass(struct ConnAccount *cac)
Unset ConnAccount's password.
void imap_hcache_close(struct ImapMboxData *mdata)
Close the header cache.
int imap_adata_find(const char *path, struct ImapAccountData **adata, struct ImapMboxData **mdata)
Find the Account data for this path.
#define IMAP_CAP_STARTTLS
RFC2595: STARTTLS.
void * mdata
Driver specific data.
unsigned char changed
Changed fields, e.g. MUTT_ENV_CHANGED_SUBJECT.
int url_tostring(struct Url *url, char *dest, size_t len, uint8_t flags)
Output the URL string for a given Url object.
@ NT_MAILBOX_UPDATE
Update internal tables.
static const struct Command imap_commands[]
static enum MxStatus imap_mbox_check_stats(struct Mailbox *m, uint8_t flags)
Check the Mailbox statistics - Implements MxOps::mbox_check_stats()
static void imap_logout(struct ImapAccountData *adata)
Gracefully log out of server.
A group of associated Mailboxes.
bool tagged
Email is tagged.
int imap_read_headers(struct Mailbox *m, unsigned int msn_begin, unsigned int msn_end, bool initial_download)
Read headers from the server.
char * path
path to temp file
void mutt_account_hook(const char *url)
Perform an account hook.
struct ImapCommand * cmds
bool changed
Mailbox has been modified.
A parsed URL proto://user:password@host:port/path?a=1&b=2
struct Account * account
Account that owns this Mailbox.
int imap_mailbox_status(struct Mailbox *m, bool queue)
Refresh the number of total and new messages.
IMAP-specific Email data -.
@ MUTT_ACCT_TYPE_IMAP
Imap Account.
#define MUTT_ACL_POST
Post (submit messages to the server)
#define IMAP_MAX_CMDLEN
Maximum length of command lines before they must be split (for lazy servers)
void url_free(struct Url **ptr)
Free the contents of a URL.
int msg_count
Total number of messages.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
@ MUTT_MAILBOX_ANY
Match any Mailbox type.
bool imap_msg_open(struct Mailbox *m, struct Message *msg, int msgno)
Open an email message in a Mailbox - Implements MxOps::msg_open()
char * imap_next_word(char *s)
Find where the next IMAP word begins.
bool unicode
If true, we can send UTF-8, and the server will use UTF8 rather than mUTF7.
@ MUTT_UNKNOWN
Mailbox wasn't recognised.
unsigned int uid
32-bit Message UID
void mutt_hash_int_delete(struct HashTable *table, unsigned int intkey, const void *data)
Remove an element from a Hash Table.
#define IMAP_RES_NO
<tag> NO ...
int imap_cmd_start(struct ImapAccountData *adata, const char *cmdstr)
Given an IMAP command, send it to the server.
void mutt_zstrm_wrap_conn(struct Connection *conn)
Wrap a compression layer around a Connection.
int mutt_save_message_ctx(struct Email *e, enum MessageSaveOpt save_opt, enum MessageTransformOpt transform_opt, struct Mailbox *m)
Save a message to a given mailbox.
void imap_msn_remove(struct MSN *msn, size_t idx)
Remove an entry from the cache.
@ MUTT_IMAP
'IMAP' Mailbox type
static int imap_path_pretty(char *buf, size_t buflen, const char *folder)
Abbreviate a Mailbox path - Implements MxOps::path_pretty()
int imap_cmd_idle(struct ImapAccountData *adata)
Enter the IDLE state.
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()
bool C_ImapRfc5161
Config: (imap) Use the IMAP ENABLE extension to select capabilities.
void imap_error(const char *where, const char *msg)
show an error and abort
unsigned long long modseq
struct Envelope * env
Envelope information.
#define mutt_debug(LEVEL,...)
int email_max
Number of pointers in emails.
@ MUTT_REPLIED
Messages that have been replied to.
@ MUTT_NO
User answered 'No', or assume 'No'.
#define IMAP_CAP_STATUS
Server supports STATUS command.
bool purge
Skip trash folder when deleting.
unsigned int seqno
tag sequence number, e.g. '{seqid}0001'
int imap_path_canon(char *buf, size_t buflen)
Canonicalise a Mailbox path - Implements MxOps::path_canon()
int msg_flagged
Number of flagged messages.
char * realpath
Used for duplicate detection, context comparison, and the sidebar.
FILE * fp
pointer to the message data
@ MX_STATUS_ERROR
An error occurred.
bool flagged
Marked important?
size_t mutt_str_len(const char *a)
Calculate the length of a string, safely.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
bool verbose
Display status messages?
#define IMAP_OPEN_NO_FLAGS
No flags are set.
time_t mutt_date_epoch(void)
Return the number of seconds since the Unix epoch.
void imap_adata_free(void **ptr)
Free the private Account data - Implements Account::adata_free()
@ SORT_ORDER
Sort by the order the messages appear in the mailbox.
static int complete_hosts(char *buf, size_t buflen)
Look for completion matches for mailboxes.
IMAP-specific Account data -.
void imap_close_connection(struct ImapAccountData *adata)
Close an IMAP connection.
#define MUTT_ACL_WRITE
Write to a message (for flagging or linking threads)
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
IMAP-specific Mailbox data -.
@ IMAP_CONNECTED
Connected to server.
void imap_edata_free(void **ptr)
Free the private Email data - Implements Email::edata_free()
int imap_cache_clean(struct Mailbox *m)
Delete all the entries in the message cache.
bool deleted
Email is deleted.
#define STAILQ_HEAD_INITIALIZER(head)
@ MUTT_TRASH
Trashed messages.
char * imap_fix_path(char delim, const char *mailbox, char *path, size_t plen)
Fix up the imap path.
bool readonly
Don't allow changes to the mailbox.
static int imap_path_is_empty(const char *path)
Is the mailbox empty - Implements MxOps::path_is_empty()
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()
char * mutt_str_cat(char *buf, size_t buflen, const char *s)
Concatenate two strings.
int imap_path_status(const char *path, bool queue)
Refresh the number of total and new messages.
#define IMAP_CAP_CONDSTORE
RFC7162.
char * imap_get_qualifier(char *buf)
Get the qualifier from a tagged response.
@ IMAP_AUTH_SUCCESS
Authentication successful.
int mutt_socket_open(struct Connection *conn)
Simple wrapper.
short C_DebugLevel
Config: Logging level for debug logs.
int imap_msg_commit(struct Mailbox *m, struct Message *msg)
Save changes to an email - Implements MxOps::msg_commit()
bool C_ImapListSubscribed
Config: (imap) When browsing a mailbox, only display subscribed folders.
#define IMAP_CMD_PASS
Command contains a password. Suppress logging.
WHERE short C_Sort
Config: Sort method for the index.
static char * get_flags(struct ListHead *hflags, char *s)
Make a simple list out of a FLAGS response.
void * edata
Driver-specific data.
void * mutt_mem_malloc(size_t size)
Allocate memory on the heap.
unsigned char state
ImapState, e.g. IMAP_AUTHENTICATED.
struct TagList tags
For drivers that support server tagging.
int imap_exec(struct ImapAccountData *adata, const char *cmdstr, ImapCmdFlags flags)
Execute a command and wait for the response from the server.
#define IMAP_RES_CONTINUE
* ...
static int compare_uid(const void *a, const void *b)
Compare two Emails by UID - Implements sort_t.
@ MUTT_TAG
Tagged messages.
#define IMAP_CAP_IDLE
RFC2177: IDLE.
void mutt_str_remove_trailing_ws(char *s)
Trim trailing whitespace from a string.
Container for Accounts, Notifications.
#define IMAP_EXPUNGE_EXPECTED
Messages will be expunged from the server.
struct Mailbox * mailbox
Current selected mailbox.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
WHERE char * C_Postponed
Config: Folder to store postponed messages.
void imap_allow_reopen(struct Mailbox *m)
Allow re-opening a folder upon expunge.
@ IMAP_EXEC_ERROR
Imap command failure.
int mx_ac_remove(struct Mailbox *m)
Remove a Mailbox from an Account and delete Account if empty.
void mailbox_changed(struct Mailbox *m, enum NotifyMailbox action)
Notify observers of a change to a Mailbox.
enum MailboxType imap_path_probe(const char *path, const struct stat *st)
Is this an IMAP Mailbox? - Implements MxOps::path_probe()
bool imap_has_flag(struct ListHead *flag_list, const char *flag)
Does the flag exist in the list.
struct ImapMboxData * imap_mdata_get(struct Mailbox *m)
Get the Mailbox data for this mailbox.
size_t mutt_buffer_len(const struct Buffer *buf)
Calculate the length of a Buffer.
#define IMAP_CMD_QUEUE
Queue a command, do not execute.
void * adata
Private data (for Mailbox backends)
int index
The absolute (unsorted) message number.
int imap_parse_path(const char *path, struct ConnAccount *cac, char *mailbox, size_t mailboxlen)
Parse an IMAP mailbox name into ConnAccount, name.
static void set_flag(struct Mailbox *m, AclFlags aclflag, bool flag, const char *str, char *flags, size_t flsize)
append str to flags if we currently have permission according to aclflag
int imap_create_mailbox(struct ImapAccountData *adata, char *mailbox)
Create a new mailbox.
void mutt_progress_update(struct Progress *progress, size_t pos, int percent)
Update the state of the progress bar.
static size_t plen
Length of cached packet.
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
@ IMAP_AUTHENTICATED
Connection is authenticated.
@ IMAP_EXEC_FATAL
Imap connection failure.
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.
int msg_unread
Number of unread messages.
#define IMAP_CMD_NO_FLAGS
No flags are set.
ImapOpenFlags reopen
Flags, e.g. IMAP_REOPEN_ALLOW.
int mutt_get_field(const char *field, char *buf, size_t buflen, CompletionFlags complete, bool multiple, char ***files, int *numfiles)
Ask the user for a string.
static int imap_path_parent(char *buf, size_t buflen)
Find the parent of a Mailbox path - Implements MxOps::path_parent()
#define IMAP_NEWMAIL_PENDING
New mail is waiting on the server.
static int imap_tags_edit(struct Mailbox *m, const char *tags, char *buf, size_t buflen)
Prompt and validate new messages tags - Implements MxOps::tags_edit()
char * mutt_buffer_strdup(const struct Buffer *buf)
Copy a Buffer's string.
@ MX_STATUS_FLAGS
Nondestructive flags change (IMAP)
bool attach_del
Has an attachment marked for deletion.
static const char * mailbox_path(const struct Mailbox *m)
Get the Mailbox's path string.
short C_ImapPollTimeout
Config: (imap) Maximum time to wait for a server response.
int mutt_str_atoui(const char *str, unsigned int *dst)
Convert ASCII string to an unsigned integer.
struct Mailbox * prev_mailbox
Previously selected mailbox.
void mutt_pretty_mailbox(char *buf, size_t buflen)
Shorten a mailbox path using '~' or '='.
bool replied
Email has been replied to.
enum QuadOption mutt_yesorno(const char *msg, enum QuadOption def)
Ask the user a Yes/No question.
char * data
Pointer to data.
#define IMAP_CAP_IMAP4
Server supports IMAP4.
The envelope/body of an email.
int mutt_ssl_starttls(struct Connection *conn)
Negotiate TLS over an already opened connection.
#define MUTT_ACL_SEEN
Change the 'seen' status of a message.
static bool compare_flags_for_copy(struct Email *e)
Compare local flags against the server.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
int mutt_str_atoull(const char *str, unsigned long long *dst)
Convert ASCII string to an unsigned long long.
void imap_mdata_cache_reset(struct ImapMboxData *mdata)
Release and clear cache data of ImapMboxData structure.
#define mutt_message(...)
int msg_new
Number of new messages.
@ IMAP_SELECTED
Mailbox is selected.
@ MX_OPEN_ERROR
Open failed with an error.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
struct ImapEmailData * imap_edata_get(struct Email *e)
Get the private data for this Email.
static enum MxStatus imap_mbox_check(struct Mailbox *m)
Check for new mail - Implements MxOps::mbox_check()
struct Buffer mutt_buffer_make(size_t size)
Make a new buffer on the stack.
bool mx_mbox_ac_link(struct Mailbox *m)
Link a Mailbox to an existing or new Account.
void mutt_list_free(struct ListHead *h)
Free a List AND its strings.
@ NT_MAILBOX_RESORT
Email list needs resorting.
#define IMAP_CMD_SINGLE
Run a single command.
#define IMAP_CAP_QRESYNC
RFC7162.
WHERE bool C_ConfirmCreate
Config: Confirm before creating a new mailbox.
unsigned int ssf
Security strength factor, in bits (see below)
#define COMMANDS_REGISTER(cmds)
size_t mutt_buffer_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
static enum MxOpenReturns imap_mbox_open(struct Mailbox *m)
Open a mailbox - Implements MxOps::mbox_open()
bool C_ImapCondstore
Config: (imap) Enable the CONDSTORE extension.
@ LL_DEBUG2
Log at debug level 2.
void neomutt_mailboxlist_clear(struct MailboxList *ml)
Free a Mailbox List.
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_CAP_COMPRESS
RFC4978: COMPRESS=DEFLATE.
bool changed
Email has been edited.
static bool imap_ac_add(struct Account *a, struct Mailbox *m)
Add a Mailbox to an Account - Implements MxOps::ac_add()
const char * imap_cmd_trailer(struct ImapAccountData *adata)
Extra information after tagged command response if any.
struct Mailbox * mx_mbox_find2(const char *path)
Find a Mailbox on an Account.
static int sync_helper(struct Mailbox *m, AclFlags right, enum MessageType flag, const char *name)
Sync flag changes to the server.
enum MxStatus imap_check_mailbox(struct Mailbox *m, bool force)
use the NOOP or IDLE command to poll for new mail
int imap_login(struct ImapAccountData *adata)
Open an IMAP connection.
@ MX_STATUS_OK
No changes.
static void imap_mbox_select(struct Mailbox *m)
Select a Mailbox.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
#define MUTT_COMP_NO_FLAGS
No flags are set.