changeset 7621:bec7141872eb HEAD

Added support for ENABLE extension.
author Timo Sirainen <tss@iki.fi>
date Thu, 13 Mar 2008 15:16:57 +0200
parents 4b8c1c164d8f
children 23bbefd2ef4e
files configure.in src/imap/Makefile.am src/imap/cmd-enable.c src/imap/commands.c src/imap/commands.h
diffstat 5 files changed, 37 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/configure.in	Sat Mar 15 09:59:56 2008 +0200
+++ b/configure.in	Thu Mar 13 15:16:57 2008 +0200
@@ -2119,7 +2119,7 @@
 dnl ** capabilities
 dnl **
 
-capability="IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS UIDPLUS LIST-EXTENDED I18NLEVEL=1"
+capability="IMAP4rev1 SASL-IR SORT THREAD=REFERENCES MULTIAPPEND UNSELECT LITERAL+ IDLE CHILDREN NAMESPACE LOGIN-REFERRALS UIDPLUS LIST-EXTENDED I18NLEVEL=1 ENABLE"
 AC_DEFINE_UNQUOTED(CAPABILITY_STRING, "$capability", IMAP capabilities)
 
 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
--- a/src/imap/Makefile.am	Sat Mar 15 09:59:56 2008 +0200
+++ b/src/imap/Makefile.am	Thu Mar 13 15:16:57 2008 +0200
@@ -45,6 +45,7 @@
 	cmd-copy.c \
 	cmd-create.c \
 	cmd-delete.c \
+	cmd-enable.c \
 	cmd-examine.c \
 	cmd-expunge.c \
 	cmd-fetch.c \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/imap/cmd-enable.c	Thu Mar 13 15:16:57 2008 +0200
@@ -0,0 +1,33 @@
+/* Copyright (c) 2003-2008 Dovecot authors, see the included COPYING file */
+
+#include "common.h"
+#include "str.h"
+
+bool cmd_enable(struct client_command_context *cmd)
+{
+	const struct imap_arg *args;
+	const char *str;
+	string_t *reply;
+
+	if (!client_read_args(cmd, 0, 0, &args))
+		return FALSE;
+
+	reply = t_str_new(64);
+	str_append(reply, "* ENABLED");
+	for (; args->type != IMAP_ARG_EOL; args++) {
+		if (args->type != IMAP_ARG_ATOM) {
+			client_send_command_error(cmd, "Invalid arguments.");
+			return TRUE;
+		}
+		str = t_str_ucase(IMAP_ARG_STR(args));
+		if (strcmp(str, "CONDSTORE") == 0) {
+			client_enable(cmd->client, MAILBOX_FEATURE_CONDSTORE);
+			str_append(reply, " CONDSTORE");
+		}
+	}
+	if (str_len(reply) > 9)
+		client_send_line(cmd->client, str_c(reply));
+	client_send_tagline(cmd, "OK Enabled.");
+	return TRUE;
+}
+
--- a/src/imap/commands.c	Sat Mar 15 09:59:56 2008 +0200
+++ b/src/imap/commands.c	Thu Mar 13 15:16:57 2008 +0200
@@ -41,6 +41,7 @@
 #define IMAP4REV1_COMMANDS_COUNT N_ELEMENTS(imap4rev1_commands)
 
 const struct command imap_ext_commands[] = {
+	{ "ENABLE",		cmd_enable,      0 },
 	{ "IDLE",		cmd_idle,        COMMAND_FLAG_BREAKS_SEQS },
 	{ "NAMESPACE",		cmd_namespace,   0 },
 	{ "SORT",		cmd_sort,        COMMAND_FLAG_USES_SEQS },
--- a/src/imap/commands.h	Sat Mar 15 09:59:56 2008 +0200
+++ b/src/imap/commands.h	Thu Mar 13 15:16:57 2008 +0200
@@ -77,6 +77,7 @@
 bool cmd_uid(struct client_command_context *cmd);
 
 /* IMAP extensions: */
+bool cmd_enable(struct client_command_context *cmd);
 bool cmd_idle(struct client_command_context *cmd);
 bool cmd_namespace(struct client_command_context *cmd);
 bool cmd_sort(struct client_command_context *cmd);