diff -ru mutt-1.2.5-basic/OPS mutt-1.2.5/OPS --- mutt-1.2.5-basic/OPS Tue Feb 15 10:28:45 2000 +++ mutt-1.2.5/OPS Sat Sep 9 18:15:13 2000 @@ -83,6 +83,7 @@ OP_HALF_UP "scroll up 1/2 page" OP_HELP "this screen" OP_JUMP "jump to an index number" +OP_LABEL "add or change a message's label" OP_LAST_ENTRY "move to the last entry" OP_LIST_REPLY "reply to specified mailing list" OP_MACRO "execute a macro" diff -ru mutt-1.2.5-basic/copy.c mutt-1.2.5/copy.c --- mutt-1.2.5-basic/copy.c Thu Jun 15 16:06:40 2000 +++ mutt-1.2.5/copy.c Sat Sep 9 18:15:13 2000 @@ -95,6 +95,10 @@ ignore = 0; } + if (flags & CH_UPDATE_LABEL && + mutt_strncasecmp ("X-Label:", buf, 8) == 0) + continue; + if (!ignore && fputs (buf, out) == EOF) return (-1); } @@ -347,6 +351,7 @@ if (fputc ('\n', out) == EOF) return (-1); } + } } @@ -358,6 +363,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) @@ -431,6 +444,9 @@ if (flags & M_CM_PREFIX) _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.2.5-basic/curs_main.c mutt-1.2.5/curs_main.c --- mutt-1.2.5-basic/curs_main.c Tue Jul 25 03:02:26 2000 +++ mutt-1.2.5/curs_main.c Sat Sep 9 18:15:13 2000 @@ -1638,6 +1638,21 @@ menu->redraw = REDRAW_FULL; break; + case OP_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; Only in mutt-1.2.5-basic/doc: manual.sgml.orig diff -ru mutt-1.2.5-basic/functions.h mutt-1.2.5/functions.h --- mutt-1.2.5-basic/functions.h Fri Mar 3 04:10:08 2000 +++ mutt-1.2.5/functions.h Sat Sep 9 18:15:13 2000 @@ -89,6 +89,7 @@ { "next-undeleted", OP_MAIN_NEXT_UNDELETED, "j" }, { "previous-undeleted", OP_MAIN_PREV_UNDELETED, "k" }, { "limit", OP_MAIN_LIMIT, "l" }, + { "label", OP_LABEL, "y" }, { "list-reply", OP_LIST_REPLY, "L" }, { "mail", OP_MAIL, "m" }, { "toggle-new", OP_TOGGLE_NEW, "N" }, @@ -165,6 +166,7 @@ { "next-entry", OP_NEXT_ENTRY, "J" }, { "previous-undeleted",OP_MAIN_PREV_UNDELETED, "k" }, { "previous-entry", OP_PREV_ENTRY, "K" }, + { "label", OP_LABEL, "y" }, { "list-reply", OP_LIST_REPLY, "L" }, { "redraw-screen", OP_REDRAW, "\014" }, { "mail", OP_MAIL, "m" }, diff -ru mutt-1.2.5-basic/headers.c mutt-1.2.5/headers.c --- mutt-1.2.5-basic/headers.c Wed Apr 12 11:31:37 2000 +++ mutt-1.2.5/headers.c Sat Sep 9 18:19:46 2000 @@ -206,3 +206,59 @@ if (!in_reply_to) mutt_free_list (&msg->env->references); } + +/* + * dgc: Add an X-Label: field to a header. + */ +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.2.5-basic/mutt.h mutt-1.2.5/mutt.h --- mutt-1.2.5-basic/mutt.h Sat Sep 9 18:10:59 2000 +++ mutt-1.2.5/mutt.h Sat Sep 9 18:15:13 2000 @@ -67,6 +67,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 */ @@ -566,6 +567,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; Only in mutt-1.2.5-basic: mutt.h.orig diff -ru mutt-1.2.5-basic/protos.h mutt-1.2.5/protos.h --- mutt-1.2.5-basic/protos.h Tue May 16 10:23:12 2000 +++ mutt-1.2.5/protos.h Sat Sep 9 18:15:14 2000 @@ -143,6 +143,7 @@ void mutt_edit_content_type (HEADER *, BODY *); 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_enter_command (void); void mutt_expand_aliases_env (ENVELOPE *);