--- mutt-1.5.6/PATCHES~ never +++ mutt-1.5.6/PATCHES Mon Feb 9 22:50:21 CST 2004 @@ -1,0 +1 @@ +patch-1.5.6.dgc.xlabel_ext.6 diff -Pur mutt-1.5.6-base/OPS mutt-1.5.6-dgc.xlabel_ext.6/OPS --- mutt-1.5.6-base/OPS Wed Nov 5 03:41:31 2003 +++ mutt-1.5.6-dgc.xlabel_ext.6/OPS Mon Feb 9 22:50:21 2004 @@ -56,6 +56,7 @@ OP_DISPLAY_ADDRESS "display full address of sender" OP_DISPLAY_HEADERS "display message and toggle header weeding" OP_DISPLAY_MESSAGE "display a message" +OP_EDIT_LABEL "add, change, or delete a message's label" OP_EDIT_MESSAGE "edit the raw message" OP_EDITOR_BACKSPACE "delete the char in front of the cursor" OP_EDITOR_BACKWARD_CHAR "move the cursor one character to the left" diff -Pur mutt-1.5.6-base/copy.c mutt-1.5.6-dgc.xlabel_ext.6/copy.c --- mutt-1.5.6-base/copy.c Wed Nov 5 03:41:31 2003 +++ mutt-1.5.6-dgc.xlabel_ext.6/copy.c Mon Feb 9 22:50:21 2004 @@ -98,6 +98,10 @@ ignore = 0; } + if (flags & CH_UPDATE_LABEL && + mutt_strncasecmp ("X-Label:", buf, 8) == 0) + continue; + if (!ignore && fputs (buf, out) == EOF) return (-1); } @@ -399,6 +403,7 @@ if (fputc ('\n', out) == EOF) return (-1); } + } } @@ -410,6 +415,14 @@ fprintf (out, "Lines: %d\n", h->lines); } + if (flags & CH_UPDATE_LABEL && h->xlabel_changed) + { + if (h->env->x_label != NULL) + if (fprintf(out, "X-Label: %s\n", h->env->x_label) != + 10 + strlen(h->env->x_label)) + return -1; + } + if ((flags & CH_NONEWLINE) == 0) { if (flags & CH_PREFIX) @@ -489,6 +502,9 @@ else _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), Context, hdr, 0); } + + if (hdr->xlabel_changed) + chflags |= CH_UPDATE_LABEL; if ((flags & M_CM_NOHEADER) == 0) { diff -Pur mutt-1.5.6-base/curs_main.c mutt-1.5.6-dgc.xlabel_ext.6/curs_main.c --- mutt-1.5.6-base/curs_main.c Wed Nov 5 03:41:31 2003 +++ mutt-1.5.6-dgc.xlabel_ext.6/curs_main.c Mon Feb 9 22:50:21 2004 @@ -1836,6 +1836,21 @@ menu->redraw = REDRAW_FULL; break; + case OP_EDIT_LABEL: + + CHECK_MSGCOUNT; + CHECK_READONLY; + rc = mutt_label_message(tag ? NULL : CURHDR); + if (rc > 0) { + Context->changed = 1; + menu->redraw = REDRAW_FULL; + mutt_message ("%d label%s changed.", rc, rc == 1 ? "" : "s"); + } + else { + mutt_message _("No labels changed."); + } + break; + case OP_LIST_REPLY: CHECK_ATTACH; diff -Pur mutt-1.5.6-base/doc/manual.sgml.head mutt-1.5.6-dgc.xlabel_ext.6/doc/manual.sgml.head --- mutt-1.5.6-base/doc/manual.sgml.head Sun Feb 1 11:49:53 2004 +++ mutt-1.5.6-dgc.xlabel_ext.6/doc/manual.sgml.head Mon Feb 9 22:50:21 2004 @@ -2185,9 +2185,12 @@ name="$index_format"> variable's ``%y'' and ``%Y'' escapes can be used to expand ``X-Label:'' fields in the index, and Mutt's pattern-matcher can match regular expressions to -``X-Label:'' fields with the ``~y'' selector. ``X-Label:'' is not a +``X-Label:'' fields with the ``˜y'' selector. ``X-Label:'' is not a standard message header field, but it can easily be inserted by procmail and other mail filtering agents. +You can change or delete the ``X-Label:'' field within Mutt using the +``edit-label'' command, bound to the ``y'' key by default. This works +for tagged messages, too. Lastly, Mutt has the ability to the mailbox into . A thread is a group of messages which all relate to the same diff -Pur mutt-1.5.6-base/doc/manual.txt mutt-1.5.6-dgc.xlabel_ext.6/doc/manual.txt --- mutt-1.5.6-base/doc/manual.txt Sun Feb 1 12:22:23 2004 +++ mutt-1.5.6-dgc.xlabel_ext.6/doc/manual.txt Mon Feb 9 22:50:21 2004 @@ -2481,9 +2481,12 @@ individually). The ``$index_format'' variable's ``%y'' and ``%Y'' escapes can be used to expand ``X-Label:'' fields in the index, and Mutt's pattern-matcher can match regular expressions to ``X-Label:'' - fields with the `` y'' selector. ``X-Label:'' is not a standard + fields with the ``~y'' selector. ``X-Label:'' is not a standard message header field, but it can easily be inserted by procmail and - other mail filtering agents. + other mail filtering agents. You can change or delete the + ``X-Label:'' field within Mutt using the ``edit-label'' command, + bound to the ``y'' key by default. This works for tagged messages, + too. Lastly, Mutt has the ability to ``sort'' the mailbox into ``threads''. A thread is a group of messages which all relate to the same subject. diff -Pur mutt-1.5.6-base/doc/muttrc.man mutt-1.5.6-dgc.xlabel_ext.6/doc/muttrc.man --- mutt-1.5.6-base/doc/muttrc.man Sun Feb 1 12:22:19 2004 +++ mutt-1.5.6-dgc.xlabel_ext.6/doc/muttrc.man Mon Feb 9 22:50:21 2004 @@ -1053,17 +1053,6 @@ .TP -.B dotlock_program -.nf -Type: path -Default: \(lq/usr/local/bin/mutt_dotlock\(rq -.fi -.IP -Contains the path of the mutt_dotlock (8) binary to be used by -mutt. - - -.TP .B dsn_notify .nf Type: string @@ -1887,7 +1876,7 @@ .B ispell .nf Type: path -Default: \(lq/usr/bin/ispell\(rq +Default: \(lq/opt/bin/ispell\(rq .fi .IP How to invoke ispell (GNU's spell-checking software). @@ -3885,7 +3874,7 @@ .B sendmail .nf Type: path -Default: \(lq/usr/sbin/sendmail -oem -oi\(rq +Default: \(lq/usr/lib/sendmail -oem -oi\(rq .fi .IP Specifies the program and arguments used to deliver mail sent by Mutt. @@ -4499,18 +4488,6 @@ sending messages. If \fIunset\fP, no `From:' header field will be generated unless the user explicitly sets one using the \(lqmy_hdr\(rq command. - - -.TP -.B use_ipv6 -.nf -Type: boolean -Default: yes -.fi -.IP -When \fIset\fP, Mutt will look for IPv6 addresses of hosts it tries to -contact. If this option is unset, Mutt will restrict itself to IPv4 addresses. -Normally, the default should work. .TP diff -Pur mutt-1.5.6-base/functions.h mutt-1.5.6-dgc.xlabel_ext.6/functions.h --- mutt-1.5.6-base/functions.h Wed Nov 5 03:41:31 2003 +++ mutt-1.5.6-dgc.xlabel_ext.6/functions.h Mon Feb 9 22:50:21 2004 @@ -81,6 +81,7 @@ { "delete-thread", OP_DELETE_THREAD, "\004" }, { "delete-subthread", OP_DELETE_SUBTHREAD, "\033d" }, { "edit", OP_EDIT_MESSAGE, "e" }, + { "edit-label", OP_EDIT_LABEL, "y" }, { "edit-type", OP_EDIT_TYPE, "\005" }, { "forward-message", OP_FORWARD_MESSAGE, "f" }, { "flag-message", OP_FLAG_MESSAGE, "F" }, @@ -163,6 +164,7 @@ { "delete-thread", OP_DELETE_THREAD, "\004" }, { "delete-subthread", OP_DELETE_SUBTHREAD, "\033d" }, { "edit", OP_EDIT_MESSAGE, "e" }, + { "edit-label", OP_EDIT_LABEL, "y" }, { "edit-type", OP_EDIT_TYPE, "\005" }, { "forward-message", OP_FORWARD_MESSAGE, "f" }, { "flag-message", OP_FLAG_MESSAGE, "F" }, diff -Pur mutt-1.5.6-base/headers.c mutt-1.5.6-dgc.xlabel_ext.6/headers.c --- mutt-1.5.6-base/headers.c Tue Mar 4 01:49:45 2003 +++ mutt-1.5.6-dgc.xlabel_ext.6/headers.c Mon Feb 9 22:50:21 2004 @@ -199,3 +199,59 @@ } } } + +/* + * dgc: Add an X-Label: field. + */ +static int label_message(HEADER *hdr, char *new) +{ + if (hdr == NULL) + return 0; + if (hdr->env->x_label == NULL && new == NULL) + return 0; + if (hdr->env->x_label != NULL && new != NULL && + strcmp(hdr->env->x_label, new) == 0) + return 0; + if (hdr->env->x_label != NULL) + FREE(&hdr->env->x_label); + if (new == NULL) + hdr->env->x_label = NULL; + else + hdr->env->x_label = safe_strdup(new); + return hdr->changed = hdr->xlabel_changed = 1; +} + +int mutt_label_message(HEADER *hdr) +{ + char buf[LONG_STRING], *new; + int i; + int changed; + + *buf = '\0'; + if (hdr != NULL && hdr->env->x_label != NULL) { + strncpy(buf, hdr->env->x_label, LONG_STRING); + } + + mutt_get_field("Label: ", buf, sizeof(buf), M_CLEAR); + new = buf; + SKIPWS(new); + if (*new == '\0') + new = NULL; + + changed = 0; + if (hdr != NULL) { + changed += label_message(hdr, new); + } else { +#define HDR_OF(index) Context->hdrs[Context->v2r[(index)]] + for (i = 0; i < Context->vcount; ++i) { + if (HDR_OF(i)->tagged) + if (label_message(HDR_OF(i), new)) { + ++changed; + mutt_set_flag(Context, HDR_OF(i), + M_TAG, 0); + } + } + } + + return changed; +} diff -Pur mutt-1.5.6-base/mh.c mutt-1.5.6-dgc.xlabel_ext.6/mh.c --- mutt-1.5.6-base/mh.c Sun Feb 1 11:10:57 2004 +++ mutt-1.5.6-dgc.xlabel_ext.6/mh.c Mon Feb 9 22:50:21 2004 @@ -1220,7 +1220,7 @@ { HEADER *h = ctx->hdrs[msgno]; - if (h->attach_del) + if (h->attach_del || h->xlabel_changed) if (mh_rewrite_message (ctx, msgno) != 0) return -1; @@ -1231,7 +1231,7 @@ { HEADER *h = ctx->hdrs[msgno]; - if (h->attach_del) + if (h->attach_del || h->xlabel_changed) { /* when doing attachment deletion, fall back to the MH case. */ if (mh_rewrite_message (ctx, msgno) != 0) @@ -1325,6 +1325,7 @@ } } else if (ctx->hdrs[i]->changed || ctx->hdrs[i]->attach_del || + ctx->hdrs[i]->xlabel_changed || (ctx->magic == M_MAILDIR && (option (OPTMAILDIRTRASH) || ctx->hdrs[i]->trash) && (ctx->hdrs[i]->deleted != ctx->hdrs[i]->trash))) diff -Pur mutt-1.5.6-base/mutt.h mutt-1.5.6-dgc.xlabel_ext.6/mutt.h --- mutt-1.5.6-base/mutt.h Sun Feb 1 11:15:17 2004 +++ mutt-1.5.6-dgc.xlabel_ext.6/mutt.h Mon Feb 9 22:50:21 2004 @@ -85,6 +85,8 @@ #define CH_FROM (1<<4) /* retain the "From " message separator? */ #define CH_PREFIX (1<<5) /* use Prefix string? */ #define CH_NOSTATUS (1<<6) /* supress the status and x-status fields */ +/* this absurd location to avoid conflict with cd.edit_threads -- *sigh* */ +#define CH_UPDATE_LABEL (1<<20) /* update X-Label: from hdr->env->x_label? */ #define CH_REORDER (1<<7) /* Re-order output of headers */ #define CH_NONEWLINE (1<<8) /* don't output terminating newline */ #define CH_MIME (1<<9) /* ignore MIME fields */ @@ -663,6 +665,7 @@ * This flag is used by the maildir_trash * option. */ + unsigned int xlabel_changed : 1; /* editable - used for syncing */ /* timezone of the sender of this message */ unsigned int zhours : 5; diff -Pur mutt-1.5.6-base/protos.h mutt-1.5.6-dgc.xlabel_ext.6/protos.h --- mutt-1.5.6-base/protos.h Sun Feb 1 11:15:17 2004 +++ mutt-1.5.6-dgc.xlabel_ext.6/protos.h Mon Feb 9 22:50:21 2004 @@ -162,6 +162,7 @@ void mutt_edit_content_type (HEADER *, BODY *, FILE *); void mutt_edit_file (const char *, const char *); void mutt_edit_headers (const char *, const char *, HEADER *, char *, size_t); +int mutt_label_message (HEADER *); void mutt_curses_error (const char *, ...); void mutt_curses_message (const char *, ...); void mutt_enter_command (void);