X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=imap%2Fmessage.c;h=6c1fce7590d381107b6712ca49099b99158f39d5;hb=8eeb8c4bac4a99f7f61dd67105b3cdf35925d036;hp=1f634afb3fe009b99c401ccee39af62a7d0afdb3;hpb=f288d1771c814e6104da83e6f0f1761a40de1224;p=apps%2Fmadmutt.git diff --git a/imap/message.c b/imap/message.c index 1f634af..6c1fce7 100644 --- a/imap/message.c +++ b/imap/message.c @@ -13,12 +13,12 @@ #include #include +#include +#include #include "mutt.h" #include "imap_private.h" #include "message.h" -#include "mx.h" -#include "hcache.h" #ifdef HAVE_PGP #include "pgp.h" @@ -83,13 +83,13 @@ int imap_read_headers (IMAP_DATA * idata, int msgbegin, int msgend) /* 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) @@ -376,12 +376,11 @@ int imap_fetch_message (MESSAGE * msg, CONTEXT * ctx, int msgno) 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