]> granicus.if.org Git - neomutt/commitdiff
Allow send-hooks to effectively change $from and $use_from
authorAron Griffis <agriffis@n01se.net>
Mon, 9 Jul 2007 15:32:34 +0000 (11:32 -0400)
committerAron Griffis <agriffis@n01se.net>
Mon, 9 Jul 2007 15:32:34 +0000 (11:32 -0400)
Signed-off-by: Aron Griffis <agriffis@n01se.net>
send.c

diff --git a/send.c b/send.c
index 8690a86fdcbca2dff64f14a67b20dc1f5fb0f560..5ae2bda5ce7a66c63e40f89d9b92617dbc82b996 100644 (file)
--- a/send.c
+++ b/send.c
@@ -1210,7 +1210,10 @@ ci_send_message (int flags,              /* send mode */
   }
 
   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 mode */
      */
     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;
     }