--- gnus-5.10.6/lisp/nnimap.el.orig 2003-09-05 01:22:18.000000000 +0300 +++ gnus-5.10.6/lisp/nnimap.el 2005-10-26 15:20:45.366839000 +0300 @@ -312,6 +312,11 @@ 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 @@ -1411,6 +1416,21 @@ (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