[evolution-data-server/gnome-2-30] Encode folder names as literals when sending commands, where needed (cherry picked from commit 95ae7



commit a4736654e84cf076d26094feb25ef51526bedc3d
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
    (cherry picked from commit 95ae72c47280933c7ed5e467d668ce61ff4968ec)

 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 6ce78ea..e4ed21d 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -591,6 +591,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);
 
@@ -617,6 +618,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 *);
@@ -628,9 +633,12 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 					} else
 						encoded = camel_utf8_utf7 (folder->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]