dovecot-2.2: Use imap_append_*string() instead of imap_quote_app...

dovecot at dovecot.org dovecot at dovecot.org
Wed Oct 24 10:14:29 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/ff86acd4eef5
changeset: 15244:ff86acd4eef5
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Oct 24 09:39:52 2012 +0300
description:
Use imap_append_*string() instead of imap_quote_append*() where possible.
This makes it clearer what types of output should be sent.

diffstat:

 src/imap-login/imap-proxy.c                |   5 ++---
 src/imap/cmd-list.c                        |  11 ++++-------
 src/imap/cmd-namespace.c                   |   2 +-
 src/imap/cmd-notify.c                      |   2 +-
 src/imap/imap-fetch.c                      |   4 ++--
 src/imap/imap-notify.c                     |   4 ++--
 src/imap/imap-search.c                     |   4 ++--
 src/imap/imap-status.c                     |   2 +-
 src/imap/imap-sync.c                       |   2 +-
 src/lib-imap/imap-id.c                     |   6 +-----
 src/plugins/imap-acl/imap-acl-plugin.c     |  10 +++++-----
 src/plugins/imap-quota/imap-quota-plugin.c |   6 +++---
 12 files changed, 25 insertions(+), 33 deletions(-)

diffs (243 lines):

diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/imap-login/imap-proxy.c
--- a/src/imap-login/imap-proxy.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/imap-login/imap-proxy.c	Wed Oct 24 09:39:52 2012 +0300
@@ -75,10 +75,9 @@
 	if (client->common.proxy_master_user == NULL) {
 		/* logging in normally - use LOGIN command */
 		str_append(str, "L LOGIN ");
-		imap_quote_append_string(str, client->common.proxy_user, FALSE);
+		imap_append_string(str, client->common.proxy_user);
 		str_append_c(str, ' ');
-		imap_quote_append_string(str, client->common.proxy_password,
-					 FALSE);
+		imap_append_string(str, client->common.proxy_password);
 
 		proxy_free_password(&client->common);
 	} else if (client->proxy_sasl_ir) {
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/imap/cmd-list.c
--- a/src/imap/cmd-list.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/imap/cmd-list.c	Wed Oct 24 09:39:52 2012 +0300
@@ -249,7 +249,7 @@
 		list_reply_append_ns_sep_param(str,
 			mail_namespace_get_sep(info->ns));
 		str_append_c(str, ' ');
-		imap_quote_append_string(str, str_c(mutf7_name), FALSE);
+		imap_append_string(str, str_c(mutf7_name));
 		mailbox_childinfo2str(ctx, str, flags);
 
 		ret = client_send_line_next(ctx->cmd->client, str_c(str));
@@ -333,7 +333,7 @@
 	str_printfa(str, "%c\" ", ns_sep);
 	if (*ns_prefix != '\0') {
 		/* non-hidden namespace, use it as the root name */
-		imap_quote_append_string(str, ns_prefix, FALSE);
+		imap_append_string(str, ns_prefix);
 	} else {
 		/* Hidden namespace or empty namespace prefix. We could just
 		   return an empty root name, but it's safer to emulate what
@@ -343,11 +343,8 @@
 
 		if (p == NULL)
 			str_append(str, "\"\"");
-		else {
-			imap_quote_append_string(str,
-						 t_strdup_until(ref, p + 1),
-						 FALSE);
-		}
+		else
+			imap_append_string(str, t_strdup_until(ref, p + 1));
 	}
 	client_send_line(client, str_c(str));
 }
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/imap/cmd-namespace.c
--- a/src/imap/cmd-namespace.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/imap/cmd-namespace.c	Wed Oct 24 09:39:52 2012 +0300
@@ -30,7 +30,7 @@
 					ns->prefix);
 			}
 
-			imap_quote_append_string(str, str_c(mutf7_prefix), FALSE);
+			imap_append_string(str, str_c(mutf7_prefix));
 			str_append(str, " \"");
 			if (ns_sep == '\\')
 				str_append_c(str, '\\');
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/imap/cmd-notify.c
--- a/src/imap/cmd-notify.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/imap/cmd-notify.c	Wed Oct 24 09:39:52 2012 +0300
@@ -365,7 +365,7 @@
 	str_append_c(str, ns_sep);
 	str_append(str, "\" ");
 
-	imap_quote_append_string(str, mailbox_get_vname(box), FALSE);
+	imap_append_string(str, mailbox_get_vname(box));
 	client_send_line(client, str_c(str));
 }
 
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/imap/imap-fetch.c	Wed Oct 24 09:39:52 2012 +0300
@@ -833,7 +833,7 @@
 		return -1;
 
 	str_append(ctx->state.cur_str, "X-GUID ");
-	imap_quote_append_string(ctx->state.cur_str, value, FALSE);
+	imap_append_string(ctx->state.cur_str, value);
 	str_append_c(ctx->state.cur_str, ' ');
 	return 1;
 }
@@ -860,7 +860,7 @@
 		i_panic("FETCH: Mailbox name not UTF-8: %s", name);
 
 	str_append(ctx->state.cur_str, "X-MAILBOX ");
-	imap_quote_append_string(ctx->state.cur_str, str_c(mutf7_name), FALSE);
+	imap_append_string(ctx->state.cur_str, str_c(mutf7_name));
 	str_append_c(ctx->state.cur_str, ' ');
 	return 1;
 }
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/imap/imap-notify.c
--- a/src/imap/imap-notify.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/imap/imap-notify.c	Wed Oct 24 09:39:52 2012 +0300
@@ -33,10 +33,10 @@
 	str_append_c(str, ns_sep);
 	str_append(str, "\" ");
 
-	imap_quote_append_string(str, rec->vname, FALSE);
+	imap_append_string(str, rec->vname);
 	if (rec->old_vname != NULL) {
 		str_append(str, " (\"OLDNAME\" (");
-		imap_quote_append_string(str, rec->old_vname, FALSE);
+		imap_append_string(str, rec->old_vname);
 		str_append(str, "))");
 	}
 	return client_send_line_next(notify_ns->ctx->client, str_c(str));
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/imap/imap-search.c
--- a/src/imap/imap-search.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/imap/imap-search.c	Wed Oct 24 09:39:52 2012 +0300
@@ -178,7 +178,7 @@
 		/* too many updates */
 		string_t *str = t_str_new(256);
 		str_append(str, "* NO [NOUPDATE ");
-		imap_quote_append_string(str, ctx->cmd->tag, FALSE);
+		imap_append_quoted(str, ctx->cmd->tag);
 		str_append_c(str, ']');
 		client_send_line(client, str_c(str));
 		ctx->return_options &= ~SEARCH_RETURN_UPDATE;
@@ -318,7 +318,7 @@
 
 	str = str_new(default_pool, 1024);
 	str_append(str, "* ESEARCH (TAG ");
-	imap_quote_append_string(str, ctx->cmd->tag, FALSE);
+	imap_append_string(str, ctx->cmd->tag);
 	str_append_c(str, ')');
 
 	if (ctx->cmd->uid)
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/imap/imap-status.c
--- a/src/imap/imap-status.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/imap/imap-status.c	Wed Oct 24 09:39:52 2012 +0300
@@ -107,7 +107,7 @@
 
 	str = t_str_new(128);
 	str_append(str, "* STATUS ");
-        imap_quote_append_string(str, mailbox_mutf7, FALSE);
+        imap_append_string(str, mailbox_mutf7);
 	str_append(str, " (");
 
 	prefix_len = str_len(str);
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/imap/imap-sync.c
--- a/src/imap/imap-sync.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/imap/imap-sync.c	Wed Oct 24 09:39:52 2012 +0300
@@ -152,7 +152,7 @@
 
 	cmd = t_str_new(256);
 	str_append(cmd, "* ESEARCH (TAG ");
-	imap_quote_append_string(cmd, update->tag, FALSE);
+	imap_append_string(cmd, update->tag);
 	str_append_c(cmd, ')');
 	if (update->return_uids)
 		str_append(cmd, " UID");
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/lib-imap/imap-id.c
--- a/src/lib-imap/imap-id.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/lib-imap/imap-id.c	Wed Oct 24 09:39:52 2012 +0300
@@ -84,11 +84,7 @@
 				if (strcmp(value, "*") == 0)
 					value = imap_id_get_default(key);
 			}
-
-			if (value == NULL)
-				str_append(str, "NIL");
-			else
-				imap_quote_append_string(str, value, FALSE);
+			imap_append_nstring(str, value);
 		}
 	}
 	if (str_len(str) == 1) {
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/plugins/imap-acl/imap-acl-plugin.c
--- a/src/plugins/imap-acl/imap-acl-plugin.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/plugins/imap-acl/imap-acl-plugin.c	Wed Oct 24 09:39:52 2012 +0300
@@ -163,7 +163,7 @@
 		i_unreached();
 	}
 
