2016{
2018 char buf[1024] = { 0 };
2019 char *pc = NULL;
2020 unsigned int bytes = 0;
2021 unsigned int uid = 0;
2022 bool retried = false;
2023 bool read;
2024 int rc;
2025
2026
2027
2028 bool fetched = false;
2029
2031
2033 return false;
2034
2037 {
2039 return true;
2040 goto parsemsg;
2041 }
2042
2043
2044
2045 bool output_progress = !isendwin() && m->
verbose;
2046 if (output_progress)
2048
2051 {
2057
2059 return false;
2060 }
2061
2062
2063
2064
2066
2068 snprintf(buf,
sizeof(buf),
"UID FETCH %u %s",
imap_edata_get(e)->uid,
2070 (c_imap_peek ? "BODY.PEEK[]" : "BODY[]") :
2071 "RFC822"));
2072
2074 do
2075 {
2078 break;
2079
2083
2085 {
2086 while (*pc)
2087 {
2089 if (pc[0] == '(')
2090 pc++;
2092 {
2095 goto bail;
2097 {
2098 mutt_error(
_(
"The message index is incorrect. Try reopening the mailbox."));
2099 }
2100 }
2102 {
2105 {
2107 goto bail;
2108 }
2109
2111 if (res < 0)
2112 {
2113 goto bail;
2114 }
2115
2118 goto bail;
2120
2121 fetched = true;
2122 }
2124 {
2125
2126
2127
2128
2130 if (!pc)
2131 goto bail;
2132 }
2133 }
2134 }
2136
2137
2139
2141 if (ferror(msg->
fp))
2142 goto bail;
2143
2145 goto bail;
2146
2148 goto bail;
2149
2152
2153parsemsg:
2154
2155
2156 fseek(msg->
fp, 0, SEEK_SET);
2158
2159
2160
2161
2162
2166
2167
2168
2169 if (read != e->
read)
2170 {
2173 }
2174
2176 while (fgets(buf,
sizeof(buf), msg->
fp) && !feof(msg->
fp))
2177 {
2179 }
2180
2182
2184 fseek(msg->
fp, 0, SEEK_SET);
2187
2188
2190 {
2192 retried = true;
2193 goto parsemsg;
2194 }
2195
2196 return true;
2197
2198bail:
2202 return false;
2203}
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.
#define mutt_file_fclose(FP)
#define mutt_file_fopen(PATH, MODE)
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.
#define IMAP_RES_OK
<tag> OK ...
int imap_get_literal_count(char *buf, unsigned int *bytes)
Write number of bytes in an IMAP literal into bytes.
void imap_error(const char *where, const char *msg)
Show an error and abort.
@ IMAP_CAP_IMAP4REV1
Server supports IMAP4rev1.
#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.
char * buf
Command buffer.
bool parsed
Email has been parsed.
bool verbose
Display status messages?
FILE * fp
pointer to the message data
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.