emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r104756: rmailmm: Handle truncated me


From: Richard Stallman
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r104756: rmailmm: Handle truncated messages.
Date: Mon, 27 Jun 2011 04:01:30 -0400
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 104756
committer: Richard Stallman <address@hidden>
branch nick: trunk
timestamp: Mon 2011-06-27 04:01:30 -0400
message:
  rmailmm: Handle truncated messages.
modified:
  lisp/ChangeLog
  lisp/mail/rmailmm.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-06-27 07:23:27 +0000
+++ b/lisp/ChangeLog    2011-06-27 08:01:30 +0000
@@ -1,3 +1,8 @@
+2011-06-27  Richard Stallman  <address@hidden>
+
+       * mail/rmailmm.el (rmail-mime-process-multipart):
+       Handle truncated messages.
+
 2011-06-27  Glenn Morris  <address@hidden>
 
        * progmodes/flymake.el (flymake-err-line-patterns):

=== modified file 'lisp/mail/rmailmm.el'
--- a/lisp/mail/rmailmm.el      2011-06-22 23:35:21 +0000
+++ b/lisp/mail/rmailmm.el      2011-06-27 08:01:30 +0000
@@ -843,8 +843,18 @@
     ;; the beginning of the next part.  The current point is just
     ;; after the boundary tag.
     (setq beg (point-min))
-    (while (search-forward boundary nil t)
-      (setq end (match-beginning 0))
+
+    (while (or (and (search-forward boundary nil t)
+                   (setq end (match-beginning 0)))
+              ;; If the boundary does not appear at all,
+              ;; the message was truncated.
+              ;; Handle the rest of the truncated message
+              ;; (if it isn't empty) by pretending that the boundary
+              ;; appears at the end of the message.
+              (and (save-excursion
+                     (skip-chars-forward "\n")
+                     (> (point-max) (point)))
+                   (setq end (point-max))))
       ;; If this is the last boundary according to RFC 2046, hide the
       ;; epilogue, else hide the boundary only.  Use a marker for
       ;; `next' because `rmail-mime-show' may change the buffer.
@@ -852,6 +862,9 @@
             (setq next (point-max-marker)))
            ((looking-at "[ \t]*\n")
             (setq next (copy-marker (match-end 0) t)))
+           ((= end (point-max))
+            ;; We're handling what's left of a truncated message.
+            (setq next (point-max-marker)))
            (t
             ;; The original code signalled an error as below, but
             ;; this line may be a boundary of nested multipart.  So,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]