Use the UID returned when copying and accepting articles, instead of
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Fri, 26 Nov 2010 00:54:05 +0000 (01:54 +0100)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Fri, 26 Nov 2010 00:54:05 +0000 (01:54 +0100)
searching for the ID (on the servers that support it).

lisp/ChangeLog
lisp/nnimap.el

index fcfcf27..da23969 100644 (file)
@@ -2,6 +2,9 @@
 
        * 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.
 
 2010-11-25  Katsumi Yamaoka  <yamaoka@jpl.org>
 
index 3f0892d..ebf1a55 100644 (file)
@@ -800,8 +800,9 @@ textual parts.")
              (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 @@ textual parts.")
                (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)