Commit 827235c3 authored by Lars Ingebrigtsen's avatar Lars Ingebrigtsen Committed by Katsumi Yamaoka
Browse files

nnimap.el: Allow nnimap to parse headers with spaces in odd places

parent 9ed5a258
2012-02-07 Lars Ingebrigtsen <> 2012-02-07 Lars Ingebrigtsen <>
* 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 * shr-color.el (shr-color-set-minimum-interval): Renamed to add prefix
(bug#10732). (bug#10732).
...@@ -189,25 +189,33 @@ textual parts.") ...@@ -189,25 +189,33 @@ textual parts.")
(defun nnimap-transform-headers () (defun nnimap-transform-headers ()
(goto-char (point-min)) (goto-char (point-min))
(let (article bytes lines size string) (let (article lines size string)
(block nil (block nil
(while (not (eobp)) (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))) (delete-region (point) (progn (forward-line 1) (point)))
(when (eobp) (when (eobp)
(return))) (return)))
(setq article (match-string 1)) (goto-char (match-end 0))
;; Unfold quoted {number} strings. ;; Unfold quoted {number} strings.
(while (re-search-forward "[^]][ (]{\\([0-9]+\\)}\r?\n" (while (re-search-forward
(1+ (line-end-position)) t) "[^]][ (]{\\([0-9]+\\)}\r?\n"
(or (re-search-forward "\\* [0-9]+ FETCH" nil t)
(setq size (string-to-number (match-string 1))) (setq size (string-to-number (match-string 1)))
(delete-region (+ (match-beginning 0) 2) (point)) (delete-region (+ (match-beginning 0) 2) (point))
(setq string (buffer-substring (point) (+ (point) size))) (setq string (buffer-substring (point) (+ (point) size)))
(delete-region (point) (+ (point) size)) (delete-region (point) (+ (point) size))
(insert (format "%S" string))) (insert (format "%S" (subst-char-in-string
(setq bytes (nnimap-get-length) ?\n ?\s string))))
lines nil)
(beginning-of-line) (beginning-of-line)
(setq article
(and (re-search-forward "UID \\([0-9]+\\)" (line-end-position)
(match-string 1)))
(setq lines nil)
(setq size (setq size
(and (re-search-forward "RFC822.SIZE \\([0-9]+\\)" (and (re-search-forward "RFC822.SIZE \\([0-9]+\\)"
(line-end-position) (line-end-position)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment