--- PATCHES~ Tue Nov 6 19:59:33 2001 +++ PATCHES Tue Nov 6 19:59:42 2001 @@ -1,0 +1 @@ +patch-1.5.0.ats.mark_old.1 Index: buffy.c =================================================================== RCS file: /home/roessler/cvs/mutt/buffy.c,v retrieving revision 3.0 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.0 buffy.c --- buffy.c 2002/01/24 12:10:48 3.0 +++ buffy.c 2002/01/26 04:13:18 @@ -100,7 +100,7 @@ int test_last_status_new (FILE * f) hdr = mutt_new_header (); mutt_read_rfc822_header (f, hdr, 0, 0); - if (!(hdr->read || hdr->old)) + if (!(hdr->read || (option(OPTSEEOLD) && hdr->old))) result = 1; mutt_free_header (&hdr); Index: curs_main.c =================================================================== RCS file: /home/roessler/cvs/mutt/curs_main.c,v retrieving revision 3.1 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.1 curs_main.c --- curs_main.c 2002/01/24 21:53:19 3.1 +++ curs_main.c 2002/01/26 04:13:19 @@ -214,7 +214,7 @@ static int ci_first_message (void) if (! Context->hdrs[Context->v2r[i]]->read && ! Context->hdrs[Context->v2r[i]]->deleted) { - if (! Context->hdrs[Context->v2r[i]]->old) + if (! (option(OPTSEEOLD) && Context->hdrs[Context->v2r[i]]->old)) return (i); else if (old == -1) old = i; @@ -1299,7 +1299,8 @@ int mutt_index_menu (void) } else if ((!CURHDRi->deleted && !CURHDRi->read)) { - if (op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD || !CURHDRi->old) + if (op == OP_MAIN_NEXT_UNREAD || op == OP_MAIN_PREV_UNREAD || + !(option(OPTSEEOLD) && CURHDRi->old)) { menu->current = i; break; @@ -1379,7 +1380,7 @@ int mutt_index_menu (void) if (Context->hdrs[Context->v2r[j]]->tagged) { if (Context->hdrs[Context->v2r[j]]->read || - Context->hdrs[Context->v2r[j]]->old) + (option(OPTSEEOLD) && Context->hdrs[Context->v2r[j]]->old)) mutt_set_flag (Context, Context->hdrs[Context->v2r[j]], M_NEW, 1); else mutt_set_flag (Context, Context->hdrs[Context->v2r[j]], M_READ, 1); @@ -1389,7 +1390,7 @@ int mutt_index_menu (void) } else { - if (CURHDR->read || CURHDR->old) + if (CURHDR->read || (option(OPTSEEOLD) && CURHDR->old)) mutt_set_flag (Context, CURHDR, M_NEW, 1); else mutt_set_flag (Context, CURHDR, M_READ, 1); Index: flags.c =================================================================== RCS file: /home/roessler/cvs/mutt/flags.c,v retrieving revision 3.0 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.0 flags.c --- flags.c 2002/01/24 12:10:49 3.0 +++ flags.c 2002/01/26 04:13:19 @@ -78,7 +78,7 @@ void _mutt_set_flag (CONTEXT *ctx, HEADE case M_NEW: if (bf) { - if (h->read || h->old) + if (h->read || (option(OPTSEEOLD) && h->old)) { h->old = 0; if (upd_ctx) ctx->new++; @@ -304,6 +304,11 @@ int mutt_change_flag (HEADER *h, int bf) case 'o': case 'O': + if (!option(OPTSEEOLD)) { + mutt_error _("Set $see_old first"); + return (-1); + } + if (h) mutt_set_flag (Context, h, M_READ, !bf); else Index: hdrline.c =================================================================== RCS file: /home/roessler/cvs/mutt/hdrline.c,v retrieving revision 3.1 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.1 hdrline.c --- hdrline.c 2002/01/24 21:53:19 3.1 +++ hdrline.c 2002/01/26 04:13:19 @@ -559,7 +559,7 @@ hdr_format_str (char *dest, ch = 'r'; else if (hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno)) ch = '-'; - else if (hdr->old) + else if (option(OPTSEEOLD) && hdr->old) ch = 'O'; else ch = 'N'; @@ -638,7 +638,8 @@ hdr_format_str (char *dest, snprintf (buf2, sizeof (buf2), "%c%c%c", (THREAD_NEW ? 'n' : (THREAD_OLD ? 'o' : ((hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno)) - ? (hdr->replied ? 'r' : ' ') : (hdr->old ? 'O' : 'N')))), + ? (hdr->replied ? 'r' : ' ') : + ((option(OPTSEEOLD) && hdr->old) ? 'O' : 'N')))), hdr->deleted ? 'D' : (hdr->attach_del ? 'd' : ch), hdr->tagged ? '*' : (hdr->flagged ? '!' : Index: init.h =================================================================== RCS file: /home/roessler/cvs/mutt/init.h,v retrieving revision 3.2 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.2 init.h --- init.h 2002/01/24 21:53:19 3.2 +++ init.h 2002/01/26 04:13:22 @@ -937,16 +937,17 @@ struct option_t MuttVars[] = { ** to maildir-style mailboxes. Setting it will have no effect on other ** mailbox types. */ - { "mark_old", DT_BOOL, R_BOTH, OPTMARKOLD, 1 }, + { "mark_old", DT_QUAD, R_NONE, OPT_MARKOLD, M_YES }, /* ** .pp - ** Controls whether or not Mutt makes the distinction between \fInew\fP - ** messages and \fIold\fP \fBunread\fP messages. By default, Mutt will - ** mark new messages as old if you exit a mailbox without reading them. - ** The next time you start Mutt, the messages will show up with an "O" - ** next to them in the index menu, indicating that they are old. In - ** order to make Mutt treat all unread messages as new only, you can - ** unset this variable. + ** When set, Mutt will mark new messages as old if you exit a mailbox + ** without reading them. If not set messages will remain new until they + ** are read or the \fInew\fP flag is explicitly removed. Set this variable + ** to ask-yes or ask-no to decide when leaving a folder. Also see the + ** ``$$see_old'' variable. + ** .pp + ** \fBThis variable does not apply to IMAP folders, these always act as if + ** this variable is set to yes. */ { "markers", DT_BOOL, R_PAGER, OPTMARKERS, 1 }, /* @@ -2018,6 +2019,13 @@ struct option_t MuttVars[] = { ** ``$$record'' mailbox. ** .pp ** Also see the ``$$force_name'' variable. + */ + { "see_old", DT_BOOL, R_BOTH, OPTSEEOLD, 1 }, + /* + ** .pp + ** Controls whether or not Mutt makes the distinction between \fInew\fP + ** messages and \fIold\fP \fBunread\fP messages. In order to make Mutt + ** treat all unread messages as new only, you can unset this variable. */ { "score", DT_BOOL, R_NONE, OPTSCORE, 1 }, /* Index: mh.c =================================================================== RCS file: /home/roessler/cvs/mutt/mh.c,v retrieving revision 3.7 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.7 mh.c --- mh.c 2002/01/24 23:33:26 3.7 +++ mh.c 2002/01/26 04:13:23 @@ -689,7 +689,7 @@ static int maildir_parse_dir (CONTEXT * if (subdir) { snprintf (buf, sizeof (buf), "%s/%s", ctx->path, subdir); - is_old = (mutt_strcmp ("cur", subdir) == 0) && option (OPTMARKOLD); + is_old = (mutt_strcmp ("cur", subdir) == 0); } else strfcpy (buf, ctx->path, sizeof (buf)); Index: mutt.h =================================================================== RCS file: /home/roessler/cvs/mutt/mutt.h,v retrieving revision 3.1 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.1 mutt.h --- mutt.h 2002/01/24 21:53:19 3.1 +++ mutt.h 2002/01/26 04:13:23 @@ -267,6 +267,7 @@ enum OPT_PRINT, OPT_INCLUDE, OPT_DELETE, + OPT_MARKOLD, OPT_MFUPTO, OPT_MIMEFWD, OPT_MOVE, @@ -360,7 +361,6 @@ enum OPTMAILCAPSANITIZE, OPTMAILDIRTRASH, OPTMARKERS, - OPTMARKOLD, OPTMENUSCROLL, /* scroll menu instead of implicit next-page */ OPTMETAKEY, /* interpret ALT-x as ESC-x */ OPTMETOO, @@ -387,6 +387,7 @@ enum OPTSAVEEMPTY, OPTSAVENAME, OPTSCORE, + OPTSEEOLD, OPTSIGDASHES, OPTSIGONTOP, OPTSORTRE, Index: mx.c =================================================================== RCS file: /home/roessler/cvs/mutt/mx.c,v retrieving revision 3.3 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.3 mx.c --- mx.c 2002/01/24 23:18:52 3.3 +++ mx.c 2002/01/26 04:13:24 @@ -822,7 +822,7 @@ static int sync_mailbox (CONTEXT *ctx, i /* save changes and close mailbox */ int mx_close_mailbox (CONTEXT *ctx, int *index_hint) { - int i, move_messages = 0, purge = 1, read_msgs = 0; + int i, move_messages = 0, purge = 1, mark_old = 1, read_msgs = 0, new_msgs = 0; int check; int isSpool = 0; CONTEXT f; @@ -855,6 +855,8 @@ int mx_close_mailbox (CONTEXT *ctx, int if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED))) read_msgs++; + if (!ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read && !ctx->hdrs[i]->old) + new_msgs++; } if (read_msgs && quadoption (OPT_MOVE) != M_NO) @@ -884,6 +886,14 @@ int mx_close_mailbox (CONTEXT *ctx, int } } + if (new_msgs) + { + snprintf (buf, sizeof (buf), new_msgs == 1 + ? _("Mark new message as old?") : _("Mark new messages as old?")); + if ((mark_old = query_quadoption (OPT_MARKOLD, buf)) < 0) + return (-1); + } + /* * There is no point in asking whether or not to purge if we are * just marking messages as "trash". @@ -904,7 +914,7 @@ int mx_close_mailbox (CONTEXT *ctx, int /* IMAP servers manage the OLD flag themselves */ if (ctx->magic != M_IMAP) #endif - if (option (OPTMARKOLD)) + if (mark_old) { for (i = 0; i < ctx->msgcount; i++) { Index: pager.c =================================================================== RCS file: /home/roessler/cvs/mutt/pager.c,v retrieving revision 3.1 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.1 pager.c --- pager.c 2002/01/24 21:53:19 3.1 +++ pager.c 2002/01/26 04:13:25 @@ -2450,7 +2450,7 @@ mutt_pager (const char *banner, const ch case OP_TOGGLE_NEW: CHECK_MODE(IsHeader (extra)); CHECK_READONLY; - if (extra->hdr->read || extra->hdr->old) + if (extra->hdr->read || (option(OPTSEEOLD) && extra->hdr->old)) mutt_set_flag (Context, extra->hdr, M_NEW, 1); else if (!first) mutt_set_flag (Context, extra->hdr, M_READ, 1); Index: parse.c =================================================================== RCS file: /home/roessler/cvs/mutt/parse.c,v retrieving revision 3.1 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.1 parse.c --- parse.c 2002/01/24 21:53:19 3.1 +++ parse.c 2002/01/26 04:13:26 @@ -1151,8 +1151,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, hdr->replied = 1; break; case 'O': - if (option (OPTMARKOLD)) - hdr->old = 1; + hdr->old = 1; break; case 'R': hdr->read = 1; Index: pattern.c =================================================================== RCS file: /home/roessler/cvs/mutt/pattern.c,v retrieving revision 3.1 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.1 pattern.c --- pattern.c 2002/01/24 21:53:19 3.1 +++ pattern.c 2002/01/26 04:13:27 @@ -985,13 +985,14 @@ mutt_pattern_exec (struct pattern_t *pat case M_TAG: return (pat->not ^ h->tagged); case M_NEW: - return (pat->not ? h->old || h->read : !(h->old || h->read)); + return (pat->not ^ !((option(OPTSEEOLD) && h->old) || h->read)); case M_UNREAD: return (pat->not ? h->read : !h->read); case M_REPLIED: return (pat->not ^ h->replied); case M_OLD: - return (pat->not ? (!h->old || h->read) : (h->old && !h->read)); + return (pat->not ? (!(option(OPTSEEOLD) && h->old) || h->read) : + ((option(OPTSEEOLD) && h->old) && !h->read)); case M_READ: return (pat->not ^ h->read); case M_DELETED: Index: status.c =================================================================== RCS file: /home/roessler/cvs/mutt/status.c,v retrieving revision 3.0 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.0 status.c --- status.c 2002/01/24 12:10:52 3.0 +++ status.c 2002/01/26 04:13:27 @@ -159,9 +159,11 @@ status_format_str (char *buf, size_t buf if (!optional) { snprintf (fmt, sizeof (fmt), "%%%sd", prefix); - snprintf (buf, buflen, fmt, Context ? Context->new : 0); + snprintf (buf, buflen, fmt, Context ? + (option(OPTSEEOLD) ? Context->new : Context->unread) : 0); } - else if (!Context || !Context->new) + else if (!Context || + !(option(OPTSEEOLD) ? Context->new : Context->unread)) optional = 0; break; @@ -169,9 +171,11 @@ status_format_str (char *buf, size_t buf if (!optional) { snprintf (fmt, sizeof (fmt), "%%%sd", prefix); - snprintf (buf, buflen, fmt, Context ? Context->unread - Context->new : 0); + snprintf (buf, buflen, fmt, (Context && option(OPTSEEOLD)) ? + Context->unread - Context->new : 0); } - else if (!Context || !(Context->unread - Context->new)) + else if (!Context || !option(OPTSEEOLD) || + !(Context->unread - Context->new)) optional = 0; break; Index: thread.c =================================================================== RCS file: /home/roessler/cvs/mutt/thread.c,v retrieving revision 3.0 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.0 thread.c --- thread.c 2002/01/24 12:10:52 3.0 +++ thread.c 2002/01/26 04:13:28 @@ -1085,7 +1085,7 @@ int _mutt_traverse_thread (CONTEXT *ctx, if (!cur->read && CHECK_LIMIT) { - if (cur->old) + if (option(OPTSEEOLD) && cur->old) old = 2; else new = 1; @@ -1162,7 +1162,7 @@ int _mutt_traverse_thread (CONTEXT *ctx, if (!cur->read && CHECK_LIMIT) { - if (cur->old) + if (option(OPTSEEOLD) && cur->old) old = 2; else new = 1; Index: imap/message.c =================================================================== RCS file: /home/roessler/cvs/mutt/imap/message.c,v retrieving revision 3.1 diff -p -u -I$\(Author\|Date\|Header\|Id\|Locker\|Log\|Name\|RCSfile\|Revision\|Source\|State\)[:$] -r3.1 message.c --- imap/message.c 2002/01/24 21:53:32 3.1 +++ imap/message.c 2002/01/26 04:13:28 @@ -949,7 +949,7 @@ static char* msg_parse_flags (IMAP_HEADE if (*s == ')') { /* if a message is neither seen nor recent, it is OLD. */ - if (option (OPTMARKOLD) && !recent && !(h->read)) + if (!recent && !(h->read)) h->old = 1; s++; }