dovecot-2.2: dict server: Implemented APPEND command.

dovecot at dovecot.org dovecot at dovecot.org
Wed Aug 15 09:35:54 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/51043aa5fe98
changeset: 14903:51043aa5fe98
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Aug 15 09:35:39 2012 +0300
description:
dict server: Implemented APPEND command.

diffstat:

 src/dict/dict-commands.c |  20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diffs (37 lines):

diff -r 3ff9acd8080e -r 51043aa5fe98 src/dict/dict-commands.c
--- a/src/dict/dict-commands.c	Wed Aug 15 09:35:21 2012 +0300
+++ b/src/dict/dict-commands.c	Wed Aug 15 09:35:39 2012 +0300
@@ -304,6 +304,25 @@
 	return 0;
 }
 
+static int cmd_append(struct dict_connection *conn, const char *line)
+{
+	struct dict_connection_transaction *trans;
+	const char *const *args;
+
+	/* <id> <key> <value> */
+	args = t_strsplit_tab(line);
+	if (str_array_length(args) != 3) {
+		i_error("dict client: APPEND: broken input");
+		return -1;
+	}
+
+	if (dict_connection_transaction_lookup_parse(conn, args[0], &trans) < 0)
+		return -1;
+
+        dict_append(trans->ctx, args[1], args[2]);
+	return 0;
+}
+
 static int cmd_atomic_inc(struct dict_connection *conn, const char *line)
 {
 	struct dict_connection_transaction *trans;
@@ -334,6 +353,7 @@
 	{ DICT_PROTOCOL_CMD_ROLLBACK, cmd_rollback },
 	{ DICT_PROTOCOL_CMD_SET, cmd_set },
 	{ DICT_PROTOCOL_CMD_UNSET, cmd_unset },
+	{ DICT_PROTOCOL_CMD_APPEND, cmd_append },
 	{ DICT_PROTOCOL_CMD_ATOMIC_INC, cmd_atomic_inc },
 
 	{ 0, NULL }


More information about the dovecot-cvs mailing list