- snprintf (hdrreq, sizeof (hdrreq), "BODY.PEEK[HEADER.FIELDS (%s%s%s)]",
- want_headers, ImapHeaders ? " " : "", ImapHeaders ? ImapHeaders : "");
+ safe_asprintf (&hdrreq, "BODY.PEEK[HEADER.FIELDS (%s%s%s)]",
+ want_headers, ImapHeaders ? " " : "", NONULL (ImapHeaders));
- snprintf (hdrreq, sizeof (hdrreq), "RFC822.HEADER.LINES (%s%s%s)",
- want_headers, ImapHeaders ? " " : "", ImapHeaders ? ImapHeaders : "");
+ safe_asprintf (&hdrreq, "RFC822.HEADER.LINES (%s%s%s)",
+ want_headers, ImapHeaders ? " " : "", NONULL (ImapHeaders));
}
else
{ /* Unable to fetch headers for lower versions */
mutt_error _("Unable to fetch headers from this IMAP server version.");
mutt_sleep (2); /* pause a moment to let the user see the error */
}
else
{ /* Unable to fetch headers for lower versions */
mutt_error _("Unable to fetch headers from this IMAP server version.");
mutt_sleep (2); /* pause a moment to let the user see the error */
if (!(fp = safe_fopen (tempfile, "w+")))
{
mutt_error (_("Could not create temporary file %s"), tempfile);
mutt_sleep (2);
if (!(fp = safe_fopen (tempfile, "w+")))
{
mutt_error (_("Could not create temporary file %s"), tempfile);
mutt_sleep (2);
- snprintf (buf, sizeof (buf),
- "FETCH %d:%d (UID FLAGS INTERNALDATE RFC822.SIZE %s)", msgno + 1,
- fetchlast, hdrreq);
-
- imap_cmd_start (idata, buf);
+ fetchlast = msgend + 1;
+ safe_asprintf (&cmd, "FETCH %d:%d (UID FLAGS INTERNALDATE RFC822.SIZE %s)",
+ msgno + 1, fetchlast, hdrreq);
+ imap_cmd_start (idata, cmd);
+ FREE (&cmd);
if (!(msg->fp = msg_cache_put (idata, h)))
{
cache->uid = HEADER_DATA(h)->uid;
if (!(msg->fp = msg_cache_put (idata, h)))
{
cache->uid = HEADER_DATA(h)->uid;
cache->path = safe_strdup (path);
if (!(msg->fp = safe_fopen (path, "w+")))
{
cache->path = safe_strdup (path);
if (!(msg->fp = safe_fopen (path, "w+")))
{
M_PROGRESS_SIZE, NetInc, len);
imap_munge_mbox_name (mbox, sizeof (mbox), mailbox);
M_PROGRESS_SIZE, NetInc, len);
imap_munge_mbox_name (mbox, sizeof (mbox), mailbox);
- snprintf (buf, sizeof (buf), "APPEND %s (%s%s%s%s%s) {%lu}", mbox,
+ imap_make_date (internaldate, msg->received);
+ snprintf (buf, sizeof (buf), "APPEND %s (%s%s%s%s%s) \"%s\" {%lu}", mbox,
msg->flags.read ? "\\Seen" : "",
msg->flags.read && (msg->flags.replied || msg->flags.flagged) ? " " : "",
msg->flags.replied ? "\\Answered" : "",
msg->flags.replied && msg->flags.flagged ? " " : "",
msg->flags.flagged ? "\\Flagged" : "",
msg->flags.read ? "\\Seen" : "",
msg->flags.read && (msg->flags.replied || msg->flags.flagged) ? " " : "",
msg->flags.replied ? "\\Answered" : "",
msg->flags.replied && msg->flags.flagged ? " " : "",
msg->flags.flagged ? "\\Flagged" : "",