(imap4d_close): Return NO on failure.
Showing
1 changed file
with
22 additions
and
8 deletions
1 | /* GNU Mailutils -- a suite of utilities for electronic mail | 1 | /* GNU Mailutils -- a suite of utilities for electronic mail |
2 | Copyright (C) 1999, 2001 Free Software Foundation, Inc. | 2 | Copyright (C) 1999, 2001, 2004 Free Software Foundation, Inc. |
3 | 3 | ||
4 | GNU Mailutils is free software; you can redistribute it and/or modify | 4 | GNU Mailutils is free software; you can redistribute it and/or modify |
5 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
... | @@ -20,17 +20,31 @@ | ... | @@ -20,17 +20,31 @@ |
20 | /* | 20 | /* |
21 | */ | 21 | */ |
22 | 22 | ||
23 | /* The CLOSE command permanently removes from the currently selected | ||
24 | mailbox all messages that have the \\Deleted flag set, and returns | ||
25 | to authenticated state from selected state. */ | ||
23 | int | 26 | int |
24 | imap4d_close (struct imap4d_command *command, char *arg ARG_UNUSED) | 27 | imap4d_close (struct imap4d_command *command, char *arg ARG_UNUSED) |
25 | { | 28 | { |
26 | /* FIXME: Check and report errors. */ | 29 | const char *msg = NULL; |
27 | /* The CLOSE command permanently removes from the currently selected | 30 | int status = mailbox_flush (mbox, 1); |
28 | mailbox all messages that have the \\Deleted flag set, and returns | 31 | if (status) |
29 | to authenticated state from selected state. */ | 32 | { |
30 | mailbox_flush (mbox, 1); | 33 | syslog (LOG_ERR, _("flushing mailbox failed: %s"), mu_strerror (status)); |
31 | /* No messages are removed, and no error is give, if the mailbox is | 34 | msg = "flushing mailbox failed"; |
35 | } | ||
36 | |||
37 | /* No messages are removed, and no error is given, if the mailbox is | ||
32 | selected by an EXAMINE command or is otherwise selected read-only. */ | 38 | selected by an EXAMINE command or is otherwise selected read-only. */ |
33 | mailbox_close (mbox); | 39 | status = mailbox_close (mbox); |
40 | if (status) | ||
41 | { | ||
42 | syslog (LOG_ERR, _("closing mailbox failed: %s"), mu_strerror (status)); | ||
43 | msg = "closing mailbox failed"; | ||
44 | } | ||
34 | mailbox_destroy (&mbox); | 45 | mailbox_destroy (&mbox); |
46 | |||
47 | if (msg) | ||
48 | util_finish (command, RESP_NO, msg); | ||
35 | return util_finish (command, RESP_OK, "Completed"); | 49 | return util_finish (command, RESP_OK, "Completed"); |
36 | } | 50 | } | ... | ... |
-
Please register or sign in to post a comment