Hi,

On Wed, Mar 08 2000 06:18:58 -0500 wrote David T-G
with subject "Re: Reply to full name from alias list":

> % I was close to ask the same question. Mutt doesn't have this feature
> 
> I asked exactly this question, in fact, on 2000Feb08 but got absolutely
> no response.  You guys must have been on vacation or something ;-)

I joined the list a little bit later but searched the archive for
similar questions (maybe not good enough) and found nothing.

> % so far. My solution was to modify `send.c' in that way that it takes
> % the alias address and real name rather than the presented `from' line
> % when I reply to someone. This is just a quick solution and there is no
> 
> That's *exactly* what I'd like ...

Here comes my patch which should now work also for list replies and
group replies, but is not perfect when a `to' or `cc' line with more
than one recipient is presented (i.e works only on the first address).
I leave it to the developers to do something more with it :-).  I also
did this reverse of aliases on the `Mail-Followup-To' header, not sure
if it works or if I break some rfc's with that.
Use at your own risk! (Do I have to say that? :)

> % way to turn it off (yet). And I'm not sure if it works in list-replys,
> 
> ... and I can't see any reason to turn it off (for me, anyway).

just in case...

Enjoy, Stefan.

-- 
One Page Principle:
        A specification that will not fit on one page of 8.5x11 inch
paper cannot be understood.
                -- Mark Ardis
--- send.c.orig Wed Mar  8 16:14:17 2000
+++ send.c      Wed Mar  8 18:04:52 2000
@@ -422,16 +422,22 @@ static int default_to (ADDRESS **to, ENV
 {
   char prompt[STRING];
   int i = 0;
+  ADDRESS *adr_from, *adr_reply_to, *adr_to, *adr_cc, *adr_fup;
 
+  if(!(adr_from=alias_reverse_lookup(env->from))) adr_from = env->from;
+  if(!(adr_reply_to=alias_reverse_lookup(env->reply_to))) adr_reply_to = 
+env->reply_to;
+  if(!(adr_to=alias_reverse_lookup(env->to))) adr_to = env->to;
+  if(!(adr_cc=alias_reverse_lookup(env->cc))) adr_cc = env->cc;
+  if(!(adr_fup=alias_reverse_lookup(env->mail_followup_to))) adr_fup = 
+env->mail_followup_to;
+  
   if (flags && env->mail_followup_to)
   {
     snprintf (prompt, sizeof (prompt), _("Follow-up to %s%s?"),
-             env->mail_followup_to->mailbox,
-             env->mail_followup_to->next ? "..." : "");
+             adr_fup->mailbox, adr_fup->next ? "..." : "");
 
     if (query_quadoption (OPT_MFUPTO, prompt) == M_YES)
     {
-      rfc822_append (to, env->mail_followup_to);
+      rfc822_append (to, adr_fup);
       return 0;
     }
   }
@@ -445,7 +451,7 @@ static int default_to (ADDRESS **to, ENV
   if (!option(OPTREPLYSELF) && mutt_addr_is_user (env->from))
   {
     /* mail is from the user, assume replying to recipients */
-    rfc822_append (to, env->to);
+    rfc822_append (to, adr_to);
   }
   else if (env->reply_to)
   {
@@ -463,7 +469,7 @@ static int default_to (ADDRESS **to, ENV
        * in his From header.
        * 
        */
-      rfc822_append (to, env->from);
+       rfc822_append (to, adr_from);
     }
     else if (!(mutt_addrcmp (env->from, env->reply_to) && 
               !env->reply_to->next) &&
@@ -475,20 +481,19 @@ static int default_to (ADDRESS **to, ENV
        * provides a way to do that.
        */
       snprintf (prompt, sizeof (prompt), _("Reply to %s%s?"),
-               env->reply_to->mailbox, 
-               env->reply_to->next?",...":"");
+                adr_reply_to->mailbox, adr_reply_to->next?",...":"");
       if ((i = query_quadoption (OPT_REPLYTO, prompt)) == M_YES)
-       rfc822_append (to, env->reply_to);
+           rfc822_append (to, adr_reply_to);
       else if (i == M_NO)
-       rfc822_append (to, env->from);
+           rfc822_append (to, adr_from);
       else
        return (-1); /* abort */
     }
     else
-      rfc822_append (to, env->reply_to);
+       rfc822_append (to, adr_reply_to);
   }
   else
-    rfc822_append (to, env->from);
+       rfc822_append (to, adr_from);
 
   return (0);
 }
@@ -496,9 +501,13 @@ static int default_to (ADDRESS **to, ENV
 int mutt_fetch_recips (ENVELOPE *out, ENVELOPE *in, int flags)
 {
   ADDRESS *tmp;
+  ADDRESS *adr_to, *adr_cc;
+  if(!(adr_to=alias_reverse_lookup(in->to))) adr_to = in->to;
+  if(!(adr_cc=alias_reverse_lookup(in->cc))) adr_cc = in->cc;
+ 
   if (flags & SENDLISTREPLY)
   {
-    tmp = find_mailing_lists (in->to, in->cc);
+    tmp = find_mailing_lists (adr_to, adr_cc);
     rfc822_append (&out->to, tmp);
     rfc822_free_address (&tmp);
 
@@ -514,8 +523,8 @@ int mutt_fetch_recips (ENVELOPE *out, EN
     if ((flags & SENDGROUPREPLY) && !in->mail_followup_to)
     {
       /* if(!mutt_addr_is_user(in->to)) */
-      rfc822_append (&out->cc, in->to);
-      rfc822_append (&out->cc, in->cc);
+      rfc822_append (&out->cc, adr_to);
+      rfc822_append (&out->cc, adr_cc);
     }
   }
   return 0;

Reply via email to