aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2011-06-27 04:01:30 -0400
committerRichard M. Stallman2011-06-27 04:01:30 -0400
commitd31fd9acf0992922c3e9d80eae7c6a74529623ab (patch)
treeeb8942376afb17937bfdb59017c628d0307d4bc5
parent819a6054c72afc94ff1bbcfb1225e9db6696f032 (diff)
downloademacs-d31fd9acf0992922c3e9d80eae7c6a74529623ab.tar.gz
emacs-d31fd9acf0992922c3e9d80eae7c6a74529623ab.zip
rmailmm: Handle truncated messages.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/mail/rmailmm.el17
2 files changed, 20 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 499a30d2031..3fcb5e59fc6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12011-06-27 Richard Stallman <rms@gnu.org>
2
3 * mail/rmailmm.el (rmail-mime-process-multipart):
4 Handle truncated messages.
5
12011-06-27 Glenn Morris <rgm@gnu.org> 62011-06-27 Glenn Morris <rgm@gnu.org>
2 7
3 * progmodes/flymake.el (flymake-err-line-patterns): 8 * progmodes/flymake.el (flymake-err-line-patterns):
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index a02d388a6f7..651defeaf46 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -843,8 +843,18 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
843 ;; the beginning of the next part. The current point is just 843 ;; the beginning of the next part. The current point is just
844 ;; after the boundary tag. 844 ;; after the boundary tag.
845 (setq beg (point-min)) 845 (setq beg (point-min))
846 (while (search-forward boundary nil t) 846
847 (setq end (match-beginning 0)) 847 (while (or (and (search-forward boundary nil t)
848 (setq end (match-beginning 0)))
849 ;; If the boundary does not appear at all,
850 ;; the message was truncated.
851 ;; Handle the rest of the truncated message
852 ;; (if it isn't empty) by pretending that the boundary
853 ;; appears at the end of the message.
854 (and (save-excursion
855 (skip-chars-forward "\n")
856 (> (point-max) (point)))
857 (setq end (point-max))))
848 ;; If this is the last boundary according to RFC 2046, hide the 858 ;; If this is the last boundary according to RFC 2046, hide the
849 ;; epilogue, else hide the boundary only. Use a marker for 859 ;; epilogue, else hide the boundary only. Use a marker for
850 ;; `next' because `rmail-mime-show' may change the buffer. 860 ;; `next' because `rmail-mime-show' may change the buffer.
@@ -852,6 +862,9 @@ The other arguments are the same as `rmail-mime-multipart-handler'."
852 (setq next (point-max-marker))) 862 (setq next (point-max-marker)))
853 ((looking-at "[ \t]*\n") 863 ((looking-at "[ \t]*\n")
854 (setq next (copy-marker (match-end 0) t))) 864 (setq next (copy-marker (match-end 0) t)))
865 ((= end (point-max))
866 ;; We're handling what's left of a truncated message.
867 (setq next (point-max-marker)))
855 (t 868 (t
856 ;; The original code signalled an error as below, but 869 ;; The original code signalled an error as below, but
857 ;; this line may be a boundary of nested multipart. So, 870 ;; this line may be a boundary of nested multipart. So,