#| -*-Scheme-*-
-$Id: imail-core.scm,v 1.173 2008/08/29 20:14:50 riastradh Exp $
+$Id: imail-core.scm,v 1.174 2008/08/31 23:02:17 riastradh Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(if folder
(unmap-folder-index folder index)
index)))
-
+\f
(define %set-message-flags!
(let ((modifier (slot-modifier <message> 'FLAGS)))
(lambda (message flags)
(if folder
(object-modified! folder 'FLAGS message))))))
+(define-generic message-permanent-flags (message))
+
+(define-method message-permanent-flags ((message <message>))
+ (message-flags message))
+
(define (message-attached? message #!optional folder)
(let ((folder (if (default-object? folder) #f folder)))
(if folder
#| -*-Scheme-*-
-$Id: imail-imap.scm,v 1.228 2008/08/29 20:14:50 riastradh Exp $
+$Id: imail-imap.scm,v 1.229 2008/08/31 23:02:17 riastradh Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
(lambda (flag)
(flags-member? flag allowed-flags)))))))))))
+(define-method message-permanent-flags ((message <imap-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.
+ (flags-delete "recent" (message-flags message)))
+
(define (imap-flag->imail-flag flag)
(let ((entry (assq flag standard-imap-flags)))
(if entry
(imap:command:append connection
(imap-url-server-mailbox url)
(map imail-flag->imap-flag
- (flags-delete
- "recent"
- (message-flags message)))
+ (message-permanent-flags message))
(message-internal-time message)
(message->string message)))))))))
#| -*-Scheme-*-
-$Id: imail-rmail.scm,v 1.78 2008/07/03 20:08:12 cph Exp $
+$Id: imail-rmail.scm,v 1.79 2008/08/31 23:02:17 riastradh Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
folder
(make-rmail-message (message-header-fields message)
(file-message-body message)
- (list-copy (message-flags message))
+ (list-copy (message-permanent-flags message))
(rmail-message-displayed-header-fields message)
(message-internal-time message)))
\f
#| -*-Scheme-*-
-$Id: imail-umail.scm,v 1.58 2008/07/03 20:08:15 cph Exp $
+$Id: imail-umail.scm,v 1.59 2008/08/31 23:02:17 riastradh Exp $
Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
folder
(make-umail-message (message-header-fields message)
(file-message-body message)
- (list-copy (message-flags message))
+ (list-copy (message-permanent-flags message))
(umail-message-from-line message)))
(define-method message-internal-time ((message <umail-message>))
(define (write-umail-message message output-flags? port)
(write-string (umail-message-from-line message) port)
(newline port)
- (write-header-fields (if output-flags?
- (append (message-header-fields message)
- (list (message-flags->header-field
- (message-flags message))))
- (message-header-fields message))
- port)
+ (write-header-fields
+ (if output-flags?
+ (append (message-header-fields message)
+ (let ((flags (message-permanent-flags message)))
+ (if (pair? flags)
+ (list (message-flags->header-field flags))
+ '())))
+ (message-header-fields message))
+ port)
(for-each (lambda (line)
(if (string-prefix-ci? "From " line)
(write-string ">" port))