Allow for stripping sigs when replying, if enabled will drop everything
[squirrelmail.git] / src / compose.php
index 7cb53aaf64a3a3b9b1333579460653c33f56e4ed..7c25053b548290612bbf75830943ad0fda32a2db 100644 (file)
@@ -373,7 +373,7 @@ if ($send) {
             showInputForm($session);
             exit();
         }
-       unset($compose_messages[$session]);
+        unset($compose_messages[$session]);
         if ( isset($delete_draft)) {
             Header("Location: $location/delete_message.php?mailbox=" . urlencode( $draft_folder ).
                    "&message=$delete_draft&sort=$sort&startMessage=1&mail_sent=yes");
@@ -385,7 +385,7 @@ if ($send) {
         }
         else {
             Header("Location: $location/right_main.php?mailbox=$urlMailbox&sort=$sort".
-                   "&startMessage=$startMessage&note=".urlencode(_("Your Message has been sent.")));
+                   "&startMessage=$startMessage&mail_sent=yes");
         }
     } else {
         if ($compose_new_win == '1') {
@@ -722,18 +722,20 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
             /* this corrects some wrapping/quoting problems on replies */
             $rewrap_body = explode("\n", $body);
             $from =  (is_array($orig_header->from)) ? $orig_header->from[0] : $orig_header->from;
-            sqUnWordWrap($body);
+            sqUnWordWrap($body);       // unwrap and then reset it?!
             $body = '';
-            $cnt = count($rewrap_body);
-            for ($i=0;$i<$cnt;$i++) {
-              sqWordWrap($rewrap_body[$i], ($editor_size));
-                if (preg_match("/^(>+)/", $rewrap_body[$i], $matches)) {
+            $strip_sigs = getPref($data_dir, $username, 'strip_sigs');
+            foreach ($rewrap_body as $line) {
+                if ($strip_sigs && substr($line,0,3) == '-- ') {
+                       break;
+                }
+                sqWordWrap($line, ($editor_size));
+                if (preg_match("/^(>+)/", $line, $matches)) {
                     $gt = $matches[1];
-                    $body .= '>' . str_replace("\n", "\n>$gt ", rtrim($rewrap_body[$i])) ."\n";
+                    $body .= '>' . str_replace("\n", "\n>$gt ", rtrim($line)) ."\n";
                 } else {
-                    $body .= '> ' . str_replace("\n", "\n> ", rtrim($rewrap_body[$i])) . "\n";
+                    $body .= '> ' . str_replace("\n", "\n> ", rtrim($line)) . "\n";
                 }
-                unset($rewrap_body[$i]);
             }
             $body = getReplyCitation($from) . $body;
             $composeMessage->reply_rfc822_header = $orig_header;