emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r102519: nnimap.el: Use the UID retur


From: Katsumi Yamaoka
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102519: nnimap.el: Use the UID returned when copying and accepting articles, instead of searching for the ID (on the servers that support it).
Date: Fri, 26 Nov 2010 01:14:40 +0000
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102519
author: Lars Magne Ingebrigtsen <address@hidden>
committer: Katsumi Yamaoka <address@hidden>
branch nick: trunk
timestamp: Fri 2010-11-26 01:14:40 +0000
message:
  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.
modified:
  lisp/gnus/ChangeLog
  lisp/gnus/nnimap.el
=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2010-11-26 00:45:03 +0000
+++ b/lisp/gnus/ChangeLog       2010-11-26 01:14:40 +0000
@@ -2,6 +2,10 @@
 
        * nnimap.el (nnimap-last-response-string): Remove the unfolding -- it
        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  <address@hidden>
 

=== modified file 'lisp/gnus/nnimap.el'
--- a/lisp/gnus/nnimap.el       2010-11-26 00:45:03 +0000
+++ b/lisp/gnus/nnimap.el       2010-11-26 01:14:40 +0000
@@ -800,8 +800,9 @@
              (when (car result)
                (nnimap-delete-article article)
                (cons internal-move-group
-                     (nnimap-find-article-by-message-id
-                      internal-move-group message-id))))
+                     (or (nnimap-find-uid-response "COPYUID" (cadr result))
+                         (nnimap-find-article-by-message-id
+                          internal-move-group message-id)))))
          ;; Move the article to a different method.
          (let ((result (eval accept-form)))
            (when result
@@ -978,7 +979,22 @@
                (nnheader-message 7 "%s" (nnheader-get-report-string 'nnimap))
                nil)
            (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)
   (let (group-art)
@@ -997,15 +1013,22 @@
     (replace-match "\r\n" t t)))
 
 (defun nnimap-get-groups ()
-  (let ((result (nnimap-command "LIST \"\" \"*\""))
+  (erase-buffer)
+  (let ((sequence (nnimap-send-command "LIST \"\" \"*\""))
        groups)
-    (when (car result)
-      (dolist (line (cdr result))
-       (when (and (equal (car line) "LIST")
-                  (not (and (caadr line)
-                            (string-match "noselect" (caadr line)))))
-         (push (car (last line)) groups)))
-      (nreverse groups))))
+    (nnimap-wait-for-response sequence)
+    (subst-char-in-region (point-min) (point-max)
+                         ?\\ ?% t)
+    (goto-char (point-min))
+    (nnimap-unfold-quoted-lines)
+    (goto-char (point-min))
+    (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)
   (nnimap-possibly-change-group nil server)


reply via email to

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