[evolution-data-server] imapx_store_rename_folder_info: Readability improvements.



commit 365101ba9fccd39d94e4f73f04579596f9544565
Author: Matthew Barnes <mbarnes redhat com>
Date:   Wed Sep 11 08:58:30 2013 -0400

    imapx_store_rename_folder_info: Readability improvements.

 camel/camel-imapx-store.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index 4ffd054..2e1fe70 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -232,12 +232,12 @@ imapx_store_build_folder_info (CamelIMAPXStore *imapx_store,
 
 static void
 imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store,
-                                const gchar *old_name,
-                                const gchar *new_name)
+                                const gchar *old_folder_path,
+                                const gchar *new_folder_path)
 {
        CamelStoreSummary *store_summary;
        GPtrArray *array;
-       gint olen = strlen (old_name);
+       gint olen = strlen (old_folder_path);
        guint ii;
 
        store_summary = CAMEL_STORE_SUMMARY (imapx_store->summary);
@@ -253,14 +253,19 @@ imapx_store_rename_folder_info (CamelIMAPXStore *imapx_store,
                si = g_ptr_array_index (array, ii);
                path = camel_store_info_path (store_summary, si);
 
-               if (strncmp (path, old_name, olen) != 0)
+               /* We need to adjust not only the entry for the renamed
+                * folder, but also the entries for all the descendants
+                * of the renamed folder. */
+
+               if (!g_str_has_prefix (path, old_folder_path))
                        continue;
 
                if (strlen (path) > olen)
                        new_path = g_strdup_printf (
-                               "%s/%s", new_name, path + olen + 1);
+                               "%s/%s", new_folder_path, path + olen + 1);
                else
-                       new_path = g_strdup (new_name);
+                       new_path = g_strdup (new_folder_path);
+
                new_mailbox = camel_imapx_store_summary_path_to_mailbox (
                        imapx_store->summary, new_path,
                        imapx_store->dir_sep);


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