Commit fc7b659d fc7b659d0271b98cd58546e00299c564f9562537 by Sergey Poznyakoff

(imap4d_status): Flush attributes before opening the mailbox.

(status_unseen): Remove superfluous condition
Fixes [bug #15143].
1 parent 0ef983f4
...@@ -75,6 +75,10 @@ imap4d_status (struct imap4d_command *command, char *arg) ...@@ -75,6 +75,10 @@ imap4d_status (struct imap4d_command *command, char *arg)
75 if (!mailbox_name) 75 if (!mailbox_name)
76 return util_finish (command, RESP_NO, "Error opening mailbox"); 76 return util_finish (command, RESP_NO, "Error opening mailbox");
77 77
78 /* We may be opening the current mailbox, so make sure the attributes are
79 preserved */
80 mu_mailbox_save_attributes (mbox);
81
78 status = mu_mailbox_create_default (&smbox, mailbox_name); 82 status = mu_mailbox_create_default (&smbox, mailbox_name);
79 if (status == 0) 83 if (status == 0)
80 { 84 {
...@@ -83,7 +87,7 @@ imap4d_status (struct imap4d_command *command, char *arg) ...@@ -83,7 +87,7 @@ imap4d_status (struct imap4d_command *command, char *arg)
83 { 87 {
84 char item[32]; 88 char item[32];
85 item[0] = '\0'; 89 item[0] = '\0';
86 90
87 if (*sp == '(') 91 if (*sp == '(')
88 sp++; 92 sp++;
89 else 93 else
...@@ -180,7 +184,11 @@ status_unseen (mu_mailbox_t smbox) ...@@ -180,7 +184,11 @@ status_unseen (mu_mailbox_t smbox)
180 mu_attribute_t attr = NULL; 184 mu_attribute_t attr = NULL;
181 mu_mailbox_get_message (smbox, i, &msg); 185 mu_mailbox_get_message (smbox, i, &msg);
182 mu_message_get_attribute (msg, &attr); 186 mu_message_get_attribute (msg, &attr);
183 if (!mu_attribute_is_seen (attr) && !mu_attribute_is_read (attr)) 187 /* RFC 3501:
188 \Seen
189 Message has been read
190 */
191 if (!mu_attribute_is_read (attr))
184 unseen++; 192 unseen++;
185 } 193 }
186 util_send ("UNSEEN %d", unseen); 194 util_send ("UNSEEN %d", unseen);
......