1966{
1968 char buf[1024] = { 0 };
1969 char *pc = NULL;
1970 unsigned int bytes;
1971 unsigned int uid;
1972 bool retried = false;
1973 bool read;
1974 int rc;
1975
1976
1977
1978 bool fetched = false;
1979
1981
1983 return false;
1984
1986 if (!e)
1987 return false;
1988
1991 {
1993 return true;
1994 goto parsemsg;
1995 }
1996
1997
1998
1999 bool output_progress = !isendwin() && m->
verbose;
2000 if (output_progress)
2002
2005 {
2011
2013 return false;
2014 }
2015
2016
2017
2018
2020
2022 snprintf(buf,
sizeof(buf),
"UID FETCH %u %s",
imap_edata_get(e)->uid,
2024 (c_imap_peek ? "BODY.PEEK[]" : "BODY[]") :
2025 "RFC822"));
2026
2028 do
2029 {
2032 break;
2033
2037
2039 {
2040 while (*pc)
2041 {
2043 if (pc[0] == '(')
2044 pc++;
2046 {
2049 goto bail;
2051 {
2052 mutt_error(
_(
"The message index is incorrect. Try reopening the mailbox."));
2053 }
2054 }
2056 {
2059 {
2061 goto bail;
2062 }
2063 struct Progress *progress = output_progress ?
2066 NULL;
2069 if (res < 0)
2070 {
2071 goto bail;
2072 }
2073
2076 goto bail;
2078
2079 fetched = true;
2080 }
2081
2082
2083
2084
2086 {
2088 if (!pc)
2089 goto bail;
2090 }
2091 }
2092 }
2094
2095
2097
2099 if (ferror(msg->
fp))
2100 goto bail;
2101
2103 goto bail;
2104
2106 goto bail;
2107
2109
2110parsemsg:
2111
2112
2114
2115
2116
2117
2118
2122
2123
2124
2125 if (read != e->
read)
2126 {
2129 }
2130
2132 fgets(buf,
sizeof(buf), msg->
fp);
2133 while (!feof(msg->
fp))
2134 {
2136 fgets(buf,
sizeof(buf), msg->
fp);
2137 }
2138
2140
2144
2145
2147 {
2149 retried = true;
2150 goto parsemsg;
2151 }
2152
2153 return true;
2154
2155bail:
2159 return false;
2160}
const char * mutt_str_atoui(const char *str, unsigned int *dst)
Convert ASCII string to an unsigned integer.
static const char * mutt_buffer_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.
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)
#define mutt_message(...)
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.
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)
#define mutt_buffer_mktemp(buf)
struct Envelope * mutt_rfc822_read_header(FILE *fp, struct Email *e, bool user_hdrs, bool weed)
Parses an RFC822 header.
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
@ MUTT_PROGRESS_NET
Progress tracks bytes, according to $net_inc
void progress_free(struct Progress **ptr)
Free a Progress Bar.
struct Progress * progress_new(const char *msg, enum ProgressType type, size_t size)
Create a new Progress Bar.
#define mutt_set_flag(m, e, flag, bf)
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.
The envelope/body of an email.
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.
int msgno
Number displayed to the user.
IMAP-specific Account data -.
ImapCapFlags capabilities
Capability flags.
struct Email ** emails
Array of Emails.
bool verbose
Display status messages?
FILE * fp
pointer to the message data
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.