Function: nnimap-process-expiry-targets
nnimap-process-expiry-targets is a byte-compiled function defined in
nnimap.el.gz.
Signature
(nnimap-process-expiry-targets ARTICLES GROUP SERVER)
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/nnimap.el.gz
(defun nnimap-process-expiry-targets (articles group server)
(let ((deleted-articles nil)
(articles-to-delete nil))
(cond
;; shortcut further processing if we're going to delete the articles
((eq nnmail-expiry-target 'delete)
(setq articles-to-delete articles)
t)
;; or just move them to another folder on the same IMAP server
((and (not (functionp nnmail-expiry-target))
(gnus-server-equal (gnus-group-method nnmail-expiry-target)
(gnus-server-to-method
(format "nnimap:%s" server))))
(and (nnimap-change-group group server)
(with-current-buffer (nnimap-buffer)
(nnheader-message 7 "Expiring articles from %s: %s" group articles)
(let ((can-move (and (nnimap-capability "MOVE")
(equal (nnimap-quirk "MOVE") "MOVE"))))
(nnimap-command
(if can-move
"UID MOVE %s %S"
"UID COPY %s %S")
(nnimap-article-ranges (gnus-compress-sequence articles))
(nnimap-group-to-imap (gnus-group-real-name nnmail-expiry-target)))
(if can-move
(setq deleted-articles articles)
(setq articles-to-delete articles)))))
t)
(t
(dolist (article articles)
(let ((target nnmail-expiry-target))
(with-temp-buffer
(mm-disable-multibyte)
(when (nnimap-request-article article group server (current-buffer))
(when (functionp target)
(setq target (funcall target group)))
(if (and target
(not (eq target 'delete)))
(if (or (gnus-request-group target t)
(gnus-request-create-group target))
(progn
(nnmail-expiry-target-group target group)
(nnheader-message 7 "Expiring article %s:%d to %s"
group article target))
(setq target nil))
(nnheader-message 7 "Expiring article %s:%d" group article))
(when target
(push article articles-to-delete))))))
(setq articles-to-delete (nreverse articles-to-delete))))
;; Change back to the current group again.
(nnimap-change-group group server)
(when articles-to-delete
(nnimap-delete-article (gnus-compress-sequence articles-to-delete))
(setq deleted-articles articles-to-delete))
deleted-articles))