aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen2010-11-26 01:14:40 +0000
committerKatsumi Yamaoka2010-11-26 01:14:40 +0000
commitcccb4b4ccd7c92b0b976127ee85b6524c0ab2e97 (patch)
tree3442e82b9008befb054ce457a003cc8d557a7668
parentae48954851890b053595eb5640f1d7226a64a7e9 (diff)
downloademacs-cccb4b4ccd7c92b0b976127ee85b6524c0ab2e97.tar.gz
emacs-cccb4b4ccd7c92b0b976127ee85b6524c0ab2e97.zip
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.
-rw-r--r--lisp/gnus/ChangeLog4
-rw-r--r--lisp/gnus/nnimap.el45
2 files changed, 38 insertions, 11 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 98008202da3..85c9ffb7b9f 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -2,6 +2,10 @@
2 2
3 * nnimap.el (nnimap-last-response-string): Remove the unfolding -- it 3 * nnimap.el (nnimap-last-response-string): Remove the unfolding -- it
4 introduces regressions in article selection. 4 introduces regressions in article selection.
5 (nnimap-find-uid-response): New function.
6 (nnimap-request-accept-article): Use the UID returned, if any.
7 (nnimap-request-move-article): Use the UID returned, if any.
8 (nnimap-get-groups): Reimplement to work with folded lines.
5 9
62010-11-25 Katsumi Yamaoka <yamaoka@jpl.org> 102010-11-25 Katsumi Yamaoka <yamaoka@jpl.org>
7 11
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 3f0892dbf0c..63a1115bd0f 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -800,8 +800,9 @@ textual parts.")
800 (when (car result) 800 (when (car result)
801 (nnimap-delete-article article) 801 (nnimap-delete-article article)
802 (cons internal-move-group 802 (cons internal-move-group
803 (nnimap-find-article-by-message-id 803 (or (nnimap-find-uid-response "COPYUID" (cadr result))
804 internal-move-group message-id)))) 804 (nnimap-find-article-by-message-id
805 internal-move-group message-id)))))
805 ;; Move the article to a different method. 806 ;; Move the article to a different method.
806 (let ((result (eval accept-form))) 807 (let ((result (eval accept-form)))
807 (when result 808 (when result
@@ -978,7 +979,22 @@ textual parts.")
978 (nnheader-message 7 "%s" (nnheader-get-report-string 'nnimap)) 979 (nnheader-message 7 "%s" (nnheader-get-report-string 'nnimap))
979 nil) 980 nil)
980 (cons group 981 (cons group
981 (nnimap-find-article-by-message-id group message-id)))))))) 982 (or (nnimap-find-uid-response "APPENDUID" (car result))
983 (nnimap-find-article-by-message-id
984 group message-id)))))))))
985
986(defun nnimap-find-uid-response (name list)
987 (let ((result (nth 2 (nnimap-find-response-element name list))))
988 (and result
989 (string-to-number result))))
990
991(defun nnimap-find-response-element (name list)
992 (let (result)
993 (dolist (elem list)
994 (when (and (consp elem)
995 (equal name (car elem)))
996 (setq result elem)))
997 result))
982 998
983(deffoo nnimap-request-replace-article (article group buffer) 999(deffoo nnimap-request-replace-article (article group buffer)
984 (let (group-art) 1000 (let (group-art)
@@ -997,15 +1013,22 @@ textual parts.")
997 (replace-match "\r\n" t t))) 1013 (replace-match "\r\n" t t)))
998 1014
999(defun nnimap-get-groups () 1015(defun nnimap-get-groups ()
1000 (let ((result (nnimap-command "LIST \"\" \"*\"")) 1016 (erase-buffer)
1017 (let ((sequence (nnimap-send-command "LIST \"\" \"*\""))
1001 groups) 1018 groups)
1002 (when (car result) 1019 (nnimap-wait-for-response sequence)
1003 (dolist (line (cdr result)) 1020 (subst-char-in-region (point-min) (point-max)
1004 (when (and (equal (car line) "LIST") 1021 ?\\ ?% t)
1005 (not (and (caadr line) 1022 (goto-char (point-min))
1006 (string-match "noselect" (caadr line))))) 1023 (nnimap-unfold-quoted-lines)
1007 (push (car (last line)) groups))) 1024 (goto-char (point-min))
1008 (nreverse groups)))) 1025 (while (search-forward "* LIST " nil t)
1026 (let ((flags (read (current-buffer)))
1027 (separator (read (current-buffer)))
1028 (group (read (current-buffer))))
1029 (unless (member '%NoSelect flags)
1030 (push group groups))))
1031 (nreverse groups)))
1009 1032
1010(deffoo nnimap-request-list (&optional server) 1033(deffoo nnimap-request-list (&optional server)
1011 (nnimap-possibly-change-group nil server) 1034 (nnimap-possibly-change-group nil server)