Fix for tny_camel_account_matches_url_string_default()



This patch stops tny_camel_account_matches_url_string_default() from
falsely matching accounts when there are 2 local maildir accounts.

-- 
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com
Index: libtinymail-camel/tny-camel-account.c
===================================================================
--- libtinymail-camel/tny-camel-account.c	(revision 2464)
+++ libtinymail-camel/tny-camel-account.c	(working copy)
@@ -229,6 +229,27 @@
 	if (in && org && in->port != 0 && (org->port != in->port))
 		retval = FALSE;
 
+	/* For local maildir accounts, compare their paths, before the folder part. */
+	if (in->path && org->path && (strcmp (in->protocol, "maildir") == 0)) {
+		/* The folders have a # before them: */
+		/* Copy the paths and set null-termination at the #: */
+		gchar *in_path = g_strdup (in->path);
+		gchar *in_pos_hash = strchr (in_path, '#');
+		if (in_pos_hash)
+			*in_pos_hash = '\0';
+
+		gchar *org_path = g_strdup (org->path);
+		gchar *org_pos_hash = strchr (org_path, '#');
+		if (org_pos_hash)
+			*org_pos_hash = '\0';
+
+		if (strcmp (in_path, org_path) != 0)
+			retval = FALSE;
+
+		g_free (in_path);
+		g_free (org_path);
+	}
+
 	if (org)
 		camel_url_free (org);
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 2464)
+++ ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2007-07-12  Murray Cumming  <murrayc murrayc com>
+
+	* libtinymail-camel/tny-camel-account.c:
+	(tny_camel_account_matches_url_string_default): For maildir accounts, 
+	compare their paths before the # marker for the folder, to avoid 
+	considering all maildir accounts to be the same account.
+
 2007-07-11  Armin Burgmeier  <armin openismus com>
 
 	* libtinymail-camel/tny-camel-folder.c:


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