diff -ru mutt-1.3.19-dist/OPS mutt-1.3.19/OPS --- mutt-1.3.19-dist/OPS Sat Jan 27 07:07:59 2001 +++ mutt-1.3.19/OPS Fri Jun 8 19:19:15 2001 @@ -54,6 +54,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 -ru mutt-1.3.19-dist/copy.c mutt-1.3.19/copy.c --- mutt-1.3.19-dist/copy.c Fri May 11 09:04:24 2001 +++ mutt-1.3.19/copy.c Fri Jun 8 19:20:37 2001 @@ -94,6 +94,10 @@ ignore = 0; } + if (flags & CH_UPDATE_LABEL && + mutt_strncasecmp ("X-Label:", buf, 8) == 0) + continue; + if (!ignore && fputs (buf, out) == EOF) return (-1); } @@ -349,6 +353,7 @@ if (fputc ('\n', out) == EOF) return (-1); } + } } @@ -360,6 +365,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) @@ -438,6 +451,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 -ru mutt-1.3.19-dist/curs_main.c mutt-1.3.19/curs_main.c --- mutt-1.3.19-dist/curs_main.c Fri Jun 1 03:52:58 2001 +++ mutt-1.3.19/curs_main.c Fri Jun 8 19:19:15 2001 @@ -1703,6 +1703,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 -ru mutt-1.3.19-dist/doc/manual.sgml.head mutt-1.3.19/doc/manual.sgml.head --- mutt-1.3.19-dist/doc/manual.sgml.head Mon Jun 4 13:29:04 2001 +++ mutt-1.3.19/doc/manual.sgml.head Fri Jun 8 19:19:16 2001 @@ -2065,9 +2065,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 Only in mutt-1.3.19/doc: manual.sgml.head.orig diff -ru mutt-1.3.19-dist/doc/manual.txt mutt-1.3.19/doc/manual.txt --- mutt-1.3.19-dist/doc/manual.txt Thu Jun 7 15:10:44 2001 +++ mutt-1.3.19/doc/manual.txt Fri Jun 8 19:19:16 2001 @@ -2314,9 +2314,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. Only in mutt-1.3.19/doc: manual.txt.orig diff -ru mutt-1.3.19-dist/functions.h mutt-1.3.19/functions.h --- mutt-1.3.19-dist/functions.h Tue Feb 13 09:00:26 2001 +++ mutt-1.3.19/functions.h Fri Jun 8 19:19:16 2001 @@ -78,6 +78,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" }, @@ -160,6 +161,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 -ru mutt-1.3.19-dist/headers.c mutt-1.3.19/headers.c --- mutt-1.3.19-dist/headers.c Fri May 11 06:09:00 2001 +++ mutt-1.3.19/headers.c Fri Jun 8 19:19:16 2001 @@ -202,3 +202,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 -ru mutt-1.3.19-dist/mutt.h mutt-1.3.19/mutt.h --- mutt-1.3.19-dist/mutt.h Fri May 11 09:07:16 2001 +++ mutt-1.3.19/mutt.h Fri Jun 8 19:19:16 2001 @@ -81,6 +81,7 @@ #define CH_NOLEN (1<<12) /* don't write Content-Length: and Lines: */ #define CH_WEED_DELIVERED (1<<13) /* weed eventual Delivered-To headers */ #define CH_FORCE_FROM (1<<14) /* give CH_FROM precedence over CH_WEED? */ +#define CH_UPDATE_LABEL (1<<15) /* update X-Label: from hdr->env->x_label? */ /* flags for mutt_enter_string() */ #define M_ALIAS 1 /* do alias "completion" by calling up the alias-menu */ @@ -611,6 +612,7 @@ unsigned int threaded : 1; /* message has been threaded */ unsigned int recip_valid : 1; /* is_recipient is valid */ unsigned int active : 1; /* message is not to be removed */ + unsigned int xlabel_changed : 1; /* editable - used for syncing */ /* timezone of the sender of this message */ unsigned int zhours : 5; diff -ru mutt-1.3.19-dist/protos.h mutt-1.3.19/protos.h --- mutt-1.3.19-dist/protos.h Mon May 21 03:41:21 2001 +++ mutt-1.3.19/protos.h Fri Jun 8 19:19:16 2001 @@ -158,6 +158,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);