aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog4
-rw-r--r--camel/camel-vee-folder.c29
2 files changed, 25 insertions, 8 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index a5012ff2f9..d4bb72ea95 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,9 @@
2001-10-11 <NotZed@Ximian.com>
+ * camel-vee-folder.c (vee_search_by_uids): convert the uids list
+ to a subset appropriate for each subfolder before trying to search
+ on it.
+
* camel-charset-map.[ch]: Removed charset/locale charset lookup
and iconv_open/close functions, moved to gal. Fixed all callers.
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index 3f05626ceb..81a38ae7b5 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -614,6 +614,7 @@ vee_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids,
{
GList *node;
GPtrArray *matches, *result = g_ptr_array_new ();
+ GPtrArray *folder_uids = g_ptr_array_new();
char *expr;
CamelVeeFolder *vf = (CamelVeeFolder *)folder;
struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
@@ -631,15 +632,26 @@ vee_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids,
/* make sure we only search each folder once - for unmatched folder to work right */
if (g_hash_table_lookup(searched, f) == NULL) {
camel_vee_folder_hash_folder(f, hash);
- matches = camel_folder_search_by_uids(f, expression, uids, ex);
- if (matches) {
- for (i = 0; i < matches->len; i++) {
- char *uid = matches->pdata[i];
- g_ptr_array_add(result, g_strdup_printf("%.8s%s", hash, uid));
+
+ /* map the vfolder uid's to the source folder uid's first */
+ g_ptr_array_set_size(folder_uids, 0);
+ for (i=0;i<uids->len;i++) {
+ char *uid = uids->pdata[i];
+
+ if (strlen(uid) >= 8 && strncmp(uid, hash, 8) == 0)
+ g_ptr_array_add(folder_uids, uid+8);
+ }
+ if (folder_uids->len > 0) {
+ matches = camel_folder_search_by_uids(f, expression, folder_uids, ex);
+ if (matches) {
+ for (i = 0; i < matches->len; i++) {
+ char *uid = matches->pdata[i];
+ g_ptr_array_add(result, g_strdup_printf("%.8s%s", hash, uid));
+ }
+ camel_folder_search_free(f, matches);
+ } else {
+ g_warning("Search failed: %s", camel_exception_get_description(ex));
}
- camel_folder_search_free(f, matches);
- } else {
- g_warning("Search failed: %s", camel_exception_get_description(ex));
}
g_hash_table_insert(searched, f, f);
}
@@ -650,6 +662,7 @@ vee_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids,
CAMEL_VEE_FOLDER_UNLOCK(vf, subfolder_lock);
g_hash_table_destroy(searched);
+ g_ptr_array_free(folder_uids, 0);
return result;
}