Mercurial > dovecot > core-2.2
changeset 1021:81cbc1467097 HEAD
Added support for UNSELECT extension with some cleanups for SELECT and CLOSE.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Wed, 22 Jan 2003 22:46:36 +0200 |
parents | d3c7e5f7041c |
children | 09bac2875ed8 |
files | configure.in src/imap/Makefile.am src/imap/cmd-close.c src/imap/cmd-select.c src/imap/commands-util.c src/imap/commands-util.h src/imap/commands.c src/imap/commands.h |
diffstat | 8 files changed, 25 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/configure.in Wed Jan 22 22:34:52 2003 +0200 +++ b/configure.in Wed Jan 22 22:46:36 2003 +0200 @@ -792,7 +792,7 @@ dnl ** capabilities dnl ** -capability="IMAP4rev1 SORT THREAD=REFERENCES MULTIAPPEND" +capability="IMAP4rev1 SORT THREAD=REFERENCES MULTIAPPEND UNSELECT" AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", IMAP capabilities) dnl **
--- a/src/imap/Makefile.am Wed Jan 22 22:34:52 2003 +0200 +++ b/src/imap/Makefile.am Wed Jan 22 22:46:36 2003 +0200 @@ -49,6 +49,7 @@ cmd-subscribe.c \ cmd-thread.c \ cmd-uid.c \ + cmd-unselect.c \ cmd-unsubscribe.c imap_SOURCES = \
--- a/src/imap/cmd-close.c Wed Jan 22 22:34:52 2003 +0200 +++ b/src/imap/cmd-close.c Wed Jan 22 22:46:36 2003 +0200 @@ -3,26 +3,16 @@ #include "common.h" #include "commands.h" -static void client_send_untagged_storage_error(struct client *client) -{ - const char *error; - int syntax; - - error = client->storage->get_last_error(client->storage, &syntax); - client_send_line(client, - t_strconcat(syntax ? "* BAD " : "* NO ", error, NULL)); -} - int cmd_close(struct client *client) { if (!client_verify_open_mailbox(client)) return TRUE; if (!client->mailbox->expunge(client->mailbox, FALSE)) - client_send_untagged_storage_error(client); + client_send_closing_mailbox_error(client); if (!client->mailbox->close(client->mailbox)) - client_send_untagged_storage_error(client); + client_send_closing_mailbox_error(client); client->mailbox = NULL;
--- a/src/imap/cmd-select.c Wed Jan 22 22:34:52 2003 +0200 +++ b/src/imap/cmd-select.c Wed Jan 22 22:46:36 2003 +0200 @@ -14,7 +14,8 @@ return FALSE; if (client->mailbox != NULL) { - client->mailbox->close(client->mailbox); + if (!client->mailbox->close(client->mailbox)) + client_send_closing_mailbox_error(client); client->mailbox = NULL; }
--- a/src/imap/commands-util.c Wed Jan 22 22:34:52 2003 +0200 +++ b/src/imap/commands-util.c Wed Jan 22 22:46:36 2003 +0200 @@ -121,6 +121,16 @@ error, NULL)); } +void client_send_closing_mailbox_error(struct client *client) +{ + const char *error; + int syntax; + + error = client->storage->get_last_error(client->storage, &syntax); + client_send_line(client, + t_strconcat(syntax ? "* BAD " : "* NO ", error, NULL)); +} + int client_parse_mail_flags(struct client *client, struct imap_arg *args, struct mail_full_flags *flags) { @@ -131,8 +141,7 @@ max_flags = MAIL_CUSTOM_FLAGS_COUNT; memset(flags, 0, sizeof(*flags)); - flags->custom_flags = flags->custom_flags_count == 0 ? NULL : - t_new(const char *, flags->custom_flags_count); + flags->custom_flags = t_new(const char *, max_flags); flag_pos = 0; while (args->type != IMAP_ARG_EOL) {
--- a/src/imap/commands-util.h Wed Jan 22 22:34:52 2003 +0200 +++ b/src/imap/commands-util.h Wed Jan 22 22:46:36 2003 +0200 @@ -24,6 +24,10 @@ /* Send last mail storage error message to client. */ void client_send_storage_error(struct client *client); +/* Send untagged error message to client. Doesn't check for inconsistency, + so should be called only by CLOSE, SELECT and UNSELECT. */ +void client_send_closing_mailbox_error(struct client *client); + /* Parse flags. Returns TRUE if successful, if not sends an error message to client. */ int client_parse_mail_flags(struct client *client, struct imap_arg *args,
--- a/src/imap/commands.c Wed Jan 22 22:34:52 2003 +0200 +++ b/src/imap/commands.c Wed Jan 22 22:46:36 2003 +0200 @@ -82,6 +82,9 @@ return cmd_uid; if (strcmp(name, "UNSUBSCRIBE") == 0) return cmd_unsubscribe; + if (strcmp(name, "UNSELECT") == 0) + return cmd_unselect; + break; }
--- a/src/imap/commands.h Wed Jan 22 22:34:52 2003 +0200 +++ b/src/imap/commands.h Wed Jan 22 22:46:36 2003 +0200 @@ -42,6 +42,7 @@ int cmd_store(struct client *client); int cmd_copy(struct client *client); int cmd_uid(struct client *client); +int cmd_unselect(struct client *client); /* private: */ int _cmd_list_full(struct client *client, int subscribed);