unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#19950: 25.0.50; Gnus nnimap -- don't split messages back into original group
@ 2015-02-26  3:54 Eric Abrahamsen
  2015-02-26  5:10 ` bug#19950: 25.0.50; nnimap: " Ivan Shmakov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Eric Abrahamsen @ 2015-02-26  3:54 UTC (permalink / raw)
  To: 19950

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


Presently, `nnimap-split-incoming-mail' will split a message back into
the group it was already in, if that's how the split rules come out.
That results in a useless COPY/EXPUNGE, effectively incrementing the
message's UID to no purpose.

It's a small inefficiency, and doesn't happen that often, but if a user
has otherwise misconfigured bits of his/her imap setup (ahem), it can
lead to some strange behavior. It shouldn't have any real downside,
either.

I've attached a patch that does this, and can push it if it's okay. The
only potential problem I can imagine would be if an utf7-encoded group
name were somehow compared against a non-encoded group name, but I don't
see how that could happen.

If this is acceptable, does it need a CHANGELOG mention? I've gotten
pretty confused about what's LOG-worthy, and what isn't.



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Don-t-split-imap-messages-back-into-original-group.patch --]
[-- Type: text/x-diff, Size: 1338 bytes --]

From d45e03d434942a883ee67ee5a120cdd04c62c59a Mon Sep 17 00:00:00 2001
From: Eric Abrahamsen <eric@ericabrahamsen.net>
Date: Wed, 18 Feb 2015 17:51:37 +0800
Subject: [PATCH] Don't split imap messages back into original group

* lisp/nnimap.el (nnimap-split-incoming-mail): If a message is already
  in the group it should be split to, don't re-copy it into the group.
---
 lisp/nnimap.el | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lisp/nnimap.el b/lisp/nnimap.el
index 6904e0a..9f89f39 100644
--- a/lisp/nnimap.el
+++ b/lisp/nnimap.el
@@ -2086,12 +2086,15 @@ Return the server's response to the SELECT or EXAMINE command."
 		    (ranges (cdr spec)))
 		(if (eq group 'junk)
 		    (setq junk-articles ranges)
-		  (push (list (nnimap-send-command
-			       "UID COPY %s %S"
-			       (nnimap-article-ranges ranges)
-			       (utf7-encode group t))
-			      ranges)
-			sequences))))
+		  ;; Don't copy if the message is already in its
+		  ;; target group.
+		  (unless (string= group nnimap-inbox)
+		   (push (list (nnimap-send-command
+				"UID COPY %s %S"
+				(nnimap-article-ranges ranges)
+				(utf7-encode group t))
+			       ranges)
+			 sequences)))))
 	    ;; Wait for the last COPY response...
 	    (when sequences
 	      (nnimap-wait-for-response (caar sequences))
-- 
2.3.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-03-25  2:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-26  3:54 bug#19950: 25.0.50; Gnus nnimap -- don't split messages back into original group Eric Abrahamsen
2015-02-26  5:10 ` bug#19950: 25.0.50; nnimap: " Ivan Shmakov
2015-02-26 14:21 ` bug#19950: 25.0.50; Gnus nnimap -- " Stefan Monnier
2015-02-27  5:48   ` Eric Abrahamsen
2015-03-25  2:32     ` Eric Abrahamsen
2015-03-25  2:49 ` bug#19950: closing Eric Abrahamsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).