From: Brendan Cully Date: Sat, 13 Jun 2009 21:31:50 +0000 (-0700) Subject: Fix check for changed $postponed. X-Git-Tag: neomutt-20160307~579 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08fff3c1372db74a094d53a9db4c4129aa907527;p=neomutt Fix check for changed $postponed. The pointer-based check fails when the new $postponed string is stored in the same location. --- diff --git a/ChangeLog b/ChangeLog index ed0a44c03..b280adfbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,44 +1,45 @@ -2009-06-12 21:32 +0200 Rocco Rutte (a9117f697b27) +2009-06-13 01:08 +0200 Rocco Rutte (536771b4e085) - * handler.c: Don't insert Content-Description/form name into reply. - Closes #3164. + * commands.c, copy.c, copy.h, handler.c, protos.h, send.c, sendlib.c: + Rewrite header folding + + We now distinct between sending and display case. For display, we + always use tabs for folding for readability; for sending we now + correctly fold using whitespace found in the header. -2009-06-12 18:00 +0200 Rocco Rutte (d7afcf9a9f76) + Closes #2995. Closes #3080. - * ChangeLog, pgpkey.c: Allow ! suffix for pgp keys via $pgp_sign_as - and prompt. Closes #1928. +2009-06-12 23:10 +0200 Rocco Rutte (23de0e3c81f8) -2009-06-12 13:43 +0200 Rocco Rutte (ed206ad41108) + * UPDATING, init.h, mutt.h, send.c: Turn $fcc_attach into a + quadoption. Closes #2528. + + * handler.c: Don't insert Content-Description/form name into reply. + Closes #3164. - * ChangeLog, commands.c, recvcmd.c: Warn before bouncing messages - without From: header. Closes #3180. + * pgpkey.c: Allow ! suffix for pgp keys via $pgp_sign_as and + prompt. Closes #1928. -2009-06-12 15:21 +0200 Rocco Rutte (1673273a2e18) + * commands.c, recvcmd.c: Warn before bouncing messages without + From: header. Closes #3180. - * ChangeLog, smtp.c: SMTP: don't block but print CRLF for last line if - it's not terminated + * smtp.c: SMTP: don't block but print CRLF for last line if it's + not terminated 2009-06-11 18:34 +0200 Rocco Rutte (f60eb41ef63c) * UPDATING: Mention maildir mtime use in browser -2009-06-11 18:31 +0200 Rocco Rutte (fc60d44a5b22) - - * ChangeLog, send.c: Don't allow setting Return-Path: header via - my_hdr + * send.c: Don't allow setting Return-Path: header via my_hdr Mutt has use_envelope_from/envelope_from_address for that purpose. Closes #1840. -2009-06-11 18:17 +0200 Rocco Rutte (8efc1cd0b8c0) - * browser.c: Use only latest mtime of new/cur for browser, not whole stat() info -2009-06-11 18:14 +0200 Rocco Rutte (05f8c53b57a1) - - * ChangeLog, copy.c: Don't reformat Return-Path (angle brackets are - not optional). Closes #1702. + * copy.c: Don't reformat Return-Path (angle brackets are not + optional). Closes #1702. 2009-06-10 17:44 +0200 Rocco Rutte (0721c3f6320d) @@ -47,10 +48,8 @@ 2009-06-09 22:09 -0700 Brendan Cully (dc9ec900c657) - * ChangeLog, mutt_ssl.c: Improve host checking for SSL with - intermediate certificates. - -2009-06-09 22:03 -0700 Brendan Cully (9dcb7288039d) + * mutt_ssl.c: Improve host checking for SSL with intermediate + certificates. * mutt_ssl.c: Whitespace. diff --git a/postpone.c b/postpone.c index e826ffa31..fffbb71cd 100644 --- a/postpone.c +++ b/postpone.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2002 Michael R. Elkins * Copyright (C) 1999-2002,2004 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 * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -69,9 +69,9 @@ int mutt_num_postponed (int force) force = 1; } - if (Postponed != OldPostponed) + if (mutt_strcmp (Postponed, OldPostponed)) { - OldPostponed = Postponed; + OldPostponed = safe_strdup (Postponed); LastModify = 0; force = 1; } @@ -170,7 +170,7 @@ static HEADER *select_msg (void) * disabled while the postpone menu is being displayed. */ orig_sort = Sort; Sort = SORT_ORDER; - + while (!done) { switch (i = mutt_menuLoop (menu)) @@ -244,7 +244,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size mutt_error _("No postponed messages."); return (-1); } - + if (! PostContext->msgcount) { PostCount = 0; @@ -340,7 +340,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size hdr->security = mutt_parse_crypt_hdr (strchr (tmp->data, ':') + 1, 1, APPLICATION_PGP); hdr->security |= APPLICATION_PGP; - + /* remove the pgp field */ next = tmp->next; if (last) @@ -357,7 +357,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size hdr->security = mutt_parse_crypt_hdr (strchr (tmp->data, ':') + 1, 1, APPLICATION_SMIME); hdr->security |= APPLICATION_SMIME; - + /* remove the smime field */ next = tmp->next; if (last) @@ -374,16 +374,16 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size { char *t; mutt_free_list (&hdr->chain); - + t = strtok (tmp->data + 11, " \t\n"); while (t) { hdr->chain = mutt_add_list (hdr->chain, t); t = strtok (NULL, " \t\n"); } - + next = tmp->next; - if (last) + if (last) last->next = tmp->next; else hdr->env->userhdrs = tmp->next; @@ -412,11 +412,11 @@ int mutt_parse_crypt_hdr (char *p, int set_signas, int crypt_app) if (!WithCrypto) return 0; - + SKIPWS (p); for (; *p; p++) - { - + { + switch (*p) { case 'e': @@ -424,14 +424,14 @@ int mutt_parse_crypt_hdr (char *p, int set_signas, int crypt_app) flags |= ENCRYPT; break; - case 's': + case 's': case 'S': flags |= SIGN; q = sign_as; - + if (*(p+1) == '<') { - for (p += 2; + for (p += 2; *p && *p != '>' && q < sign_as + sizeof (sign_as) - 1; *q++ = *p++) ; @@ -442,12 +442,12 @@ int mutt_parse_crypt_hdr (char *p, int set_signas, int crypt_app) return 0; } } - + *q = '\0'; break; /* This used to be the micalg parameter. - * + * * It's no longer needed, so we just skip the parameter in order * to be able to recall old messages. */ @@ -465,18 +465,18 @@ int mutt_parse_crypt_hdr (char *p, int set_signas, int crypt_app) } break; - - + + case 'c': case 'C': q = smime_cryptalg; - + if(*(p+1) == '<') { for(p += 2; *p && *p != '>' && q < smime_cryptalg + sizeof(smime_cryptalg) - 1; *q++ = *p++) ; - + if(*p != '>') { mutt_error _("Illegal S/MIME header"); @@ -496,7 +496,7 @@ int mutt_parse_crypt_hdr (char *p, int set_signas, int crypt_app) mutt_error _("Illegal crypto header"); return 0; } - + } /* the cryptalg field must not be empty */ @@ -525,12 +525,12 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, char file[_POSIX_PATH_MAX]; BODY *b; FILE *bfp; - + int rv = -1; STATE s; - + memset (&s, 0, sizeof (s)); - + if (!fp && (msg = mx_open_message (ctx, hdr->msgno)) == NULL) return (-1); @@ -560,8 +560,8 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, goto err; mutt_message _("Decrypting message..."); - if (((ccap & APPLICATION_PGP) && crypt_pgp_decrypt_mime (fp, &bfp, newhdr->content, &b) == -1) - || ((ccap & APPLICATION_SMIME) && crypt_smime_decrypt_mime (fp, &bfp, newhdr->content, &b) == -1) + if (((ccap & APPLICATION_PGP) && crypt_pgp_decrypt_mime (fp, &bfp, newhdr->content, &b) == -1) + || ((ccap & APPLICATION_SMIME) && crypt_smime_decrypt_mime (fp, &bfp, newhdr->content, &b) == -1) || b == NULL) { err: @@ -578,11 +578,11 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, mutt_clear_error (); } - /* + /* * remove a potential multipart/signed layer - useful when - * resending messages + * resending messages */ - + if (WithCrypto && mutt_is_multipart_signed (newhdr->content)) { newhdr->security |= SIGN; @@ -591,32 +591,32 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, newhdr->security |= APPLICATION_PGP; else if ((WithCrypto & APPLICATION_SMIME)) newhdr->security |= APPLICATION_SMIME; - + /* destroy the signature */ mutt_free_body (&newhdr->content->parts->next); newhdr->content = mutt_remove_multipart (newhdr->content); } - /* + /* * We don't need no primary multipart. * Note: We _do_ preserve messages! - * - * XXX - we don't handle multipart/alternative in any + * + * XXX - we don't handle multipart/alternative in any * smart way when sending messages. However, one may * consider this a feature. - * + * */ if (newhdr->content->type == TYPEMULTIPART) newhdr->content = mutt_remove_multipart (newhdr->content); s.fpin = bfp; - + /* create temporary files for all attachments */ for (b = newhdr->content; b; b = b->next) { - + /* what follows is roughly a receive-mode variant of * mutt_get_tmp_attachment () from muttlib.c */ @@ -654,11 +654,11 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, if ((s.fpout = safe_fopen (file, "w")) == NULL) goto bail; - - if ((WithCrypto & APPLICATION_PGP) + + if ((WithCrypto & APPLICATION_PGP) && (mutt_is_application_pgp (b) & (ENCRYPT|SIGN))) { - + mutt_body_handler (b, &s); newhdr->security |= mutt_is_application_pgp (newhdr->content); @@ -683,14 +683,14 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, } /* Fix encryption flags. */ - + /* No inline if multipart. */ if (WithCrypto && (newhdr->security & INLINE) && newhdr->content->next) newhdr->security &= ~INLINE; - + /* Do we even support multiple mechanisms? */ newhdr->security &= WithCrypto | ~(APPLICATION_PGP|APPLICATION_SMIME); - + /* Theoretically, both could be set. Take the one the user wants to set by default. */ if ((newhdr->security & APPLICATION_PGP) && (newhdr->security & APPLICATION_SMIME)) { @@ -701,18 +701,18 @@ int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr, } rv = 0; - + bail: - + /* that's it. */ if (bfp != fp) safe_fclose (&bfp); if (msg) mx_close_message (&msg); - + if (rv == -1) { mutt_free_envelope (&newhdr->env); mutt_free_body (&newhdr->content); } - + return rv; }