-	imap_quote_append(dest, str_data(tmp), str_len(tmp), FALSE);
+	imap_append_string(dest, str_c(tmp));
 	str_append_c(dest, ' ');
 	imap_acl_write_rights_list(dest, rights);
 }
@@ -288,7 +288,7 @@
 
 	str = t_str_new(128);
 	str_append(str, "* ACL ");
-	imap_quote_append_string(str, mailbox, FALSE);
+	imap_append_string(str, mailbox);
 
 	ns = mailbox_get_namespace(box);
 	backend = acl_mailbox_list_get_backend(ns->list);
@@ -347,7 +347,7 @@
 
 	str = t_str_new(128);
 	str_append(str, "* MYRIGHTS ");
-	imap_quote_append_string(str, orig_mailbox, FALSE);
+	imap_append_string(str, orig_mailbox);
 	str_append_c(str,' ');
 	imap_acl_write_rights_list(str, rights);
 
@@ -372,9 +372,9 @@
 
 	str = t_str_new(128);
 	str_append(str, "* LISTRIGHTS ");
-	imap_quote_append_string(str, mailbox, FALSE);
+	imap_append_string(str, mailbox);
 	str_append_c(str, ' ');
-	imap_quote_append_string(str, identifier, FALSE);
+	imap_append_string(str, identifier);
 	str_append_c(str, ' ');
 	str_append(str, "\"\" l r w s t p i e k x a c d");
 
