changeset 49878:3e58b8375243

(unforward-rmail-message): Allow nested unforwarding, that is, preserve old Forwarded-From/Date headers.
author Francesco Potortì <pot@gnu.org>
date Thu, 20 Feb 2003 08:56:08 +0000
parents d0dc4f0ff393
children c0ebd202a62f
files lisp/mail/undigest.el
diffstat 1 files changed, 16 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/undigest.el	Thu Feb 20 08:55:38 2003 +0000
+++ b/lisp/mail/undigest.el	Thu Feb 20 08:56:08 2003 +0000
@@ -232,13 +232,18 @@
   ;; If we are in a summary buffer, switch to the Rmail buffer.
   (unwind-protect
       (with-current-buffer rmail-buffer
-	(narrow-to-region (rmail-msgbeg rmail-current-message)
-			  (rmail-msgend rmail-current-message))
 	(goto-char (point-min))
+	(narrow-to-region (point)
+			  (save-excursion (search-forward "\n\n") (point)))
 	(let ((buffer-read-only nil)
-	      (forwarded-from (mail-fetch-field "From"))
-	      (forwarded-date (mail-fetch-field "Date"))
+	      (old-fwd-from (mail-fetch-field "Forwarded-From" nil nil t))
+	      (old-fwd-date (mail-fetch-field "Forwarded-Date" nil nil t))
+	      (fwd-from (mail-fetch-field "From"))
+	      (fwd-date (mail-fetch-field "Date"))
 	      beg end prefix forward-msg)
+	  (narrow-to-region (rmail-msgbeg rmail-current-message)
+			    (rmail-msgend rmail-current-message))
+	  (goto-char (point-min))
 	  (cond ((re-search-forward rmail-forward-separator-regex nil t)
 		 (forward-line 1)
 		 (skip-chars-forward "\n")
@@ -274,8 +279,13 @@
 	  (narrow-to-region (point) (point))
 	  (insert rmail-mail-separator)
 	  (narrow-to-region (point) (point))
-	  (insert "Forwarded-From: " forwarded-from "\n")
-	  (insert "Forwarded-Date: " forwarded-date "\n")
+	  (while old-fwd-from
+	    (insert "Forwarded-From: " (car old-fwd-from) "\n")
+	    (insert "Forwarded-Date: " (car old-fwd-date) "\n")
+	    (setq old-fwd-from (cdr old-fwd-from))
+	    (setq old-fwd-date (cdr old-fwd-date)))
+	  (insert "Forwarded-From: " fwd-from "\n")
+	  (insert "Forwarded-Date: " fwd-date "\n")
 	  (insert forward-msg)
 	  (save-restriction
 	    (goto-char (point-min))