[evolution-data-server] Encode folder names as literals when sending commands, where needed



commit 95ae72c47280933c7ed5e467d668ce61ff4968ec
Author: David Woodhouse <David Woodhouse intel com>
Date:   Mon Jun 21 11:11:01 2010 +0100

    Encode folder names as literals when sending commands, where needed

 camel/providers/imapx/camel-imapx-server.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index d227eb2..4b8dbb6 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -575,6 +575,7 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 				case 's': /* simple string */
 					s = va_arg(ap, gchar *);
 					c(printf("got string '%s'\n", s));
+				output_string:
 					if (*s) {
 						guchar mask = imapx_is_mask(s);
 
@@ -601,6 +602,10 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 					} else {
 						camel_stream_write((CamelStream *)ic->mem, "\"\"", 2);
 					}
+					if (encoded) {
+						g_free(encoded);
+						encoded = NULL;
+					}
 					break;
 				case 'f': /* imap folder name */
 					folder = va_arg(ap, CamelFolder *);
@@ -614,9 +619,12 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 					} else
 						encoded = camel_utf8_utf7 (full_name);
 
-					camel_stream_printf((CamelStream *)ic->mem, "\"%s\"", encoded?encoded:"");
+					if (encoded) {
+						s = encoded;
+						goto output_string;
+					} else 
+						camel_stream_write((CamelStream *)ic->mem, "\"\"", 2);
 
-					g_free (encoded);
 					break;
 				case 'F': /* IMAP flags set */
 					f = va_arg(ap, guint32);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]