Gnus development mailing list
 help / color / mirror / Atom feed
From: Nikolaus Rath <Nikolaus@rath.org>
To: ding@gnus.org, bugs@gnus.org
Subject: [PATCH] Use IMAP MOVE extension if available
Date: Mon, 25 May 2015 12:59:16 -0700	[thread overview]
Message-ID: <87twv0junf.fsf@vostro.rath.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

Hello,

Currently Gnus uses a combination of COPY, STORE + EXPUNGE to move
messages from one imap group into another.

The attached patch enables the use of the MOVE command instead if the
server supports it.

Thanks for considering.

(Is this the right place to post patches, or should it go to
bug-gnu-emacs@gnu.org?)

Best,
-Nikolaus

-- 
GPG encrypted emails preferred. Key id: 0xD113FCAC3C4E599F
Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F

             »Time flies like an arrow, fruit flies like a Banana.«

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: use_imap_move.diff --]
[-- Type: text/x-diff, Size: 1554 bytes --]

--- nnimap.el.bak	2015-05-25 11:04:15.671769838 -0700
+++ nnimap.el	2015-05-25 12:58:27.051313588 -0700
@@ -881,17 +882,19 @@
       ;; 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)
-		(cons internal-move-group
-		      (or (nnimap-find-uid-response "COPYUID" (cadr result))
-			  (nnimap-find-article-by-message-id
-			   internal-move-group server message-id
+            (with-current-buffer (nnimap-buffer)
+              (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))
+                          (nnimap-find-article-by-message-id
+                           internal-move-group server message-id
                            nnimap-request-articles-find-limit)))))
 	  ;; Move the article to a different method.
 	  (let ((result (eval accept-form)))

             reply	other threads:[~2015-05-25 19:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-25 19:59 Nikolaus Rath [this message]
2015-07-07  2:59 ` Eric Abrahamsen
2015-07-07  3:05 ` Eric Abrahamsen
2015-07-09  2:13   ` Nikolaus Rath
2015-07-09  2:18     ` Eric Abrahamsen
2015-07-16  0:29 Nikolaus Rath
2015-07-16  9:00 ` Eric Abrahamsen
2015-07-20  9:53 ` Eric Abrahamsen
2015-07-20 16:18   ` Nikolaus Rath
2015-07-27  4:36     ` Eric Abrahamsen
2015-07-27 16:10       ` Nikolaus Rath
2015-08-02  5:56         ` Eric Abrahamsen
2015-08-02 23:36           ` Nikolaus Rath
2015-08-03  0:40             ` Eric Abrahamsen
2015-08-03  1:08             ` Dan Christensen
2015-08-03  8:17               ` Steinar Bang
2015-08-03 17:18                 ` Nikolaus Rath
2015-08-04  3:17                   ` Eric Abrahamsen
2015-08-04 17:28                     ` Nikolaus Rath
2015-08-05  1:53                       ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87twv0junf.fsf@vostro.rath.org \
    --to=nikolaus@rath.org \
    --cc=bugs@gnus.org \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).