aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@HelixCode.com>2000-08-09 08:40:03 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-08-09 08:40:03 +0800
commit4b65801638f2d6b4cfefb9cc13966a7557e2f946 (patch)
treec0630b1ab463f94cf7a602fd7e1557bbd7b0a550
parent01f333dee52a481a633858ef563dab221f01b945 (diff)
downloadgsoc2013-evolution-4b65801638f2d6b4cfefb9cc13966a7557e2f946.tar
gsoc2013-evolution-4b65801638f2d6b4cfefb9cc13966a7557e2f946.tar.gz
gsoc2013-evolution-4b65801638f2d6b4cfefb9cc13966a7557e2f946.tar.bz2
gsoc2013-evolution-4b65801638f2d6b4cfefb9cc13966a7557e2f946.tar.lz
gsoc2013-evolution-4b65801638f2d6b4cfefb9cc13966a7557e2f946.tar.xz
gsoc2013-evolution-4b65801638f2d6b4cfefb9cc13966a7557e2f946.tar.zst
gsoc2013-evolution-4b65801638f2d6b4cfefb9cc13966a7557e2f946.zip
Reorder search result in summary order if we searched with a summary.
2000-08-09 Not Zed <NotZed@HelixCode.com> * camel-folder-search.c (camel_folder_search_execute_expression): Reorder search result in summary order if we searched with a summary. svn path=/trunk/; revision=4618
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/camel-folder-search.c23
2 files changed, 26 insertions, 3 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 55eae4be3b..fe2b2df415 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,9 @@
+2000-08-09 Not Zed <NotZed@HelixCode.com>
+
+ * camel-folder-search.c (camel_folder_search_execute_expression):
+ Reorder search result in summary order if we searched with a
+ summary.
+
2000-08-08 Dan Winship <danw@helixcode.com>
* camel-uid-cache.c: New code to keep an on-disk cache of what
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index 4c5bd070d6..44eb03faad 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -256,6 +256,7 @@ camel_folder_search_execute_expression(CamelFolderSearch *search, const char *ex
ESExpResult *r;
GPtrArray *matches = g_ptr_array_new ();
int i;
+ GHashTable *results;
/* only re-parse if the search has changed */
if (search->last_search == NULL
@@ -271,9 +272,25 @@ camel_folder_search_execute_expression(CamelFolderSearch *search, const char *ex
if (r
&& r->type == ESEXP_RES_ARRAY_PTR) {
d(printf("got result ...\n"));
- for (i=0;i<r->value.ptrarray->len;i++) {
- d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
- g_ptr_array_add(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i)));
+ if (search->summary) {
+ /* reorder result in summary order */
+ results = g_hash_table_new(g_str_hash, g_str_equal);
+ for (i=0;i<r->value.ptrarray->len;i++) {
+ d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
+ g_hash_table_insert(results, g_ptr_array_index(r->value.ptrarray, i), (void *)1);
+ }
+ for (i=0;i<search->summary->len;i++) {
+ CamelMessageInfo *info = g_ptr_array_index(search->summary, i);
+ if (g_hash_table_lookup(results, info->uid)) {
+ g_ptr_array_add(matches, g_strdup(info->uid));
+ }
+ }
+ g_hash_table_destroy(results);
+ } else {
+ for (i=0;i<r->value.ptrarray->len;i++) {
+ d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
+ g_ptr_array_add(matches, g_strdup(g_ptr_array_index(r->value.ptrarray, i)));
+ }
}
e_sexp_result_free(r);
} else {