From 8e598e640e9cbc8fe42d5d017b4557d656f24c5b Mon Sep 17 00:00:00 2001 From: 9 Date: Mon, 29 Oct 2001 05:06:59 +0000 Subject: Fix the 'is this a matching subfolder or subfolder'' logic to match 2001-10-29 * camel-vee-store.c (build_info): Fix the 'is this a matching subfolder or subfolder'' logic to match camel-store get_subfolders'. * camel-store.c (get_subfolders): Fix the 'is this a matching folder or subfolder' logic. svn path=/trunk/; revision=14324 --- camel/ChangeLog | 9 +++++++++ camel/camel-store.c | 13 +++++++++++-- camel/camel-vee-store.c | 10 +++++++++- 3 files changed, 29 insertions(+), 3 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 59c97b3a78..cc37be2f76 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,12 @@ +2001-10-29 + + * camel-vee-store.c (build_info): Fix the 'is this a matching + subfolder or subfolder'' logic to match camel-store + get_subfolders'. + + * camel-store.c (get_subfolders): Fix the 'is this a matching + folder or subfolder' logic. + 2001-10-28 * providers/local/camel-local-store.c (rename_folder): Changed to diff --git a/camel/camel-store.c b/camel/camel-store.c index a8c6b79bf0..d98df75d55 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -383,8 +383,17 @@ struct _get_info { static void get_subfolders(char *key, CamelFolder *folder, struct _get_info *info) { - /* If this is a subfolder of the one to be renamed, we need to get it, AND lock it */ - if (strncmp(folder->full_name, info->old, strlen(info->old)) == 0) { + int oldlen, namelen; + + namelen = strlen(folder->full_name); + oldlen = strlen(info->old); + + if ((namelen == oldlen && + strcmp(folder->full_name, info->old) == 0) + || ((namelen > oldlen) + && strncmp(folder->full_name, info->old, oldlen) == 0 + && folder->full_name[oldlen] == info->store->dir_sep)) { + d(printf("Found subfolder of '%s' == '%s'\n", info->old, folder->full_name)); camel_object_ref((CamelObject *)folder); g_ptr_array_add(info->folders, folder); diff --git a/camel/camel-vee-store.c b/camel/camel-vee-store.c index 72bde97413..e909671e36 100644 --- a/camel/camel-vee-store.c +++ b/camel/camel-vee-store.c @@ -167,11 +167,19 @@ static void build_info(char *name, CamelVeeFolder *folder, struct _build_info *data) { CamelFolderInfo *info; + int toplen, namelen; + + namelen = strlen(name); + toplen = strlen(data->top); /* check we have to include this one */ if (data->top) { if (data->flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) { - if (strncmp(name, data->top, strlen(data->top) != 0)) + if (!((namelen == toplen && + strcmp(name, data->top) == 0) + || ((namelen > toplen) + && strncmp(name, data->top, toplen) == 0 + && name[toplen] == '/'))) return; } else { if (strcmp(name, data->top)) -- cgit v1.2.3