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

[PATCH] v2: Allow send-hooks to effectively change $from and $use_from



This ended up being quite a bit simpler...

# HG changeset patch
# User Aron Griffis <agriffis@xxxxxxxxx>
# Date 1183995154 14400
# Branch HEAD
# Node ID 5eddae9ff4a77ec87292f093a428efcc7f8a7355
# Parent  5d74a79deeb392001d49a57cc2fa1e2648388204
Allow send-hooks to effectively change $from and $use_from

Signed-off-by: Aron Griffis <agriffis@xxxxxxxxx>

diff -r 5d74a79deeb3 -r 5eddae9ff4a7 send.c
--- a/send.c    Sun Jul 08 15:34:10 2007 -0700
+++ b/send.c    Mon Jul 09 11:32:34 2007 -0400
@@ -1210,7 +1210,10 @@ ci_send_message (int flags,              /* send mod
   }
 
   if (!msg->env->from && option (OPTUSEFROM) && !(flags & 
(SENDPOSTPONED|SENDRESEND)))
+  {
     msg->env->from = mutt_default_from ();
+    killfrom = 1;      /* $use_from will be re-checked after send-hooks */
+  }
 
   if (flags & SENDBATCH) 
   {
@@ -1281,9 +1284,12 @@ ci_send_message (int flags,              /* send mod
      */
     msg->replied = 0;
 
+    /* $use_from and/or $from might have changed in a send-hook */
     if (killfrom)
     {
       rfc822_free_address (&msg->env->from);
+      if (option (OPTUSEFROM) && !(flags & (SENDPOSTPONED|SENDRESEND)))
+       msg->env->from = mutt_default_from ();
       killfrom = 0;
     }