From fd49d273baee377667efbe1f96b4d1fd2ad23b52 Mon Sep 17 00:00:00 2001 From: "Taylor R. Campbell" Date: Tue, 2 Dec 2008 22:19:34 +0000 Subject: [PATCH] Exclude \Recent flags from STORE and APPEND commands and from IMAP messages' permanent flags for filing to other folders. Include all other flags, even if the server will not store them permanently. The PERMANENTFLAGS list is no longer used for any purpose. --- v7/src/imail/imail-imap.scm | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/v7/src/imail/imail-imap.scm b/v7/src/imail/imail-imap.scm index 829d00a90..c57a0dde8 100644 --- a/v7/src/imail/imail-imap.scm +++ b/v7/src/imail/imail-imap.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: imail-imap.scm,v 1.236 2008/09/25 15:16:09 riastradh Exp $ +$Id: imail-imap.scm,v 1.237 2008/12/02 22:19:34 riastradh Exp $ Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, @@ -1135,21 +1135,21 @@ USA. (imap:command:uid-store-flags connection (imap-message-uid message) - (map imail-flag->imap-flag - (let ((flags (flags-delete "recent" flags)) - (folder (message-folder message))) - (if (imap-folder-permanent-keywords? folder) - flags - (list-transform-positive flags - (let ((allowed-flags (imap-folder-allowed-flags folder))) - (lambda (flag) - (flags-member? flag allowed-flags))))))))))) + ;; In the past, this also removed flags absent from the + ;; folder's PERMANENTFLAGS list. However, the RFC 3501 states + ;; that `If the client attempts to STORE a flag that is not in + ;; the PERMANENTFLAGS list, the server will either ignore the + ;; change or store the state change for the remainder of the + ;; current session only.' So there is no harm in storing flags + ;; other than \Recent. + (map imail-flag->imap-flag (flags-delete "recent" flags)))))) (define-method %message-permanent-flags ((message )) - ;; Perhaps this should intersect the flags with the folder's list of - ;; permanent flags, if the folder does not allow permanent - ;; user-defined flags, in order to preserve only those flags that - ;; the IMAP folder would consider permanent. + ;; This does not yield strictly the flags that would be permanently + ;; set in an IMAP folder. Only those in the folder's PERMANENTFLAGS + ;; list will do that. However, if a user flags a message, and then + ;; files it, probably the intent was to leave the flag there (except + ;; if the flag is `deleted' or `recent'). (flags-delete "recent" (message-flags message))) (define (imap-flag->imail-flag flag) @@ -2243,7 +2243,9 @@ USA. (imap:command:append connection (imap-url-server-mailbox url) (map imail-flag->imap-flag - (message-permanent-flags message)) + (flags-delete + "recent" + (message-permanent-flags message))) (message-internal-time message) (message->string message))))))))) -- 2.25.1