Commit cccb4b4c authored by Lars Magne Ingebrigtsen's avatar Lars Magne Ingebrigtsen Committed by Katsumi Yamaoka
Browse files

nnimap.el: Use the UID returned when copying and accepting articles, instead...

nnimap.el: Use the UID returned when copying and accepting articles, instead of searching for the ID (on the servers that support it).
nnimap.el (nnimap-get-groups): Reimplement to work with folded lines.
parent ae489548
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
   
* nnimap.el (nnimap-last-response-string): Remove the unfolding -- it * nnimap.el (nnimap-last-response-string): Remove the unfolding -- it
introduces regressions in article selection. introduces regressions in article selection.
(nnimap-find-uid-response): New function.
(nnimap-request-accept-article): Use the UID returned, if any.
(nnimap-request-move-article): Use the UID returned, if any.
(nnimap-get-groups): Reimplement to work with folded lines.
   
2010-11-25 Katsumi Yamaoka <yamaoka@jpl.org> 2010-11-25 Katsumi Yamaoka <yamaoka@jpl.org>
   
......
...@@ -800,8 +800,9 @@ textual parts.") ...@@ -800,8 +800,9 @@ textual parts.")
(when (car result) (when (car result)
(nnimap-delete-article article) (nnimap-delete-article article)
(cons internal-move-group (cons internal-move-group
(nnimap-find-article-by-message-id (or (nnimap-find-uid-response "COPYUID" (cadr result))
internal-move-group message-id)))) (nnimap-find-article-by-message-id
internal-move-group message-id)))))
;; Move the article to a different method. ;; Move the article to a different method.
(let ((result (eval accept-form))) (let ((result (eval accept-form)))
(when result (when result
...@@ -978,7 +979,22 @@ textual parts.") ...@@ -978,7 +979,22 @@ textual parts.")
(nnheader-message 7 "%s" (nnheader-get-report-string 'nnimap)) (nnheader-message 7 "%s" (nnheader-get-report-string 'nnimap))
nil) nil)
(cons group (cons group
(nnimap-find-article-by-message-id group message-id)))))))) (or (nnimap-find-uid-response "APPENDUID" (car result))
(nnimap-find-article-by-message-id
group message-id)))))))))
(defun nnimap-find-uid-response (name list)
(let ((result (nth 2 (nnimap-find-response-element name list))))
(and result
(string-to-number result))))
(defun nnimap-find-response-element (name list)
(let (result)
(dolist (elem list)
(when (and (consp elem)
(equal name (car elem)))
(setq result elem)))
result))
(deffoo nnimap-request-replace-article (article group buffer) (deffoo nnimap-request-replace-article (article group buffer)
(let (group-art) (let (group-art)
...@@ -997,15 +1013,22 @@ textual parts.") ...@@ -997,15 +1013,22 @@ textual parts.")
(replace-match "\r\n" t t))) (replace-match "\r\n" t t)))
(defun nnimap-get-groups () (defun nnimap-get-groups ()
(let ((result (nnimap-command "LIST \"\" \"*\"")) (erase-buffer)
(let ((sequence (nnimap-send-command "LIST \"\" \"*\""))
groups) groups)
(when (car result) (nnimap-wait-for-response sequence)
(dolist (line (cdr result)) (subst-char-in-region (point-min) (point-max)
(when (and (equal (car line) "LIST") ?\\ ?% t)
(not (and (caadr line) (goto-char (point-min))
(string-match "noselect" (caadr line))))) (nnimap-unfold-quoted-lines)
(push (car (last line)) groups))) (goto-char (point-min))
(nreverse groups)))) (while (search-forward "* LIST " nil t)
(let ((flags (read (current-buffer)))
(separator (read (current-buffer)))
(group (read (current-buffer))))
(unless (member '%NoSelect flags)
(push group groups))))
(nreverse groups)))
(deffoo nnimap-request-list (&optional server) (deffoo nnimap-request-list (&optional server)
(nnimap-possibly-change-group nil server) (nnimap-possibly-change-group nil server)
......
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