1957{
1959 char buf[1024] = { 0 };
1960 char *pc = NULL;
1961 unsigned int bytes;
1962 unsigned int uid;
1963 bool retried = false;
1964 bool read;
1965 int rc;
1966
1967
1968
1969 bool fetched = false;
1970
1972
1974 return false;
1975
1978 {
1980 return true;
1981 goto parsemsg;
1982 }
1983
1984
1985
1986 bool output_progress = !isendwin() && m->
verbose;
1987 if (output_progress)
1989
1992 {
1998
2000 return false;
2001 }
2002
2003
2004
2005
2007
2009 snprintf(buf,
sizeof(buf),
"UID FETCH %u %s",
imap_edata_get(e)->uid,
2011 (c_imap_peek ? "BODY.PEEK[]" : "BODY[]") :
2012 "RFC822"));
2013
2015 do
2016 {
2019 break;
2020
2024
2026 {
2027 while (*pc)
2028 {
2030 if (pc[0] == '(')
2031 pc++;
2033 {
2036 goto bail;
2038 {
2039 mutt_error(
_(
"The message index is incorrect. Try reopening the mailbox."));
2040 }
2041 }
2043 {
2046 {
2048 goto bail;
2049 }
2050
2052 if (res < 0)
2053 {
2054 goto bail;
2055 }
2056
2059 goto bail;
2061
2062 fetched = true;
2063 }
2065 {
2066
2067
2068
2069
2071 if (!pc)
2072 goto bail;
2073 }
2074 }
2075 }
2077
2078
2080
2082 if (ferror(msg->
fp))
2083 goto bail;
2084
2086 goto bail;
2087
2089 goto bail;
2090
2093
2094parsemsg:
2095
2096
2098
2099
2100
2101
2102
2106
2107
2108
2109 if (read != e->
read)
2110 {
2113 }
2114
2116 while (fgets(buf,
sizeof(buf), msg->
fp) && !feof(msg->
fp))
2117 {
2119 }
2120
2122
2126
2127
2129 {
2131 retried = true;
2132 goto parsemsg;
2133 }
2134
2135 return true;
2136
2137bail:
2141 return false;
2142}
const char * mutt_str_atoui(const char *str, unsigned int *dst)
Convert ASCII string to an unsigned integer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
Parses an RFC822 header.
void mutt_env_merge(struct Envelope *base, struct Envelope **extra)
Merge the headers of two Envelopes.
FILE * mutt_file_fopen(const char *path, const char *mode)
Call fopen() safely.
int mutt_file_fclose(FILE **fp)
Close a FILE handle (and NULL the pointer)
void mutt_set_flag(struct Mailbox *m, struct Email *e, enum MessageType flag, bool bf, bool upd_mbox)
Set a flag on an email.
#define mutt_message(...)
#define mutt_debug(LEVEL,...)
struct ImapAccountData * imap_adata_get(struct Mailbox *m)
Get the Account data for this mailbox.
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.
bool imap_code(const char *s)
Was the command successful.
struct ImapEmailData * imap_edata_get(struct Email *e)
Get the private data for this Email.
static FILE * msg_cache_put(struct Mailbox *m, struct Email *e)
Put an email into the message cache.
char * imap_set_flags(struct Mailbox *m, struct Email *e, char *s, bool *server_changes)
Fill the message header according to the server flags.
static FILE * msg_cache_get(struct Mailbox *m, struct Email *e)
Get the message cache entry for an email.
int imap_cache_del(struct Mailbox *m, struct Email *e)
Delete an email from the body cache.
static int msg_cache_commit(struct Mailbox *m, struct Email *e)
Add to the message cache.
int imap_get_literal_count(const char *buf, unsigned int *bytes)
Write number of bytes in an IMAP literal into bytes.
#define IMAP_RES_OK
<tag> OK ...
#define IMAP_CAP_IMAP4REV1
Server supports IMAP4rev1.
void imap_error(const char *where, const char *msg)
Show an error and abort.
#define IMAP_RES_CONTINUE
* ...
char * imap_next_word(char *s)
Find where the next IMAP word begins.
int imap_read_literal(FILE *fp, struct ImapAccountData *adata, unsigned long bytes, struct Progress *progress)
Read bytes bytes from server into file.
@ LL_DEBUG1
Log at debug level 1.
size_t mutt_istr_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix, ignoring case.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
void * adata
Private data (for Mailbox backends)
LOFF_T offset
offset where the actual data begins
LOFF_T length
length (in bytes) of attachment
String manipulation buffer.
struct Envelope * env
Envelope information.
int lines
How many lines in the body of this message?
struct Body * body
List of MIME parts.
bool active
Message is not to be removed.
bool changed
Email has been edited.
IMAP-specific Account data -.
ImapCapFlags capabilities
Capability flags.
bool verbose
Display status messages?
FILE * fp
pointer to the message data
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.