emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r107152: nnimap.el: Allow nnimap to p


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107152: nnimap.el: Allow nnimap to parse headers with spaces in odd places
Date: Tue, 07 Feb 2012 02:46:47 +0000
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107152
author: Lars Ingebrigtsen <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Tue 2012-02-07 02:46:47 +0000
message:
  nnimap.el: Allow nnimap to parse headers with spaces in odd places
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/nnimap.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2012-02-07 00:42:21 +0000
+++ b/lisp/gnus/ChangeLog       2012-02-07 02:46:47 +0000
@@ -1,5 +1,10 @@
 2012-02-07  Lars Ingebrigtsen  <address@hidden>
 
+       * nnimap.el (nnimap-transform-headers): Remove unused variable.
+       (nnimap-transform-headers): Fix parsing BODYSTRUCTURE elements that
+       have newlines within the strings, and where the UID comes after the
+       BODYSTRUCTURE element (bug#10537).
+
        * shr-color.el (shr-color-set-minimum-interval): Renamed to add prefix
        (bug#10732).
 

=== modified file 'lisp/gnus/nnimap.el'
--- a/lisp/gnus/nnimap.el       2012-02-05 06:31:38 +0000
+++ b/lisp/gnus/nnimap.el       2012-02-07 02:46:47 +0000
@@ -189,25 +189,33 @@
 
 (defun nnimap-transform-headers ()
   (goto-char (point-min))
-  (let (article bytes lines size string)
+  (let (article lines size string)
     (block nil
       (while (not (eobp))
-       (while (not (looking-at "\\* [0-9]+ FETCH.+?UID \\([0-9]+\\)"))
+       (while (not (looking-at "\\* [0-9]+ FETCH"))
          (delete-region (point) (progn (forward-line 1) (point)))
          (when (eobp)
            (return)))
-       (setq article (match-string 1))
+       (goto-char (match-end 0))
        ;; Unfold quoted {number} strings.
-       (while (re-search-forward "[^]][ (]{\\([0-9]+\\)}\r?\n"
-                                 (1+ (line-end-position)) t)
+       (while (re-search-forward
+               "[^]][ (]{\\([0-9]+\\)}\r?\n"
+               (save-excursion
+                 (or (re-search-forward "\\* [0-9]+ FETCH" nil t)
+                     (point-max)))
+               t)
          (setq size (string-to-number (match-string 1)))
          (delete-region (+ (match-beginning 0) 2) (point))
          (setq string (buffer-substring (point) (+ (point) size)))
          (delete-region (point) (+ (point) size))
-         (insert (format "%S" string)))
-       (setq bytes (nnimap-get-length)
-             lines nil)
+         (insert (format "%S" (subst-char-in-string
+                               ?\n ?\s string))))
        (beginning-of-line)
+       (setq article
+             (and (re-search-forward "UID \\([0-9]+\\)" (line-end-position)
+                                     t)
+                  (match-string 1)))
+       (setq lines nil)
        (setq size
              (and (re-search-forward "RFC822.SIZE \\([0-9]+\\)"
                                      (line-end-position)


reply via email to

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