Rocco Rutte:
[apps/madmutt.git] / send.c
diff --git a/send.c b/send.c
index d8fa359..c687492 100644 (file)
--- a/send.c
+++ b/send.c
  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
  */ 
 
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include "mutt.h"
 #include "mutt_curses.h"
 #include "rfc2047.h"
@@ -54,10 +58,16 @@ static void append_signature (FILE *f)
   FILE *tmpfp;
   pid_t thepid;
 
+  if (SignOffString) {
+    fprintf(f,"\n%s",SignOffString);
+  }
+
   if (Signature && (tmpfp = mutt_open_read (Signature, &thepid)))
   {
     if (option (OPTSIGDASHES))
       fputs ("\n-- \n", f);
+    else if (SignOffString)
+      fputs("\n",f);
     mutt_copy_stream (tmpfp, f);
     fclose (tmpfp);
     if (thepid != -1)
@@ -217,6 +227,7 @@ static int edit_envelope (ENVELOPE *en, int flags)
 {
   char buf[HUGE_STRING];
   LIST *uh = UserHeader;
+  regmatch_t pat_match[1];
 
 #ifdef USE_NNTP
   if (option (OPTNEWSSEND))
@@ -281,7 +292,19 @@ static int edit_envelope (ENVELOPE *en, int flags)
       }
     }
   }
-  
+
+  if ((flags & (SENDREPLY)) && option (OPTSTRIPWAS) && StripWasRegexp.rx &&
+      regexec (StripWasRegexp.rx, buf, 1, pat_match, 0) == 0) {
+    unsigned int pos = pat_match->rm_so;
+    if (ascii_strncasecmp (buf, "re: ", pos) != 0) {
+      buf[pos] = '\0';                  /* kill match */
+      while (pos-- && buf[pos] == ' ')
+        buf[pos] = '\0';                /* remove trailing spaces */
+    } else {
+      mutt_error (_("Ignoring $strip_was: Subject would be empty."));
+      sleep (2);
+    }
+  }
   if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) != 0 ||
       (!buf[0] && query_quadoption (OPT_SUBJECT, _("No subject, abort?")) != M_NO))
   {