* nnimap.el (nnimap-search-uids-not-since-is-evil): Add variable.
authorSimon Josefsson <jas@extundo.com>
Thu, 27 Oct 2005 08:58:26 +0000 (08:58 +0000)
committerSimon Josefsson <jas@extundo.com>
Thu, 27 Oct 2005 08:58:26 +0000 (08:58 +0000)
(nnimap-request-expire-articles): Use it to avoid sending 'UID
SEARCH UID ... NOT SINCE' queries, for inefficient servers like
Courier IMAP ("some version from 2004").  Mostly based on similar
code in the same function.

lisp/ChangeLog
lisp/nnimap.el

index 7c70586..4b53515 100644 (file)
@@ -1,3 +1,11 @@
+2005-10-27  Jouni K Seppanen <jks@iki.fi>  (tiny change)
+
+       * nnimap.el (nnimap-search-uids-not-since-is-evil): Add variable.
+       (nnimap-request-expire-articles): Use it to avoid sending 'UID
+       SEARCH UID ... NOT SINCE' queries, for inefficient servers like
+       Courier IMAP ("some version from 2004").  Mostly based on similar
+       code in the same function.
+
 2005-10-26  Didier Verna  <didier@xemacs.org>
 
        * gnus-group.el (gnus-group-compact-group): invalidate original
index 98b72f9..288a995 100644 (file)
@@ -317,6 +317,11 @@ every message in the group, thus making it quite slow.
 Unlike other backends, you do not need to take special care if you
 flip this variable.")
 
+(defvoo nnimap-search-uids-not-since-is-evil nil
+  "If non-nil, avoid \"UID SEARCH UID ... NOT SINCE\" queries when expiring.
+Instead, use \"UID SEARCH SINCE\" to prune the list of expirable
+articles within Gnus.  This seems to be faster on Courier in some cases.")
+
 (defvoo nnimap-expunge-on-close 'always ; 'ask, 'never
   "Whether to expunge a group when it is closed.
 When a IMAP group with articles marked for deletion is closed, this
@@ -1494,6 +1499,21 @@ function is generally only called when Gnus is shutting down."
                             (gnus-compress-sequence oldarts)) "\\Deleted")
                       (setq articles (gnus-set-difference
                                       articles oldarts))))))
+               ((and nnimap-search-uids-not-since-is-evil (numberp days))
+                (let* ((all-new-articles
+                        (gnus-compress-sequence
+                         (imap-search (format "SINCE %s"
+                                              (nnimap-date-days-ago days)))))
+                       (oldartseq
+                        (gnus-range-difference artseq all-new-articles))
+                       (oldarts (gnus-uncompress-range oldartseq)))
+                  (when oldarts
+                    (nnimap-expiry-target oldarts group server)
+                    (when (imap-message-flags-add
+                           (imap-range-to-message-set oldartseq)
+                           "\\Deleted")
+                      (setq articles (gnus-set-difference
+                                      articles oldarts))))))
                ((numberp days)
                 (let ((oldarts (imap-search
                                 (format nnimap-expunge-search-string