[evolution-data-server/meego-eds] Fix IMAP & Daemon to work with some broken Yahoo's IMAP servers.



commit 19ce3a1e910ee76963f654628dd6b245ed0d48e8
Author: Srinivasa Ragavan <srini linux intel com>
Date:   Wed Jul 27 18:57:42 2011 +0530

    Fix IMAP & Daemon to work with some broken Yahoo's IMAP servers.

 camel/providers/imapx/camel-imapx-server.c        |    3 ++-
 camel/providers/imapx/camel-imapx-store-summary.c |    3 ++-
 mail/daemon/e-mail-data-store.c                   |   10 ++++------
 3 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index d018028..c59002b 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -653,7 +653,8 @@ imapx_command_addv(CamelIMAPXCommand *ic, const gchar *fmt, va_list ap)
 					s = va_arg(ap, gchar *);
 					c(printf("got string '%s'\n", s));
 				output_string:
-					if (*s) {
+					/* Some broken IMAP servers send NULL, just after lying that they are sending text.*/
+					if (s && *s) {
 						guchar mask = imapx_is_mask(s);
 
 						if (mask & IMAPX_TYPE_ATOM_CHAR)
diff --git a/camel/providers/imapx/camel-imapx-store-summary.c b/camel/providers/imapx/camel-imapx-store-summary.c
index 69def14..21187ee 100644
--- a/camel/providers/imapx/camel-imapx-store-summary.c
+++ b/camel/providers/imapx/camel-imapx-store-summary.c
@@ -144,7 +144,8 @@ camel_imapx_store_summary_full_to_path(CamelIMAPXStoreSummary *s, const gchar *f
 
 	p = path = g_strdup(full_name);
 
-	if (dir_sep != '/') {
+	/* Some broken IMAP servers don't sent dir_seps which will break the hierarchy.*/
+	if (dir_sep && dir_sep != '/') {
 		while (*p) {
 			if (*p == '/')
 				*p = dir_sep;
diff --git a/mail/daemon/e-mail-data-store.c b/mail/daemon/e-mail-data-store.c
index 9891fef..29a8656 100644
--- a/mail/daemon/e-mail-data-store.c
+++ b/mail/daemon/e-mail-data-store.c
@@ -241,7 +241,6 @@ handle_mail_get_folder (CamelFolder *folder, gpointer data, GError *error)
 	EMailGetFolderData *send_data = (EMailGetFolderData *)data;
 	EMailDataStore *mstore = send_data->mstore;
 	EMailDataStorePrivate *priv = DATA_STORE_PRIVATE(mstore);
-	char *new_name;
 	EMailDataFolder *efolder = NULL;
 	char *path;
 
@@ -255,16 +254,15 @@ handle_mail_get_folder (CamelFolder *folder, gpointer data, GError *error)
 		return;
 	}
 
-	new_name = g_strdup (camel_folder_get_full_name (folder));
 	g_mutex_lock (priv->folders_lock);
 	g_mutex_lock (priv->datafolders_lock);
 
-	g_hash_table_insert (priv->folders, new_name, folder);
+	g_hash_table_insert (priv->folders, g_strdup(send_data->folder_name), folder);
 	efolder = e_mail_data_folder_new (folder);
 
-	path = construct_mail_store_path (new_name);
+	path = construct_mail_store_path (send_data->folder_name);
 	e_mail_data_folder_register_gdbus_object (efolder, g_dbus_method_invocation_get_connection (send_data->invocation), path, NULL);
-	g_hash_table_insert (priv->datafolders, g_strdup(new_name), efolder);
+	g_hash_table_insert (priv->datafolders, g_strdup(send_data->folder_name), efolder);
 
 	if (send_data->folder_name)
 		egdbus_store_ms_complete_get_folder (send_data->object, send_data->invocation, path);
@@ -275,7 +273,7 @@ handle_mail_get_folder (CamelFolder *folder, gpointer data, GError *error)
 	else
 		egdbus_store_ms_complete_get_trash (send_data->object, send_data->invocation, path);
 
-	ipc (printf("EMailDataStore: get folder : %s %s: %s\n", priv->object_path, new_name, path));
+	ipc (printf("EMailDataStore: get folder : %s %s: %s\n", priv->object_path, send_data->folder_name, path));
 
 	g_mutex_unlock (priv->folders_lock);
 	g_mutex_unlock (priv->datafolders_lock);



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