X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..cefebddeeae89408bcf1b0474c5a734979e5e3ff:/commands.c?ds=sidebyside diff --git a/commands.c b/commands.c index 264880c..7d9c90d 100644 --- a/commands.c +++ b/commands.c @@ -1,6 +1,6 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * Copyright (C) 2000 Thomas Roessler + * Copyright (C) 2000-4,2006 Thomas Roessler * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -146,8 +146,8 @@ int mutt_display_message (HEADER *cur) } res = mutt_copy_message (fpout, Context, cur, cmflags, - (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) | CH_DECODE | CH_FROM); - if ((safe_fclose (&fpout) != 0 && errno != EPIPE) || res == -1) + (option (OPTWEED) ? (CH_WEED | CH_REORDER) : 0) | CH_DECODE | CH_FROM | CH_DISPLAY); + if ((safe_fclose (&fpout) != 0 && errno != EPIPE) || res < 0) { mutt_error (_("Could not copy message")); if (fpfilterout != NULL) @@ -246,6 +246,29 @@ void ci_bounce_message (HEADER *h, int *redraw) char *err = NULL; int rc; + /* RfC 5322 mandates a From: header, so warn before bouncing + * messages without one */ + if (h) + { + if (!h->env->from) + { + mutt_error _("Warning: message has no From: header"); + mutt_sleep (2); + } + } + else if (Context) + { + for (rc = 0; rc < Context->msgcount; rc++) + { + if (Context->hdrs[rc]->tagged && !Context->hdrs[rc]->env->from) + { + mutt_error ("Warning: message has no From: header"); + mutt_sleep (2); + break; + } + } + } + if(h) strfcpy(prompt, _("Bounce message to: "), sizeof(prompt)); else @@ -391,7 +414,7 @@ static int _mutt_pipe_message (HEADER *h, char *cmd, } pipe_msg (h, fpout, decode, print); - fclose (fpout); + safe_fclose (&fpout); rc = mutt_wait_filter (thepid); } else @@ -706,8 +729,6 @@ int mutt_save_message (HEADER *h, int delete, char prompt[SHORT_STRING], buf[_POSIX_PATH_MAX]; CONTEXT ctx; struct stat st; - BUFFY *tmp = NULL; - struct utimbuf ut; *redraw = 0; @@ -758,7 +779,7 @@ int mutt_save_message (HEADER *h, int delete, } } - mutt_pretty_mailbox (buf); + mutt_pretty_mailbox (buf, sizeof (buf)); if (mutt_enter_fname (prompt, buf, sizeof (buf), redraw, 0) == -1) return (-1); @@ -841,26 +862,7 @@ int mutt_save_message (HEADER *h, int delete, mx_close_mailbox (&ctx, NULL); if (need_buffy_cleanup) - { - if (option(OPTCHECKMBOXSIZE)) - { - tmp = mutt_find_mailbox (buf); - if (tmp && !tmp->new) - mutt_update_mailbox (tmp); - } - else - { - /* fix up the times so buffy won't get confused */ - if (st.st_mtime > st.st_atime) - { - ut.actime = st.st_atime; - ut.modtime = time (NULL); - utime (buf, &ut); - } - else - utime (buf, NULL); - } - } + mutt_buffy_cleanup (ctx.path, &st); mutt_clear_error (); return (0);