The $alternates variable triggered some special handling which was lost when it was replaced by an alternates command. The attached patch is intended to restore this behavior. Comments welcome. -- Thomas Roessler · Personal soap box at <http://log.does-not-exist.org/>.
diff -ur /tmp/mutt-dev/init.c mutt-dev/init.c --- /tmp/mutt-dev/init.c 2004-08-30 16:07:08.000000000 -0400 +++ mutt-dev/init.c 2004-11-29 09:33:54.852821143 -0500 @@ -611,6 +611,28 @@ return 0; } +static void _alternates_clean (void) +{ + int i; + if (Context && Context->msgcount) + { + for (i = 0; i < Context->msgcount; i++) + Context->hdrs[i]->recip_valid = 0; + } +} + +static int parse_alternates (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) +{ + _alternates_clean(); + return parse_rx_list (buf, s, data, err); +} + +static int parse_unalternates (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) +{ + _alternates_clean(); + return parse_rx_unlist (buf, s, data, err); +} + static int parse_spam_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) { BUFFER templ; @@ -1066,9 +1088,7 @@ pp->rx = safe_calloc (1, sizeof (regex_t)); pp->pattern = safe_strdup ((char *) p->init); - if (mutt_strcmp (p->option, "alternates") == 0) - flags |= REG_ICASE; - else if (mutt_strcmp (p->option, "mask") != 0) + if (mutt_strcmp (p->option, "mask") != 0) flags |= mutt_which_case ((const char *) p->init); if (mutt_strcmp (p->option, "mask") == 0 && *s == '!') { @@ -1280,8 +1300,7 @@ break; } - if (option(OPTATTACHMSG) && (!mutt_strcmp(MuttVars[idx].option, "alternates") - || !mutt_strcmp(MuttVars[idx].option, "reply_regexp"))) + if (option(OPTATTACHMSG) && !mutt_strcmp(MuttVars[idx].option, "reply_regexp")) { snprintf (err->data, err->dsize, "Operation not permitted when in attach-message mode."); r = -1; @@ -1297,11 +1316,8 @@ { int not = 0; - /* $alternates is case-insensitive, - $mask is case-sensitive */ - if (mutt_strcmp (MuttVars[idx].option, "alternates") == 0) - flags |= REG_ICASE; - else if (mutt_strcmp (MuttVars[idx].option, "mask") != 0) + /* $mask is case-sensitive */ + if (mutt_strcmp (MuttVars[idx].option, "mask") != 0) flags |= mutt_which_case (tmp->data); p = tmp->data; @@ -1356,15 +1372,6 @@ } #undef CUR_ENV } - - if(Context && Context->msgcount && - mutt_strcmp(MuttVars[idx].option, "alternates") == 0) - { - int i; - - for(i = 0; i < Context->msgcount; i++) - Context->hdrs[i]->recip_valid = 0; - } } } else if (DTYPE(MuttVars[idx].type) == DT_MAGIC) diff -ur /tmp/mutt-dev/init.h mutt-dev/init.h --- /tmp/mutt-dev/init.h 2004-08-30 16:09:06.000000000 -0400 +++ mutt-dev/init.h 2004-11-29 09:28:13.373136144 -0500 @@ -2824,6 +2824,9 @@ static int parse_unmy_hdr (BUFFER *, BUFFER *, unsigned long, BUFFER *); static int parse_subscribe (BUFFER *, BUFFER *, unsigned long, BUFFER *); +static int parse_alternates (BUFFER *, BUFFER *, unsigned long, BUFFER *); +static int parse_unalternates (BUFFER *, BUFFER *, unsigned long, BUFFER *); + struct command_t { char *name; @@ -2832,8 +2835,8 @@ }; struct command_t Commands[] = { - { "alternates", parse_rx_list, UL &Alternates }, - { "unalternates", parse_rx_unlist, UL &Alternates }, + { "alternates", parse_alternates, UL &Alternates }, + { "unalternates", parse_unalternates, UL &Alternates }, #ifdef USE_SOCKET { "account-hook", mutt_parse_hook, M_ACCOUNTHOOK }, #endif Binary files /tmp/mutt-dev/init.o and mutt-dev/init.o differ Binary files /tmp/mutt-dev/mutt and mutt-dev/mutt differ Binary files /tmp/mutt-dev/patchlist.o and mutt-dev/patchlist.o differ
Attachment:
pgpFf3UL8aKrR.pgp
Description: PGP signature