#include "pgp.h"
#endif
+#include <stdint.h>
+
static void flush_buffer(char* buf, size_t* len, CONNECTION* conn);
static int msg_fetch_header (CONTEXT* ctx, IMAP_HEADER* h, char* buf,
FILE* fp);
IMAP_HEADER h;
int rc, mfhrc, oldmsgcount;
int fetchlast = 0;
- const char *want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE IN-REPLY-TO REPLY-TO LINES X-LABEL";
+ const char *want_headers = "DATE FROM SUBJECT TO CC MESSAGE-ID REFERENCES CONTENT-TYPE CONTENT-DESCRIPTION IN-REPLY-TO REPLY-TO LINES LIST-POST X-LABEL";
#if USE_HCACHE
void *hc = NULL;
- unsigned long long *uid_validity = NULL;
+ uint64_t *uid_validity = NULL;
char uid_buf[64];
#endif /* USE_HCACHE */
if (mutt_bit_isset (idata->capabilities,IMAP4REV1))
{
- snprintf (hdrreq, sizeof (hdrreq), "BODY.PEEK[HEADER.FIELDS (%s)]",
- want_headers);
+ snprintf (hdrreq, sizeof (hdrreq), "BODY.PEEK[HEADER.FIELDS (%s%s%s)]",
+ want_headers, ImapHeaders ? " " : "", ImapHeaders ? ImapHeaders : "");
}
else if (mutt_bit_isset (idata->capabilities,IMAP4))
{
- snprintf (hdrreq, sizeof (hdrreq), "RFC822.HEADER.LINES (%s)",
- want_headers);
+ snprintf (hdrreq, sizeof (hdrreq), "RFC822.HEADER.LINES (%s%s%s)",
+ want_headers, ImapHeaders ? " " : "", ImapHeaders ? ImapHeaders : "");
}
else
{ /* Unable to fetch headers for lower versions */
fputs ("\n\n", fp);
sprintf(uid_buf, "/%u", h.data->uid); /* XXX --tg 21:41 04-07-11 */
- uid_validity = (unsigned long long *) mutt_hcache_fetch (hc, uid_buf, &imap_hcache_keylen);
+ uid_validity = (uint64_t *) mutt_hcache_fetch (hc, uid_buf, &imap_hcache_keylen);
if (uid_validity != NULL
&& *uid_validity == idata->uid_validity) {
* command handler */
h->active = 0;
- snprintf (buf, sizeof (buf), "UID FETCH %d %s", HEADER_DATA(h)->uid,
+ snprintf (buf, sizeof (buf), "UID FETCH %u %s", HEADER_DATA(h)->uid,
(mutt_bit_isset (idata->capabilities, IMAP4REV1) ?
(option (OPTIMAPPEEK) ? "BODY.PEEK[]" : "BODY[]") :
"RFC822"));
rewind (fp);
imap_munge_mbox_name (mbox, sizeof (mbox), mailbox);
- snprintf (buf, sizeof (buf), "APPEND %s (\\Seen) {%d}", mbox, len);
+ snprintf (buf, sizeof (buf), "APPEND %s (\\Seen) {%lu}", mbox, len);
imap_cmd_start (idata, buf);
{
if (msg_has_flag (mailbox_flags, keywords->data))
{
- strncat (s, keywords->data, slen);
- strncat (s, " ", slen);
+ safe_strcat (s, slen, keywords->data);
+ safe_strcat (s, slen, " ");
}
keywords = keywords->next;
}
if (msg_parse_fetch (h, buf) != -2)
return rc;
- if (imap_get_literal_count (buf, &bytes) < 0)
- return rc;
- imap_read_literal (fp, idata, bytes);
-
- /* we may have other fields of the FETCH _after_ the literal
- * (eg Domino puts FLAGS here). Nothing wrong with that, either.
- * This all has to go - we should accept literals and nonliterals
- * interchangeably at any time. */
- if (imap_cmd_step (idata) != IMAP_CMD_CONTINUE)
- return -2;
+ if (imap_get_literal_count (buf, &bytes) == 0)
+ {
+ imap_read_literal (fp, idata, bytes);
+
+ /* we may have other fields of the FETCH _after_ the literal
+ * (eg Domino puts FLAGS here). Nothing wrong with that, either.
+ * This all has to go - we should accept literals and nonliterals
+ * interchangeably at any time. */
+ if (imap_cmd_step (idata) != IMAP_CMD_CONTINUE)
+ return rc;
- if (msg_parse_fetch (h, idata->cmd.buf) == -1)
- return rc;
+ if (msg_parse_fetch (h, idata->cmd.buf) == -1)
+ return rc;
+ }
rc = 0; /* success */