#include <lib-lib/lib-lib.h>
#include <lib-ui/curses.h>
+#include <lib-mx/mx.h>
+#include <lib-mx/hcache.h>
#include "mutt.h"
#include "imap_private.h"
#include "message.h"
-#include "mx.h"
-#include "hcache.h"
#ifdef HAVE_PGP
#include "pgp.h"
/* instead of downloading all headers and then parsing them, we parse them
* as they come in. */
- mutt_mktemp (tempfile);
- if (!(fp = safe_fopen (tempfile, "w+"))) {
- mutt_error (_("Could not create temporary file %s"), tempfile);
- mutt_sleep (2);
+ fp = m_tempfile(tempfile, sizeof(tempfile), NONULL(Tempdir), NULL);
+ if (!fp) {
+ mutt_error(_("Could not create temporary file"));
+ mutt_sleep(2);
return -1;
}
- unlink (tempfile);
+ unlink(tempfile);
/* make sure context has room to hold the mailbox */
while ((msgend) >= idata->ctx->hdrmax)
mutt_message _("Fetching message...");
cache->uid = HEADER_DATA (h)->uid;
- mutt_mktemp (path);
- cache->path = m_strdup(path);
- if (!(msg->fp = safe_fopen (path, "w+"))) {
- p_delete(&cache->path);
+ msg->fp = m_tempfile(path, sizeof(path), NONULL(Tempdir), NULL);
+ if (!msg->fp) {
return -1;
}
+ cache->path = m_strdup(path);
/* mark this header as currently inactive so the command handler won't
* also try to update it. HACK until all this code can be moved into the