dovecot-2.2: dict: If DICT_ITERATE_FLAG_NO_VALUE is set, don't s...

dovecot at dovecot.org dovecot at dovecot.org
Sat Oct 13 04:28:25 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/dc3a95fe330b
changeset: 15223:dc3a95fe330b
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Oct 13 04:18:26 2012 +0300
description:
dict: If DICT_ITERATE_FLAG_NO_VALUE is set, don't send values to dict client.

diffstat:

 src/dict/dict-commands.c   |  7 +++++--
 src/dict/dict-connection.h |  1 +
 2 files changed, 6 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r e7f10acf65e3 -r dc3a95fe330b src/dict/dict-commands.c
--- a/src/dict/dict-commands.c	Sat Oct 13 04:17:45 2012 +0300
+++ b/src/dict/dict-commands.c	Sat Oct 13 04:18:26 2012 +0300
@@ -53,8 +53,10 @@
 	o_stream_cork(conn->output);
 	while (dict_iterate(conn->iter_ctx, &key, &value)) {
 		str_truncate(str, 0);
-		str_printfa(str, "%c%s\t%s\n", DICT_PROTOCOL_REPLY_OK,
-			    key, value);
+		str_printfa(str, "%c%s\t", DICT_PROTOCOL_REPLY_OK, key);
+		if ((conn->iter_flags & DICT_ITERATE_FLAG_NO_VALUE) == 0)
+			str_append(str, value);
+		str_append_c(str, '\n');
 		o_stream_nsend(conn->output, str_data(str), str_len(str));
 
 		if (o_stream_get_buffer_used_size(conn->output) >
@@ -99,6 +101,7 @@
 
 	/* <flags> <path> */
 	conn->iter_ctx = dict_iterate_init_multiple(conn->dict, args+1, flags);
+	conn->iter_flags = flags;
 
 	o_stream_set_flush_callback(conn->output, cmd_iterate_flush, conn);
 	(void)cmd_iterate_flush(conn);
diff -r e7f10acf65e3 -r dc3a95fe330b src/dict/dict-connection.h
--- a/src/dict/dict-connection.h	Sat Oct 13 04:17:45 2012 +0300
+++ b/src/dict/dict-connection.h	Sat Oct 13 04:18:26 2012 +0300
@@ -24,6 +24,7 @@
 	struct ostream *output;
 
 	struct dict_iterate_context *iter_ctx;
+	enum dict_iterate_flags iter_flags;
 
 	/* There are only a few transactions per client, so keeping them in
 	   array is fast enough */


More information about the dovecot-cvs mailing list