Commit 814b74eb 814b74eb4044bffa0c7c6c06ca986017f9128dee by Sergey Poznyakoff

Raise hold flag when not closing system mailbox (%).

1 parent bca90bac
...@@ -61,6 +61,25 @@ mail_mbox_commit () ...@@ -61,6 +61,25 @@ mail_mbox_commit ()
61 attribute_t attr; 61 attribute_t attr;
62 int keepsave = util_find_env("keepsave")->set; 62 int keepsave = util_find_env("keepsave")->set;
63 int hold = util_find_env ("hold")->set; 63 int hold = util_find_env ("hold")->set;
64 url_t url;
65 int is_user_mbox;
66
67 mailbox_get_url (mbox, &url);
68 is_user_mbox = strcmp (url_to_string (url), getenv("MBOX")) == 0;
69
70 {
71 mailbox_t mb;
72 url_t u;
73 mailbox_create_default (&mb, NULL);
74 mailbox_get_url (mbox, &u);
75 if (strcmp (url_to_string (u), url_to_string (url)) != 0)
76 {
77 /* The mailbox we are closing is not a system one (%). Raise
78 hold flag */
79 hold = 1;
80 }
81 mailbox_destroy (&mb);
82 }
64 83
65 for (i = 1; i <= total; i++) 84 for (i = 1; i <= total; i++)
66 { 85 {
...@@ -70,8 +89,10 @@ mail_mbox_commit () ...@@ -70,8 +89,10 @@ mail_mbox_commit ()
70 return 1; 89 return 1;
71 } 90 }
72 message_get_attribute (msg, &attr); 91 message_get_attribute (msg, &attr);
73 if (attribute_is_userflag (attr, MAIL_ATTRIBUTE_MBOXED) 92
74 || (!hold && attribute_is_seen (attr))) 93 if (!is_user_mbox &&
94 (attribute_is_userflag (attr, MAIL_ATTRIBUTE_MBOXED)
95 || (!hold && attribute_is_read (attr))))
75 { 96 {
76 if (!dest_mbox) 97 if (!dest_mbox)
77 { 98 {
...@@ -92,8 +113,8 @@ mail_mbox_commit () ...@@ -92,8 +113,8 @@ mail_mbox_commit ()
92 } 113 }
93 else if (!keepsave && attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED)) 114 else if (!keepsave && attribute_is_userflag (attr, MAIL_ATTRIBUTE_SAVED))
94 attribute_set_deleted (attr); 115 attribute_set_deleted (attr);
95 else if (attribute_is_seen (attr)) 116 else if (attribute_is_read (attr))
96 attribute_set_read (attr); 117 attribute_set_seen (attr);
97 } 118 }
98 119
99 if (saved_count) 120 if (saved_count)
......