Commit 58cf1c6b 58cf1c6bdbdbfd26816211b594a1954a117fc460 by Sergey Poznyakoff

Use mailbox_flush before closing the mailbox

1 parent 74f306ab
...@@ -34,7 +34,7 @@ imap4d_bye0 (int reason, struct imap4d_command *command) ...@@ -34,7 +34,7 @@ imap4d_bye0 (int reason, struct imap4d_command *command)
34 34
35 if (mbox) 35 if (mbox)
36 { 36 {
37 mailbox_save_attributes (mbox); 37 mailbox_flush (mbox, 0);
38 mailbox_close (mbox); 38 mailbox_close (mbox);
39 mailbox_destroy (&mbox); 39 mailbox_destroy (&mbox);
40 } 40 }
...@@ -48,7 +48,7 @@ imap4d_bye0 (int reason, struct imap4d_command *command) ...@@ -48,7 +48,7 @@ imap4d_bye0 (int reason, struct imap4d_command *command)
48 48
49 case ERR_SIGNAL: 49 case ERR_SIGNAL:
50 if (ofile) 50 if (ofile)
51 util_out (RESP_BYE, "Quitting on signal"); 51 util_out (RESP_BYE, "Quitting on signal");
52 syslog (LOG_ERR, "Quitting on signal"); 52 syslog (LOG_ERR, "Quitting on signal");
53 break; 53 break;
54 54
......
...@@ -30,7 +30,7 @@ imap4d_close (struct imap4d_command *command, char *arg) ...@@ -30,7 +30,7 @@ imap4d_close (struct imap4d_command *command, char *arg)
30 /* The CLOSE command permanently removes from the currently selected 30 /* The CLOSE command permanently removes from the currently selected
31 mailbox all messages that have the \\Deleted flag set, and returns 31 mailbox all messages that have the \\Deleted flag set, and returns
32 to authenticated state from selected state. */ 32 to authenticated state from selected state. */
33 mailbox_expunge (mbox); 33 mailbox_flush (mbox, 1);
34 /* No messages are removed, and no error is give, if the mailbox is 34 /* No messages are removed, and no error is give, if the mailbox is
35 selected by an EXAMINE command or is otherwise selected read-only. */ 35 selected by an EXAMINE command or is otherwise selected read-only. */
36 mailbox_close (mbox); 36 mailbox_close (mbox);
......
...@@ -42,8 +42,7 @@ mail_mbox_close () ...@@ -42,8 +42,7 @@ mail_mbox_close ()
42 if (mail_mbox_commit ()) 42 if (mail_mbox_commit ())
43 return 1; 43 return 1;
44 44
45 mailbox_save_attributes (mbox); 45 mailbox_flush (mbox, 1);
46 mailbox_expunge (mbox);
47 } 46 }
48 47
49 mailbox_get_url (mbox, &url); 48 mailbox_get_url (mbox, &url);
...@@ -69,7 +68,7 @@ mail_mbox_commit () ...@@ -69,7 +68,7 @@ mail_mbox_commit ()
69 int is_user_mbox; 68 int is_user_mbox;
70 69
71 mailbox_get_url (mbox, &url); 70 mailbox_get_url (mbox, &url);
72 is_user_mbox = strcmp (url_to_string (url), getenv("MBOX")) == 0; 71 is_user_mbox = strcmp (url_to_string (url), getenv ("MBOX")) == 0;
73 72
74 { 73 {
75 mailbox_t mb; 74 mailbox_t mb;
......
...@@ -33,7 +33,7 @@ pop3d_quit (const char *arg) ...@@ -33,7 +33,7 @@ pop3d_quit (const char *arg)
33 if (state == TRANSACTION) 33 if (state == TRANSACTION)
34 { 34 {
35 pop3d_unlock (); 35 pop3d_unlock ();
36 if (mailbox_expunge (mbox) != 0) 36 if (mailbox_flush (mbox, 1) != 0)
37 err = ERR_FILE; 37 err = ERR_FILE;
38 if (mailbox_close (mbox) != 0) 38 if (mailbox_close (mbox) != 0)
39 err = ERR_FILE; 39 err = ERR_FILE;
......