From 56c0e189e2dd94193f9bcc32b90eadbdbaac1500 Mon Sep 17 00:00:00 2001 From: Brendan Cully Date: Sat, 6 Jun 2009 22:31:12 -0700 Subject: [PATCH] Do not treat already-seen headers as if they are new. See #2935. --- ChangeLog | 104 ++++++++++++++++++------------------------------- imap/message.c | 61 ++++++++++++++++------------- 2 files changed, 72 insertions(+), 93 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7db8a1575..9e8a26d82 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,19 +1,34 @@ -2009-06-03 21:58 +0200 Rocco Rutte (cdfc2dc540b0) +2009-06-07 02:09 +0200 Rocco Rutte (a786b0e8627c) + + * doc/dotlock.man, doc/makedoc.c, doc/mbox.man, doc/mmdf.man, + doc/mutt.man, init.h: Fix hyphens in manpages. Closes #1937 + +2009-06-04 17:07 +0200 Rocco Rutte (4f1ceaae93dc) + + * rfc3676.c: Fix pretty quoting for f=f by resetting space count when + flushing paragraph + +2009-06-03 22:35 +0200 Rocco Rutte (386f2ce6b872) + + * rfc3676.c: Fix several f=f bugs + + It fixes problems with space-handling in general (trailing spaces + for display, un-space-stuffing), fixes quote prefix for replies and + lowers FLOWED_MAX so we don't run into line length trouble too + early. * UPDATING, globals.h, init.h, pager.c: Don't abuse $pager_context for searches, add $search_context. See #976. 2009-06-03 09:06 +0200 Rocco Rutte (9e45d5bedc79) - * ChangeLog, pattern.c: Fix compiler warning + * pattern.c: Fix compiler warning 2009-06-02 20:25 +0200 Miroslav Lichvar (d1d0481d1ca1) * mutt_ssl_gnutls.c: Add support for GNUTLS_CERT_INSECURE_ALGORITHM error code -2009-06-02 20:11 +0200 Miroslav Lichvar (0b13183e40e0) - * mutt_ssl_gnutls.c: Don't ignore certificate verification errors on saved signer certs @@ -23,16 +38,12 @@ 2009-06-02 17:24 +0200 Rocco Rutte (8b2af5b64981) - * ChangeLog, buffy.c: Fix duplicate mailbox detection for remote + * buffy.c: Fix duplicate mailbox detection for remote folders -2009-06-02 17:05 +0200 Rocco Rutte (9ca14dff45c5) - * smtp.c: Fix array size -2009-06-02 15:43 +0200 Rocco Rutte (df4a17222b03) - - * ChangeLog, buffy.c: Thoroughly check for duplicates when parsing + * buffy.c: Thoroughly check for duplicates when parsing 'mailboxes' command. Closes #1428. 2009-06-01 14:50 +0200 Rocco Rutte (7a277ba306c9) @@ -40,36 +51,24 @@ * gnupgparse.c: Use mutt_atoi() when parsing GnuPG output. Closes #3145 -2009-06-01 13:22 +0200 Rocco Rutte (82a581c24f1a) - * hcache.c, mh.c: More atoi() fixes -2009-06-01 11:27 +0200 Rocco Rutte (371d7556fec3) - - * ChangeLog, smtp.c: SMTP: Use mutt_atoi() to parse server responses - -2009-06-01 11:26 +0200 Rocco Rutte (35a444838167) + * smtp.c: SMTP: Use mutt_atoi() to parse server responses * curs_main.c, edit.c, init.c, main.c, menu.c, mh.c, parse.c, resize.c, score.c, url.c: Use strtol() wrappers for most atoi() calls -2009-06-01 11:24 +0200 Rocco Rutte (f1b6eb09f2ad) - - * ChangeLog, lib.c, lib.h: Add mutt_atos(), mutt_atoi() and + * lib.c, lib.h: Add mutt_atos(), mutt_atoi() and mutt_atol() (strtol() wrappers) -2009-06-01 10:36 +0200 Rocco Rutte (36b7e267ce33) - * send.c: Treat address groups as no recipients When sending with Sendmail or SMTP we exclude address groups anyway, so treat these addresses as not present when checking for valid recipients before sending in the compose menu. -2009-06-01 10:29 +0200 Rocco Rutte (64250df0e9a4) - - * ChangeLog, smtp.c: Weed out address groups for SMTP the same way we + * smtp.c: Weed out address groups for SMTP the same way we do for sendmail 2009-05-31 19:19 -0700 Brendan Cully (0024860ab03e) @@ -77,28 +76,19 @@ * doc/Makefile.am: Allow chunked and unchunked manuals to build in parallel. -2009-05-31 19:07 -0700 Brendan Cully (fd18d0d6f3d0) - * mutt_ssl_gnutls.c: Remove trailing whitespace 2009-05-31 14:46 +0200 Rocco Rutte (8e591e80cd48) - * ChangeLog, smtp.c: SMTP: Don't send "undisclosed-recipients" in RCPT - TO + * smtp.c: SMTP: Don't send "undisclosed-recipients" in RCPT TO This happened for Bcc only messages. "undisclosed-recipients" is added in To: as guard against MTAs that leak BCCs if no To:/Cc: header is given. See Debian #529090. -2009-05-31 13:19 +0200 Rocco Rutte (9594f10d2038) - * init.h: Document that $pager_context affects searching, too -2009-05-31 13:00 +0200 Rocco Rutte (d5065254c2f1) - - * ChangeLog, UPDATING: Update UPDATING - -2009-05-31 12:54 +0200 Rocco Rutte (fdaed73dd66a) + * UPDATING: Update UPDATING * handler.c: Turn trailing \r\n to \n for qp-encoded messages. @@ -108,12 +98,8 @@ See #2898 though this is a partial fix only. -2009-05-31 12:40 +0200 Rocco Rutte (c3502979422b) - - * ChangeLog, pager.c: Give $pager_context lines of context when - searching page-based menus. Closes #976. - -2009-05-31 11:32 +0200 Rocco Rutte (68ee7fe4aa49) + * pager.c: Give $pager_context lines of context when searching + page-based menus. Closes #976. * handler.c, init.h, rfc3676.c: f=f: Strip trailing spaces for interoperability. Closes #3001. @@ -126,10 +112,8 @@ trailing spaces since from format=fixed we assume all lines are fixed (i.e. we don't want to errorneously make fixed lines flowed). -2009-05-31 10:40 +0200 Rocco Rutte (03ea7644f71b) - - * ChangeLog, handler.c, init.h, mutt.h: Add $honor_disposition to not - display attachments inline. Closes #3170. + * handler.c, init.h, mutt.h: Add $honor_disposition to not display + attachments inline. Closes #3170. Previously all MIME parts were displayed inline regardless of the Content-Disposition header (if present). With $honor_disposition @@ -151,18 +135,16 @@ 2009-05-30 00:24 +0200 Rocco Rutte (f65a1eb8abce) - * ChangeLog, smtp.c: Fix logic in f260f5836284 + * smtp.c: Fix logic in f260f5836284 2009-05-29 21:33 +0200 Rocco Rutte (c4d86d4ea260) * pager.c: Drop modified version of and use mutt_read_line() in pager, too -2009-05-29 21:24 +0200 Rocco Rutte (776ef9dbe4d2) - - * ChangeLog, history.c, init.c, lib.c, lib.h, mh.c, mutt_ssl_gnutls.c, - pgp.c, query.c, rfc1524.c, smime.c: Add flags to mutt_read_line() - for EOL-stripping and continuation support + * history.c, init.c, lib.c, lib.h, mh.c, mutt_ssl_gnutls.c, pgp.c, + query.c, rfc1524.c, smime.c: Add flags to mutt_read_line() for + EOL-stripping and continuation support We use these to stop supporting EOL-escaping with \ which was wrong in most cases (e.g. $history_file), support is kept for reading @@ -170,43 +152,33 @@ Leaving CRLF in will be used for the pager. -2009-05-29 16:40 +0200 Rocco Rutte (d13500626ea6) - * menu.c, pager.c, pattern.c: Fall back to search if no query exists for search-(next|opposite) The pager had the fall-through to search, so for consistency do that in other menues as well. -2009-05-29 16:21 +0200 Rocco Rutte (4d0640457c77) - - * ChangeLog, pager.c: Fix pager search prompt for reverse search + * pager.c: Fix pager search prompt for reverse search When doing a reverse search for the first time after switching to the pager, SearchBack is always 0 and thus gave the wrong prompt, change to using op directly. While I'm at it, unify search prompts. -2009-05-29 13:27 +0200 Rocco Rutte (f1a1e50c375d) - * doc/manual.xml.head: Manual: Fix markup of environment variables 2009-05-28 16:37 +0200 Rocco Rutte (f260f5836284) - * ChangeLog, smtp.c: SMTP: don't interactively authenticate without a + * smtp.c: SMTP: don't interactively authenticate without a password in batch/mailx mode Otherwise, if we don't have a password and curses is not running, the SASL authentication callback will crash mutt. We now abort if the password wasn't given in $smtp_url. -2009-05-28 15:20 +0200 Rocco Rutte (84a56dcb0572) - * doc/mutt.css: Manual: vertical-align table cells at the top -2009-05-28 15:19 +0200 Rocco Rutte (ee2ebf6cf363) - - * ChangeLog, doc/manual.xml.head, doc/mutt.css: Manual: Wrap muttrc - commands in + * doc/manual.xml.head, doc/mutt.css: Manual: Wrap muttrc commands + in 2009-05-27 23:14 -0700 Brendan Cully (5502fb790bab) diff --git a/imap/message.c b/imap/message.c index 32d794e63..56e697af4 100644 --- a/imap/message.c +++ b/imap/message.c @@ -1,22 +1,22 @@ /* * Copyright (C) 1996-9 Brandon Long * Copyright (C) 1999-2009 Brendan Cully - * + * * 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. * - */ + */ /* message parsing/updating functions */ @@ -85,12 +85,12 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) if (mutt_bit_isset (idata->capabilities,IMAP4REV1)) { - snprintf (hdrreq, sizeof (hdrreq), "BODY.PEEK[HEADER.FIELDS (%s%s%s)]", - want_headers, ImapHeaders ? " " : "", ImapHeaders ? ImapHeaders : ""); - } + snprintf (hdrreq, sizeof (hdrreq), "BODY.PEEK[HEADER.FIELDS (%s%s%s)]", + want_headers, ImapHeaders ? " " : "", ImapHeaders ? ImapHeaders : ""); + } else if (mutt_bit_isset (idata->capabilities,IMAP4)) { - snprintf (hdrreq, sizeof (hdrreq), "RFC822.HEADER.LINES (%s%s%s)", + snprintf (hdrreq, sizeof (hdrreq), "RFC822.HEADER.LINES (%s%s%s)", want_headers, ImapHeaders ? " " : "", ImapHeaders ? ImapHeaders : ""); } else @@ -142,14 +142,14 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) snprintf (buf, sizeof (buf), "UID FETCH 1:%u (UID FLAGS)", uidnext - 1); - + imap_cmd_start (idata, buf); - + rc = IMAP_CMD_CONTINUE; for (msgno = msgbegin; rc == IMAP_CMD_CONTINUE; msgno++) { mutt_progress_update (&progress, msgno + 1, -1); - + memset (&h, 0, sizeof (h)); h.data = safe_calloc (1, sizeof (IMAP_HEADER_DATA)); do @@ -183,13 +183,13 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) mfhrc = -1; continue; } - + idx = h.sid - 1; ctx->hdrs[idx] = imap_hcache_get (idata, h.data->uid); if (ctx->hdrs[idx]) { ctx->hdrs[idx]->index = idx; - /* messages which have not been expunged are ACTIVE (borrowed from mh + /* messages which have not been expunged are ACTIVE (borrowed from mh * folders) */ ctx->hdrs[idx]->active = 1; ctx->hdrs[idx]->read = h.data->read; @@ -287,11 +287,18 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) mfhrc = -1; continue; } + /* May receive FLAGS updates in a separate untagged response (#2935) */ + if (idx < ctx->msgcount) + { + dprint (2, (debugfile, "imap_read_headers: message %d is not new\n", + h.sid)); + continue; + } ctx->hdrs[idx] = mutt_new_header (); ctx->hdrs[idx]->index = h.sid - 1; - /* messages which have not been expunged are ACTIVE (borrowed from mh + /* messages which have not been expunged are ACTIVE (borrowed from mh * folders) */ ctx->hdrs[idx]->active = 1; ctx->hdrs[idx]->read = h.data->read; @@ -443,7 +450,7 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) * also try to update it. HACK until all this code can be moved into the * command handler */ h->active = 0; - + snprintf (buf, sizeof (buf), "UID FETCH %u %s", HEADER_DATA(h)->uid, (mutt_bit_isset (idata->capabilities, IMAP4REV1) ? (option (OPTIMAPPEEK) ? "BODY.PEEK[]" : "BODY[]") : @@ -516,7 +523,7 @@ int imap_fetch_message (MESSAGE *msg, CONTEXT *ctx, int msgno) mutt_perror (cache->path); goto bail; } - + if (rc != IMAP_CMD_OK) goto bail; @@ -586,7 +593,7 @@ int imap_append_message (CONTEXT *ctx, MESSAGE *msg) FILE *fp; char buf[LONG_STRING]; char mbox[LONG_STRING]; - char mailbox[LONG_STRING]; + char mailbox[LONG_STRING]; size_t len; progress_t progressbar; size_t sent; @@ -602,7 +609,7 @@ int imap_append_message (CONTEXT *ctx, MESSAGE *msg) imap_fix_path (idata, mx.mbox, mailbox, sizeof (mailbox)); if (!*mailbox) strfcpy (mailbox, "INBOX", sizeof (mailbox)); - + if ((fp = fopen (msg->path, "r")) == NULL) { mutt_perror (msg->path); @@ -672,7 +679,7 @@ int imap_append_message (CONTEXT *ctx, MESSAGE *msg) mutt_progress_update (&progressbar, sent, -1); } } - + if (len) flush_buffer(buf, &len, idata->conn); @@ -745,7 +752,7 @@ int imap_copy_messages (CONTEXT* ctx, HEADER* h, char* dest, int delete) dprint (3, (debugfile, "imap_copy_messages: Message contains attachments to be deleted\n")); return 1; } - + imap_fix_path (idata, mx.mbox, mbox, sizeof (mbox)); if (!*mbox) strfcpy (mbox, "INBOX", sizeof (mbox)); @@ -810,7 +817,7 @@ int imap_copy_messages (CONTEXT* ctx, HEADER* h, char* dest, int delete) dprint (1, (debugfile, "imap_copy_messages: could not sync\n")); goto fail; } - } + } if ((rc = imap_exec (idata, cmd.data, IMAP_CMD_QUEUE)) < 0) { dprint (1, (debugfile, "could not queue copy\n")); @@ -1026,14 +1033,14 @@ char* imap_set_flags (IMAP_DATA* idata, HEADER* h, char* s) dprint (2, (debugfile, "imap_fetch_message: parsing FLAGS\n")); if ((s = msg_parse_flags (&newh, s)) == NULL) return NULL; - + /* YAUH (yet another ugly hack): temporarily set context to * read-write even if it's read-only, so *server* updates of * flags can be processed by mutt_set_flag. ctx->changed must * be restored afterwards */ readonly = ctx->readonly; ctx->readonly = 0; - + mutt_set_flag (ctx, h, M_NEW, !(hd->read || hd->old)); mutt_set_flag (ctx, h, M_OLD, hd->old); mutt_set_flag (ctx, h, M_READ, hd->read); @@ -1067,7 +1074,7 @@ static int msg_fetch_header (CONTEXT* ctx, IMAP_HEADER* h, char* buf, FILE* fp) if (buf[0] != '*') return rc; - + /* skip to message number */ buf = imap_next_word (buf); h->sid = atoi (buf); @@ -1086,7 +1093,7 @@ static int msg_fetch_header (CONTEXT* ctx, IMAP_HEADER* h, char* buf, FILE* fp) * read header lines and call it again. Silly. */ if ((rc = msg_parse_fetch (h, buf)) != -2 || !fp) return rc; - + if (imap_get_literal_count (buf, &bytes) == 0) { imap_read_literal (fp, idata, bytes, NULL); @@ -1097,13 +1104,13 @@ static int msg_fetch_header (CONTEXT* ctx, IMAP_HEADER* h, char* buf, FILE* fp) * interchangeably at any time. */ if (imap_cmd_step (idata) != IMAP_CMD_CONTINUE) return rc; - + if (msg_parse_fetch (h, idata->buf) == -1) return rc; } rc = 0; /* success */ - + /* subtract headers from message size - unfortunately only the subset of * headers we've requested. */ h->content_length -= bytes; -- 2.40.0