diff options
author | 9 <NotZed@Ximian.com> | 2001-10-29 16:28:53 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-10-29 16:28:53 +0800 |
commit | 93127a6dafa30b88d5639e145400b6b91bcc79ee (patch) | |
tree | baa167dc3b4910496269a911cc8152490e12aee4 | |
parent | c43aa966cbac71c6e5dbceb55bb172dcc3687bbf (diff) | |
download | gsoc2013-evolution-93127a6dafa30b88d5639e145400b6b91bcc79ee.tar gsoc2013-evolution-93127a6dafa30b88d5639e145400b6b91bcc79ee.tar.gz gsoc2013-evolution-93127a6dafa30b88d5639e145400b6b91bcc79ee.tar.bz2 gsoc2013-evolution-93127a6dafa30b88d5639e145400b6b91bcc79ee.tar.lz gsoc2013-evolution-93127a6dafa30b88d5639e145400b6b91bcc79ee.tar.xz gsoc2013-evolution-93127a6dafa30b88d5639e145400b6b91bcc79ee.tar.zst gsoc2013-evolution-93127a6dafa30b88d5639e145400b6b91bcc79ee.zip |
Sort the folder updates first, since we dont seem to get them in the right
2001-10-29 <NotZed@Ximian.com>
* mail-folder-cache.c (store_folder_renamed): Sort the folder
updates first, since we dont seem to get them in the right order,
or infact in any tree representation whatsoever when using IMAP
...? get_folder_info bugs?
Unrelated note to self, the subscribe dialogue may interfere with
the folder cache.
svn path=/trunk/; revision=14328
-rw-r--r-- | mail/ChangeLog | 8 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 51 | ||||
-rw-r--r-- | mail/mail-vfolder.c | 2 |
3 files changed, 37 insertions, 24 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 638e26b389..29e6c6cf56 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,13 @@ 2001-10-29 <NotZed@Ximian.com> + * mail-folder-cache.c (store_folder_renamed): Sort the folder + updates first, since we dont seem to get them in the right order, + or infact in any tree representation whatsoever when using IMAP + ...? get_folder_info bugs? + + Unrelated note to self, the subscribe dialogue may interfere with + the folder cache. + * mail-vfolder.c (rule_changed): Copy the folder's full_name before trying to use it to rename. (vfolder_edit_rule): Set 'orig' to be a reference of the original diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 732a9dadb5..7f1a689922 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -47,7 +47,7 @@ #include "mail-vfolder.h" #include "mail-autofilter.h" -#define d(x) x +#define d(x) /* note that many things are effectively serialised by having them run in the main loop thread which they need to do because of corba/gtk calls */ @@ -517,6 +517,8 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, up = g_malloc0(sizeof(*up)); + d(printf("oldbase '%s' newbase '%s' new '%s'\n", oldbase, newbase, fi->full_name)); + /* Form what was the old name, and try and look it up */ old = g_strdup_printf("%s%s", oldbase, fi->full_name + strlen(newbase)); mfi = g_hash_table_lookup(si->folders, old); @@ -561,30 +563,33 @@ rename_folders(struct _store_info *si, const char *oldbase, const char *newbase, e_dlist_addtail(&updates, (EDListNode *)up); flush_updates(); - +#if 0 if (fi->sibling) - rename_folders(si, oldbase, newbase, fi->sibling); + rename_folders(si, oldbase, newbase, fi->sibling, folders); if (fi->child) - rename_folders(si, oldbase, newbase, fi->child); + rename_folders(si, oldbase, newbase, fi->child, folders); +#endif } -#if 0 -/* This is if we want to get the folders individually and sort them and change them on - the shell atomically (whcih of course, we can't) */ static void -get_folders(GPtrArray *folders, CamelFolderInfo *fi) +get_folders(CamelFolderInfo *fi, GPtrArray *folders) { + g_ptr_array_add(folders, fi); + + if (fi->child) + get_folders(fi->child, folders); + if (fi->sibling) + get_folders(fi->sibling, folders); } static int folder_cmp(const void *ap, const void *bp) { - const struct _folder_update *a = ((struct _folder_update **)ap)[0]; - const struct _folder_update *b = ((struct _folder_update **)bp)[0]; + const CamelFolderInfo *a = ((CamelFolderInfo **)ap)[0]; + const CamelFolderInfo *b = ((CamelFolderInfo **)bp)[0]; return strcmp(a->path, b->path); } -#endif static void store_folder_renamed(CamelObject *o, void *event_data, void *data) @@ -598,22 +603,22 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data) LOCK(info_lock); si = g_hash_table_lookup(stores, store); if (si) { -#if 0 GPtrArray *folders = g_ptr_array_new(); - struct _folder_update *up; + CamelFolderInfo *fi, *top; + int i; - /* first, get an array of all folders */ - get_folders(folders, info->new); -#endif - rename_folders(si, info->old_base, info->new->full_name, info->new); -#if 0 + /* Ok, so for some reason the folderinfo we have comes in all messed up from + imap, should find out why ... this makes it workable */ + get_folders(info->new, folders); qsort(folders->pdata, folders->len, sizeof(folders->pdata[0]), folder_cmp); - up = g_malloc0(sizeof(*up)); - up->renamed = folders; - e_dlist_addtail(&updates, (EDListNode *)up); - flush_updates(); -#endif + top = folders->pdata[0]; + for (i=0;i<folders->len;i++) { + rename_folders(si, info->old_base, top->full_name, folders->pdata[i]); + } + + g_ptr_array_free(folders, TRUE); + } UNLOCK(info_lock); } diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c index 76ba1e200e..b593b4757d 100644 --- a/mail/mail-vfolder.c +++ b/mail/mail-vfolder.c @@ -44,7 +44,7 @@ #include "e-util/e-unicode-i18n.h" -#define d(x) x +#define d(x) static VfolderContext *context; /* context remains open all time */ static CamelStore *vfolder_store; /* the 1 static vfolder store */ |