Commit 4befbf28 4befbf286418c563dfdd553196e78be7a5169e50 by Sergey Poznyakoff

use mailbox_save_attributes(). Implemented "hold" variable. Raise MU_ATTRIBUTE_R…

…EAD on every message with MU_ATTRIBUTE_SEEN
1 parent 8caa1bc1
...@@ -39,12 +39,13 @@ mail_mbox_close () ...@@ -39,12 +39,13 @@ mail_mbox_close ()
39 if (mail_mbox_commit ()) 39 if (mail_mbox_commit ())
40 return 1; 40 return 1;
41 41
42 mailbox_save_attributes (mbox);
42 mailbox_expunge (mbox); 43 mailbox_expunge (mbox);
43 44
44 mailbox_get_url (mbox, &url); 45 mailbox_get_url (mbox, &url);
45 mailbox_messages_count (mbox, &held_count); 46 mailbox_messages_count (mbox, &held_count);
46 fprintf (ofile, "Held %d messages in %s\n", held_count, url_to_string (url)); 47 fprintf (ofile, "Held %d messages in %s\n", held_count, url_to_string (url));
47 48
48 mailbox_close (mbox); 49 mailbox_close (mbox);
49 mailbox_destroy (&mbox); 50 mailbox_destroy (&mbox);
50 return 0; 51 return 0;
...@@ -59,7 +60,8 @@ mail_mbox_commit () ...@@ -59,7 +60,8 @@ mail_mbox_commit ()
59 message_t msg; 60 message_t msg;
60 attribute_t attr; 61 attribute_t attr;
61 int keepsave = util_find_env("keepsave")->set; 62 int keepsave = util_find_env("keepsave")->set;
62 63 int hold = util_find_env ("hold")->set;
64
63 for (i = 1; i <= total; i++) 65 for (i = 1; i <= total; i++)
64 { 66 {
65 if (mailbox_get_message (mbox, i, &msg)) 67 if (mailbox_get_message (mbox, i, &msg))
...@@ -68,7 +70,8 @@ mail_mbox_commit () ...@@ -68,7 +70,8 @@ mail_mbox_commit ()
68 return 1; 70 return 1;
69 } 71 }
70 message_get_attribute (msg, &attr); 72 message_get_attribute (msg, &attr);
71 if (attribute_is_userflag (attr, MAIL_ATTRIBUTE_MBOXED)) 73 if (attribute_is_userflag (attr, MAIL_ATTRIBUTE_MBOXED)
74 || (!hold && attribute_is_seen (attr)))
72 { 75 {
73 if (!dest_mbox) 76 if (!dest_mbox)
74 { 77 {
...@@ -88,9 +91,9 @@ mail_mbox_commit () ...@@ -88,9 +91,9 @@ mail_mbox_commit ()
88 saved_count++; 91 saved_count++;
89 } 92 }
90 else if (!keepsave && attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED)) 93 else if (!keepsave && attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED))
91 { 94 attribute_set_deleted (attr);
92 attribute_set_deleted (attr); 95 else if (attribute_is_seen (attr))
93 } 96 attribute_set_read (attr);
94 } 97 }
95 98
96 if (saved_count) 99 if (saved_count)
......