<<< Date Index >>>     <<< Thread Index >>>

For 1.5.8: notalternates functionality



The attached patch allows users to exclude portions of the namespace matched
by alternates.

I've been using it for a year or so.

Charles

-- 
-----------------------------------------------------------------------
Charles Cazabon                          <muttdev@xxxxxxxxxxxxxxxxxxxx>
-----------------------------------------------------------------------
diff -urN mutt.20050126.orig/alias.c mutt-notalternates/alias.c
--- mutt.20050126.orig/alias.c  Sun Feb  1 11:10:43 2004
+++ mutt-notalternates/alias.c  Wed Jan 26 08:46:37 2005
@@ -568,8 +568,12 @@
 
   if (mutt_match_rx_list (addr->mailbox, Alternates))
   {
-    dprint (5, (debugfile, "mail_addr_is_user: yes, %s matched by 
alternates.\n", addr->mailbox));
-    return 1;
+    if (!mutt_match_rx_list (addr->mailbox, Notalternates))
+    {
+      dprint (5, (debugfile, "mail_addr_is_user: yes, %s matched by alternates 
and not by notalternates.\n", addr->mailbox));
+      return 1;
+    }
+    dprint (5, (debugfile, "mail_addr_is_user: not yet, %s matched by both 
alternates and notalternates.\n", addr->mailbox));
   }
   
   dprint (5, (debugfile, "mail_addr_is_user: no, all failed.\n"));
diff -urN mutt.20050126.orig/doc/manual.sgml.head 
mutt-notalternates/doc/manual.sgml.head
--- mutt.20050126.orig/doc/manual.sgml.head     Sat Jan 15 01:36:37 2005
+++ mutt-notalternates/doc/manual.sgml.head     Wed Jan 26 08:46:47 2005
@@ -1192,7 +1192,23 @@
 receive e-mail.
 
 To remove a regular expression from this list, use the
-<tt/unalternates/ command.
+<tt/unalternates/ command.  To exclude otherwise matching addresses,
+see the <tt/notalternates/ command.
+
+<sect1>Excluding alternative addresses<label id="notalternates">
+<p>
+Usage: <tt/&lsqb;un&rsqb;notalternates/ <em/regexp/ &lsqb; <em/regexp/ ... 
&rsqb;<newline>
+
+Many users receive e-mail under a number of different addresses. To
+fully use mutt's features here, the program must be able to
+recognize what e-mail addresses you receive mail under. That's the
+purpose of the <tt/notalternates/ command: It takes a list of regular
+expressions, each of which can identify an address under which you do not
+receive e-mail.  Use this to exclude an address which mutt would otherwise
+consider an alternate address because of the <tt/alternates/ command.
+
+To remove a regular expression from this list, use the
+<tt/unnotalternates/ command.
 
 <sect1>Mailing lists<label id="lists">
 <p>
@@ -1884,8 +1900,8 @@
 ~n [MIN]-[MAX]  messages with a score in the range MIN to MAX *)
 ~N              new messages
 ~O              old messages
-~p              message is addressed to you (consults alternates)
-~P              message is from you (consults alternates)
+~p              message is addressed to you (consults alternates and 
notalternates)
+~P              message is from you (consults alternates and notalternates)
 ~Q              messages which have been replied to
 ~R              read messages
 ~r [MIN]-[MAX]  messages with ``date-received'' in a Date range
@@ -3100,6 +3116,10 @@
 <tt><ref id="alternates" name="alternates"></tt> <em/regexp/ &lsqb; 
<em/regexp/ ... &rsqb;
 <item>
 <tt><ref id="alternates" name="unalternates"></tt> &lsqb; * | <em/regexp/ ... 
&rsqb;
+<item>
+<tt><ref id="notalternates" name="notalternates"></tt> <em/regexp/ &lsqb; 
<em/regexp/ ... &rsqb;
+<item>
+<tt><ref id="notalternates" name="unnotalternates"></tt> &lsqb; * | 
<em/regexp/ ... &rsqb;
 <item>
 <tt><ref id="alternative_order" name="alternative&lowbar;order"></tt> 
<em/mimetype/ &lsqb; <em/mimetype/ ... &rsqb;
 <item>
diff -urN mutt.20050126.orig/doc/muttrc.man.head 
mutt-notalternates/doc/muttrc.man.head
--- mutt.20050126.orig/doc/muttrc.man.head      Sat Jan 15 01:36:37 2005
+++ mutt-notalternates/doc/muttrc.man.head      Wed Jan 26 08:46:48 2005
@@ -87,6 +87,18 @@
 a regular expression from the list of known alternates.
 .PP
 .nf
+\fBnotalternates\fP \fIregexp\fP [ \fB,\fP \fIregexp\fP [ ... ]]
+\fBunnotalternates\fP [\fB * \fP | \fIregexp\fP [ \fB,\fP \fIregexp\fP [ ... 
]] ]
+.fi
+.IP
+\fBnotalternates\fP is used to inform mutt about addresses
+where you do not receive mail; you can use regular expressions to specify
+non-alternate addresses.  This affects mutt's idea about messages
+from you, and messages addressed to you.  \fBunnotalternates\fP removes
+a regular expression from the list of known non-alternates.  The purpose
+of this is to exclude addresses otherwise matched by \fBalternates\fP.
+.PP
+.nf
 \fBalternative_order\fP \fItype\fP[\fB/\fP\fIsubtype\fP] [ ... ]
 \fBunalternative_order\fP [\fB * \fP | \fItype\fP/\fIsubtype\fP] [...]
 .fi
@@ -423,8 +435,8 @@
 ~n \fIMIN\fP-\fIMAX\fP messages with a score in the range \fIMIN\fP to 
\fIMAX\fP
 ~N     new messages
 ~O     old messages
-~p     message is addressed to you (consults $alternates)
-~P     message is from you (consults $alternates)
+~p     message is addressed to you (consults $alternates and $notalternates)
+~P     message is from you (consults $alternates and $notalternates)
 ~Q     messages which have been replied to
 ~R     read messages
 ~r \fIMIN\fP-\fIMAX\fP messages with \(lqdate-received\(rq in a Date range
diff -urN mutt.20050126.orig/globals.h mutt-notalternates/globals.h
--- mutt.20050126.orig/globals.h        Wed Jan 26 07:36:44 2005
+++ mutt-notalternates/globals.h        Wed Jan 26 08:46:38 2005
@@ -131,6 +131,7 @@
 WHERE LIST *UnIgnore INITVAL(0);
 
 WHERE RX_LIST *Alternates INITVAL(0);
+WHERE RX_LIST *Notalternates INITVAL(0);
 WHERE RX_LIST *MailLists INITVAL(0);
 WHERE RX_LIST *SubscribedLists INITVAL(0);
 WHERE SPAM_LIST *SpamList INITVAL(0);
diff -urN mutt.20050126.orig/init.h mutt-notalternates/init.h
--- mutt.20050126.orig/init.h   Wed Jan 26 07:36:44 2005
+++ mutt-notalternates/init.h   Wed Jan 26 08:46:44 2005
@@ -2858,6 +2858,8 @@
 struct command_t Commands[] = {
   { "alternates",      parse_alternates,       UL &Alternates },
   { "unalternates",    parse_unalternates,     UL &Alternates },
+  { "notalternates",   parse_alternates,       UL &Notalternates },
+  { "unnotalternates", parse_unalternates,     UL &Notalternates },
 #ifdef USE_SOCKET
   { "account-hook",     mutt_parse_hook,        M_ACCOUNTHOOK },
 #endif