[evolution-data-server] Bug 612121 - IMAPX: No UTF7 folder name encoding applied



commit cf137de9d0b5298f2d01a7129dea40e5721fd8d1
Author: Chenthill Palanisamy <pchenthill novell com>
Date:   Tue Mar 9 12:37:30 2010 +0530

    Bug 612121 - IMAPX: No UTF7 folder name encoding applied

 camel/providers/imapx/camel-imapx-server.c |   13 +++++++++++--
 camel/providers/imapx/camel-imapx-utils.c  |    2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index 8d666c4..2d5d6f4 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -38,6 +38,7 @@
 
 #include <camel/camel-sasl.h>
 #include <camel/camel-i18n.h>
+#include <camel/camel-utf8.h>
 #include <camel/camel-file-utils.h>
 
 #include "camel-imapx-utils.h"
@@ -490,6 +491,7 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 	CamelDataWrapper *D;
 	CamelSasl *A;
 	gchar buffer[16];
+	gchar *fname = NULL, *encoded = NULL;
 	CamelException ex = CAMEL_EXCEPTION_INITIALISER;
 
 	c(printf("adding command, fmt = '%s'\n", fmt));
@@ -592,9 +594,16 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 				case 'f': /* imap folder name */
 					s = va_arg(ap, gchar *);
 					c(printf("got folder '%s'\n", s));
-					/* FIXME: encode folder name */
-					/* FIXME: namespace? */
+					fname = camel_imapx_store_summary_full_from_path(((CamelIMAPXStore *)ic->job->folder->parent_store)->summary, s);
+					if (fname) {
+						encoded = camel_utf8_utf7(fname);
+						g_free (fname);
+					} else
+						encoded = camel_utf8_utf7 (s);
+
 					camel_stream_printf((CamelStream *)ic->mem, "\"%s\"", s?s:"");
+
+					g_free (encoded);
 					break;
 				case 'F': /* IMAP flags set */
 					f = va_arg(ap, guint32);
diff --git a/camel/providers/imapx/camel-imapx-utils.c b/camel/providers/imapx/camel-imapx-utils.c
index 3f561db..d93c0b3 100644
--- a/camel/providers/imapx/camel-imapx-utils.c
+++ b/camel/providers/imapx/camel-imapx-utils.c
@@ -1738,7 +1738,7 @@ imapx_parse_list(CamelIMAPXStream *is, CamelException *ex)
 	camel_imapx_stream_nstring(is, &token, ex);
 	linfo->separator = token?*token:0;
 	camel_imapx_stream_astring(is, &token, ex);
-	linfo->name = g_strdup((gchar *) token);
+	linfo->name = camel_utf7_utf8 ((gchar *) token);
 
 	return linfo;
 }



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