Use EXAMINE instead of SELECT to get the message-id.
authorLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Thu, 30 Sep 2010 16:42:26 +0000 (18:42 +0200)
committerLars Magne Ingebrigtsen <larsi@quimbies.gnus.org>
Thu, 30 Sep 2010 16:42:26 +0000 (18:42 +0200)
lisp/ChangeLog
lisp/nnimap.el

index 5129e91..78993ed 100644 (file)
@@ -1,5 +1,8 @@
 2010-09-30  Lars Magne Ingebrigtsen  <larsi@gnus.org>
 
+       * nnimap.el (nnimap-find-article-by-message-id): Use EXAMINE instead of
+       SELECT to get the message-id.
+
        * mail-source.el (mail-sources): Removed webmail support.
        (defvar): Ditto.
        (mail-source-fetcher-alist): Ditto.
index d7c4882..241dc7d 100644 (file)
@@ -729,16 +729,19 @@ textual parts.")
 
 
 (defun nnimap-find-article-by-message-id (group message-id)
-  (when (nnimap-possibly-change-group group nil)
-    (with-current-buffer (nnimap-buffer)
-      (let ((result
-            (nnimap-command "UID SEARCH HEADER Message-Id %S" message-id))
-           article)
-       (when (car result)
-         ;; Select the last instance of the message in the group.
-         (and (setq article
-                    (car (last (assoc "SEARCH" (cdr result)))))
-              (string-to-number article)))))))
+  (with-current-buffer (nnimap-buffer)
+    (erase-buffer)
+    (setf (nnimap-group nnimap-object) nil)
+    (nnimap-send-command "EXAMINE %S" (utf7-encode group t))
+    (let ((sequence
+          (nnimap-send-command "UID SEARCH HEADER Message-Id %S" message-id))
+         article result)
+      (setq result (nnimap-wait-for-response sequence))
+      (when (car result)
+       ;; Select the last instance of the message in the group.
+       (and (setq article
+                  (car (last (assoc "SEARCH" (cdr result)))))
+            (string-to-number article))))))
 
 (defun nnimap-delete-article (articles)
   (with-current-buffer (nnimap-buffer)