[gnus git] branch master updated: m0-13-36-gd588ae3 =1= nnimap.el: Use IMAP MOVE extension if available
Eric Abrahamsen <[email protected]> Sun, 02 Aug 2015 07:42:06 +0200
| Newsgroups | gmane.emacs.gnus.cvs |
|---|---|
| Message-ID | <[email protected]> |
via d588ae3db11ee057d2fc3dfa5364dcfe3f84e368 (commit)
from 238e63665cab7381691766c2bbdb5c16ab381c97 (commit)
- Log -----------------------------------------------------------------
commit d588ae3db11ee057d2fc3dfa5364dcfe3f84e368
Author: Nikolaus Rath <[email protected]>
Date: Sat Jul 11 12:22:24 2015 +0800
nnimap.el: Use IMAP MOVE extension if available
* nnimap.el (nnimap-request-move-article, nnimap-process-expiry-targets,
nnimap-split-incoming-mail): Use MOVE extension if available.
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e23bed2..4ce2c22 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,11 @@
2015-08-02 Nikolaus Rath <[email protected]>
+ * nnimap.el (nnimap-request-move-article)
+ (nnimap-process-expiry-targets, nnimap-split-incoming-mail): Use MOVE
+ extension if available.
+
+2015-08-02 Nikolaus Rath <[email protected]>
+
* nnimap.el (nnimap-open-connection-1): explicitly ask server for
capabilities instead of relying on LOGIN response.
diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 594d1f5..20ba0a3 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -930,15 +930,17 @@ textual parts.")
;; way.
(let ((message-id (message-field-value "message-id")))
(if internal-move-group
- (let ((result
(with-current-buffer (nnimap-buffer)
- (nnimap-command "UID COPY %d %S"
- article
- (utf7-encode internal-move-group t)))))
- (when (car result)
- (nnimap-delete-article article)
+ (let* ((can-move (nnimap-capability "MOVE"))
+ (command (if can-move
+ "UID MOVE %d %S"
+ "UID COPY %d %S"))
+ (result (nnimap-command command article
+ (utf7-encode internal-move-group t))))
+ (when (and (car result) (not can-move))
+ (nnimap-delete-article article))
(cons internal-move-group
- (or (nnimap-find-uid-response "COPYUID" (cadr result))
+ (or (nnimap-find-uid-response "COPYUID" (caddr result))
(nnimap-find-article-by-message-id
internal-move-group server message-id
nnimap-request-articles-find-limit)))))
@@ -980,11 +982,12 @@ textual parts.")
(gnus-sorted-complement articles deletable-articles))))))
(defun nnimap-process-expiry-targets (articles group server)
- (let ((deleted-articles nil))
+ (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 deleted-articles articles)
+ (setq articles-to-delete articles)
t)
;; or just move them to another folder on the same IMAP server
((and (not (functionp nnmail-expiry-target))
@@ -994,11 +997,14 @@ textual parts.")
(and (nnimap-change-group group server)
(with-current-buffer (nnimap-buffer)
(nnheader-message 7 "Expiring articles from %s: %s" group articles)
+ (let ((can-move (nnimap-capability "MOVE")))
(nnimap-command
- "UID COPY %s %S"
+ (if can-move
+ "UID MOVE %s %S"
+ "UID COPY %s %S")
(nnimap-article-ranges (gnus-compress-sequence articles))
(utf7-encode (gnus-group-real-name nnmail-expiry-target) t))
- (setq deleted-articles articles)))
+ (set (if can-move 'deleted-articles 'articles-to-delete) articles))))
t)
(t
(dolist (article articles)
@@ -1019,11 +1025,13 @@ textual parts.")
(setq target nil))
(nnheader-message 7 "Expiring article %s:%d" group article))
(when target
- (push article deleted-articles))))))
- (setq deleted-articles (nreverse deleted-articles))))
+ (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)
- (nnimap-delete-article (gnus-compress-sequence deleted-articles))
+ (when articles-to-delete
+ (nnimap-delete-article (gnus-compress-sequence articles-to-delete))
+ (setq deleted-articles articles-to-delete))
deleted-articles))
(defun nnimap-find-expired-articles (group)
@@ -2060,6 +2068,7 @@ Return the server's response to the SELECT or EXAMINE command."
nnmail-split-fancy))
(nnmail-inhibit-default-split-group t)
(groups (nnimap-get-groups))
+ (can-move (nnimap-capability "MOVE"))
new-articles)
(erase-buffer)
(nnimap-command "SELECT %S" nnimap-inbox)
@@ -2095,13 +2104,15 @@ Return the server's response to the SELECT or EXAMINE command."
;; target group.
(unless (string= group nnimap-inbox)
(push (list (nnimap-send-command
- "UID COPY %s %S"
+ (if can-move
+ "UID MOVE %s %S"
+ "UID COPY %s %S")
(nnimap-article-ranges ranges)
(utf7-encode group t))
ranges)
sequences)))))
;; Wait for the last COPY response...
- (when sequences
+ (when (and (not can-move) sequences)
(nnimap-wait-for-response (caar sequences))
;; And then mark the successful copy actions as deleted,
;; and possibly expunge them.
-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.
Summary of changes:
lisp/ChangeLog | 6 +++++
lisp/nnimap.el | 67 +++++++++++++++++++++++++++++++++-----------------------
2 files changed, 45 insertions(+), 28 deletions(-)
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".
The branch, master has been updated
hooks/post-receive
--
Gnus Project