diff -r 62d36b2dcbb6 -r ff86acd4eef5 src/plugins/imap-quota/imap-quota-plugin.c
--- a/src/plugins/imap-quota/imap-quota-plugin.c	Wed Oct 24 09:38:06 2012 +0300
+++ b/src/plugins/imap-quota/imap-quota-plugin.c	Wed Oct 24 09:39:52 2012 +0300
@@ -43,7 +43,7 @@
 
 	str_append(str, "* QUOTA ");
 	name = imap_quota_root_get_name(user, owner, root);
-	imap_quote_append_string(str, name, FALSE);
+	imap_append_string(str, name);
 
 	str_append(str, " (");
 	list = quota_root_get_resources(root);
@@ -102,13 +102,13 @@
 	quotaroot_reply = t_str_new(128);
 	quota_reply = t_str_new(256);
 	str_append(quotaroot_reply, "* QUOTAROOT ");
-	imap_quote_append_string(quotaroot_reply, orig_mailbox, FALSE);
+	imap_append_string(quotaroot_reply, orig_mailbox);
 
 	iter = quota_root_iter_init(box);
 	while ((root = quota_root_iter_next(iter)) != NULL) {
 		str_append_c(quotaroot_reply, ' ');
 		name = imap_quota_root_get_name(client->user, ns->owner, root);
-		imap_quote_append_string(quotaroot_reply, name, FALSE);
+		imap_append_string(quotaroot_reply, name);
 
 		quota_reply_write(quota_reply, client->user, ns->owner, root);
 	}


More information about the dovecot-cvs mailing list