diff options
author | Paul Vojta <vojta@math.berkeley.edu> | 2009-07-12 19:43:20 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-07-12 19:43:20 +0300 |
commit | 0517ca033b3222afc09f5b70626c38280c749c14 (patch) | |
tree | 5fe0641174c8136efef245b533b3b8e5a02d1b40 /mail | |
parent | 1184b4a5c89edabc5f951647460b284062d5abda (diff) | |
download | mailutils-0517ca033b3222afc09f5b70626c38280c749c14.tar.gz mailutils-0517ca033b3222afc09f5b70626c38280c749c14.tar.bz2 |
Fix the way mail accounts for the status of messages.
* mail/mail.h (MAIL_ATTRIBUTE_PRESERVED)
(MAIL_ATTRIBUTE_TOUCHED): New define.
* mail/from.c (mail_from0): Mark with 'R' only those messages that
have been read in this mail session.
* mail/hold.c (hold0): Set MAIL_ATTRIBUTE_PRESERVED
* mail/mbox.c (mbox0): Don't mark message as read.
* mail/quit.c (mail_mbox_commit): Force keepsave on
not system mailboxes.
* mail/touch.c: Use MAIL_ATTRIBUTE_TOUCHED
* mail/undelete.c: Clear MAIL_ATTRIBUTE_PRESERVED and
MAIL_ATTRIBUTE_MBOXED bits.
* mail/testsuite/mail/write.exp: Account for the above changes.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/from.c | 8 | ||||
-rw-r--r-- | mail/hold.c | 1 | ||||
-rw-r--r-- | mail/mail.h | 8 | ||||
-rw-r--r-- | mail/mbox.c | 2 | ||||
-rw-r--r-- | mail/quit.c | 12 | ||||
-rw-r--r-- | mail/testsuite/mail/write.exp | 6 | ||||
-rw-r--r-- | mail/touch.c | 6 | ||||
-rw-r--r-- | mail/undelete.c | 2 |
8 files changed, 28 insertions, 17 deletions
diff --git a/mail/from.c b/mail/from.c index 383ae5617..add264347 100644 --- a/mail/from.c +++ b/mail/from.c @@ -98,16 +98,18 @@ mail_from0 (msgset_t *mspec, mu_message_t msg, void *data) if (mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_MBOXED)) cflag = 'M'; + else if (mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_PRESERVED)) + cflag = 'P'; else if (mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED)) cflag = '*'; else if (mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_TAGGED)) cflag = 'T'; - else if (mu_attribute_is_read (attr)) + else if (mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_SHOWN)) cflag = 'R'; - else if (mu_attribute_is_seen (attr)) - cflag = 'U'; else if (mu_attribute_is_recent (attr)) cflag = 'N'; + else if (!mu_attribute_is_read (attr)) + cflag = 'U'; else cflag = ' '; diff --git a/mail/hold.c b/mail/hold.c index 2c74fab99..aaa580c0c 100644 --- a/mail/hold.c +++ b/mail/hold.c @@ -30,6 +30,7 @@ hold0 (msgset_t *mspec, mu_message_t msg, void *data) mu_message_get_attribute (msg, &attr); mu_attribute_unset_userflag (attr, MAIL_ATTRIBUTE_MBOXED); + mu_attribute_set_userflag (attr, MAIL_ATTRIBUTE_PRESERVED); set_cursor (mspec->msg_part[0]); diff --git a/mail/mail.h b/mail/mail.h index 230818afa..b6e4c3901 100644 --- a/mail/mail.h +++ b/mail/mail.h @@ -427,9 +427,11 @@ extern char *readline (char *prompt); /* Message attributes */ #define MAIL_ATTRIBUTE_MBOXED 0x0001 -#define MAIL_ATTRIBUTE_SAVED 0x0002 -#define MAIL_ATTRIBUTE_TAGGED 0x0004 -#define MAIL_ATTRIBUTE_SHOWN 0x0008 +#define MAIL_ATTRIBUTE_PRESERVED 0x0002 +#define MAIL_ATTRIBUTE_SAVED 0x0004 +#define MAIL_ATTRIBUTE_TAGGED 0x0008 +#define MAIL_ATTRIBUTE_SHOWN 0x0010 +#define MAIL_ATTRIBUTE_TOUCHED 0x0020 extern void ml_attempted_completion_over (void); diff --git a/mail/mbox.c b/mail/mbox.c index eac2ae4ed..e1d66b7e8 100644 --- a/mail/mbox.c +++ b/mail/mbox.c @@ -28,8 +28,8 @@ mbox0 (msgset_t *mspec, mu_message_t msg, void *data) mu_attribute_t attr; mu_message_get_attribute (msg, &attr); + mu_attribute_unset_userflag (attr, MAIL_ATTRIBUTE_PRESERVED); mu_attribute_set_userflag (attr, MAIL_ATTRIBUTE_MBOXED); - util_mark_read (msg); set_cursor (mspec->msg_part[0]); diff --git a/mail/quit.c b/mail/quit.c index 524ecc7fe..3d9889028 100644 --- a/mail/quit.c +++ b/mail/quit.c @@ -87,6 +87,7 @@ mail_mbox_commit () /* The mailbox we are closing is not a system one (%). Raise hold flag */ hold = 1; + keepsave = 1; } mu_mailbox_destroy (&mb); } @@ -102,7 +103,12 @@ mail_mbox_commit () && (mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_MBOXED) || (!hold && !mu_attribute_is_deleted (attr) - && mu_attribute_is_read (attr)))) + && !mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_PRESERVED) + && ((mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED) + && keepsave) + || (!mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED) + && (mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_SHOWN) + || mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_TOUCHED))))))) { int status; @@ -136,7 +142,9 @@ mail_mbox_commit () } else if (mu_attribute_is_deleted (attr)) /* Skip this one */; - else if (!keepsave && mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED)) + else if (!keepsave + && !mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_PRESERVED) + && mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED)) mu_attribute_set_deleted (attr); else if (mu_attribute_is_read (attr)) mu_attribute_set_seen (attr); diff --git a/mail/testsuite/mail/write.exp b/mail/testsuite/mail/write.exp index 168fa7e79..85b1d16c9 100644 --- a/mail/testsuite/mail/write.exp +++ b/mail/testsuite/mail/write.exp @@ -1,6 +1,6 @@ # -*- tcl -*- # This file is part of Mailutils testsuite. -# Copyright (C) 2002, 2007 Free Software Foundation +# Copyright (C) 2002, 2007, 2009 Free Software Foundation # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -74,7 +74,7 @@ mail_test "headers" \ " * 2 Bar Fri Dec 28 23:28 16/579 Re: Jabberwocky" mail_test -noprompt "quit" \ - "Held 0 messages in $MU_SPOOL_DIR/mbox" + "Held 2 messages in $MU_SPOOL_DIR/mbox" # Examine its contents mail_start -reuse-spool "--file=$MU_FOLDER_DIR/three" @@ -88,7 +88,7 @@ mail_test "Save" \ "\"$MU_FOLDER_DIR/gray\" 12/425" mail_test "file \"$MU_FOLDER_DIR/gray\"" \ - "Held 1 message in $MU_FOLDER_DIR/three" + "Held 2 messages in $MU_FOLDER_DIR/three" mail_test "headers" \ ">N 1 Sergey Poznyakoff Tue Jul 16 12:11 12/425 MBOX" diff --git a/mail/touch.c b/mail/touch.c index 78d763b00..291109885 100644 --- a/mail/touch.c +++ b/mail/touch.c @@ -30,11 +30,7 @@ touch0 (msgset_t *mspec, mu_message_t msg, void *data) mu_attribute_t attr = NULL; mu_message_get_attribute (msg, &attr); - if (!mu_attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED)) - { - mu_attribute_set_userflag (attr, MAIL_ATTRIBUTE_MBOXED); - util_mark_read (msg); - } + mu_attribute_set_userflag (attr, MAIL_ATTRIBUTE_TOUCHED); set_cursor (mspec->msg_part[0]); return 0; diff --git a/mail/undelete.c b/mail/undelete.c index 1db365fc5..e877394c0 100644 --- a/mail/undelete.c +++ b/mail/undelete.c @@ -29,6 +29,8 @@ undelete0 (msgset_t *mspec, mu_message_t msg, void *data) mu_message_get_attribute (msg, &attr); mu_attribute_unset_deleted (attr); + mu_attribute_unset_userflag (attr, MAIL_ATTRIBUTE_PRESERVED); + mu_attribute_unset_userflag (attr, MAIL_ATTRIBUTE_MBOXED); util_mark_read (msg); cond_page_invalidate (mspec->msg_part[0]); |