[dovecot-cvs] dovecot/src/imap Makefile.am,1.11,1.12 cmd-close.c,1.5,1.6 cmd-select.c,1.13,1.14 commands-util.c,1.17,1.18 commands-util.h,1.7,1.8 commands.c,1.6,1.7 commands.h,1.6,1.7
cras at procontrol.fi
cras at procontrol.fi
Wed Jan 22 22:46:39 EET 2003
Update of /home/cvs/dovecot/src/imap
In directory danu:/tmp/cvs-serv24299/src/imap
Modified Files:
Makefile.am cmd-close.c cmd-select.c commands-util.c
commands-util.h commands.c commands.h
Log Message:
Added support for UNSELECT extension with some cleanups for SELECT and CLOSE.
Index: Makefile.am
===================================================================
RCS file: /home/cvs/dovecot/src/imap/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Makefile.am 20 Jan 2003 14:52:51 -0000 1.11
+++ Makefile.am 22 Jan 2003 20:46:36 -0000 1.12
@@ -49,6 +49,7 @@
cmd-subscribe.c \
cmd-thread.c \
cmd-uid.c \
+ cmd-unselect.c \
cmd-unsubscribe.c
imap_SOURCES = \
Index: cmd-close.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-close.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cmd-close.c 5 Jan 2003 13:09:51 -0000 1.5
+++ cmd-close.c 22 Jan 2003 20:46:36 -0000 1.6
@@ -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;
Index: cmd-select.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/cmd-select.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- cmd-select.c 21 Jan 2003 05:37:35 -0000 1.13
+++ cmd-select.c 22 Jan 2003 20:46:36 -0000 1.14
@@ -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;
}
Index: commands-util.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/commands-util.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- commands-util.c 21 Jan 2003 11:20:14 -0000 1.17
+++ commands-util.c 22 Jan 2003 20:46:36 -0000 1.18
@@ -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) {
Index: commands-util.h
===================================================================
RCS file: /home/cvs/dovecot/src/imap/commands-util.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- commands-util.h 20 Jan 2003 14:52:51 -0000 1.7
+++ commands-util.h 22 Jan 2003 20:46:36 -0000 1.8
@@ -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,
Index: commands.c
===================================================================
RCS file: /home/cvs/dovecot/src/imap/commands.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- commands.c 11 Jan 2003 19:55:56 -0000 1.6
+++ commands.c 22 Jan 2003 20:46:36 -0000 1.7
@@ -82,6 +82,9 @@
return cmd_uid;
if (strcmp(name, "UNSUBSCRIBE") == 0)
return cmd_unsubscribe;
+ if (strcmp(name, "UNSELECT") == 0)
+ return cmd_unselect;
+
break;
}
Index: commands.h
===================================================================
RCS file: /home/cvs/dovecot/src/imap/commands.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- commands.h 11 Jan 2003 19:55:56 -0000 1.6
+++ commands.h 22 Jan 2003 20:46:36 -0000 1.7
@@ -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);
More information about the dovecot-cvs
mailing list