aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--camel/ChangeLog3
-rw-r--r--camel/camel-folder-search.c13
2 files changed, 14 insertions, 2 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 4fe0f22704..6b23def269 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,8 @@
2001-03-29 Not Zed <NotZed@Ximian.com>
+ * camel-folder-search.c (search_body_contains): Optimise the match
+ "" case, just match everything in the folder (if we have it).
+
* camel-vtrash-folder.c (vtrash_move_messages_to): Access the
folder directly from the message info.
(vtrash_move_messages_to): I think we also need to call the real
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index 7afb148b0d..7893ee13e0 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -653,7 +653,9 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam
if (search->current) {
int truth = FALSE;
- if (search->body_index) {
+ if (argc == 1 && argv[0]->value.string[0] == 0 && search->folder) {
+ truth = TRUE;
+ } else if (search->body_index) {
for (i=0;i<argc && !truth;i++) {
if (argv[i]->type == ESEXP_RES_STRING) {
truth = ibex_find_name(search->body_index, (char *)camel_message_info_uid(search->current),
@@ -677,7 +679,14 @@ search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, Cam
} else {
r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- if (search->body_index) {
+ if (argc == 1 && argv[0]->value.string[0] == 0 && search->folder) {
+ /* optimise the match "" case - match everything */
+ r->value.ptrarray = g_ptr_array_new();
+ for (i=0;i<search->summary->len;i++) {
+ CamelMessageInfo *info = g_ptr_array_index(search->summary, i);
+ g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(info));
+ }
+ } else if (search->body_index) {
if (argc==1) {
/* common case */
r->value.ptrarray = ibex_find(search->body_index, argv[0]->value.string);