aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-01-25 08:25:41 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-01-25 08:25:41 +0000
commit88fe3b7e37244b83076c243741e2c71338d37360 (patch)
tree375da95ed456ed7e4487222905047e9b0de07922 /libsylph
parent34a24148d4315d15e092760c983ff45115a32e00 (diff)
exclude trash on recursive search.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@928 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/virtual.c22
-rw-r--r--libsylph/virtual.h2
2 files changed, 18 insertions, 6 deletions
diff --git a/libsylph/virtual.c b/libsylph/virtual.c
index 9d9de5b7..5a229416 100644
--- a/libsylph/virtual.c
+++ b/libsylph/virtual.c
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -50,6 +50,8 @@ struct _VirtualSearchInfo {
GSList *mlist;
GHashTable *search_cache_table;
FILE *fp;
+ gboolean requires_full_headers;
+ gboolean exclude_trash;
};
struct _SearchCacheInfo {
@@ -322,7 +324,6 @@ static GSList *virtual_search_folder(VirtualSearchInfo *info, FolderItem *item)
GSList *mlist;
GSList *cur;
FilterInfo fltinfo;
- gboolean full_headers;
gint count = 1, total, ncachehit = 0;
GTimeVal tv_prev, tv_cur;
@@ -345,8 +346,6 @@ static GSList *virtual_search_folder(VirtualSearchInfo *info, FolderItem *item)
debug_print("start query search: %s\n", item->path);
- full_headers = filter_rule_requires_full_headers(info->rule);
-
virtual_write_search_cache(info->fp, item, NULL, 0);
for (cur = mlist; cur != NULL; cur = cur->next) {
@@ -392,7 +391,7 @@ static GSList *virtual_search_folder(VirtualSearchInfo *info, FolderItem *item)
}
fltinfo.flags = msginfo->flags;
- if (full_headers) {
+ if (info->requires_full_headers) {
gchar *file;
file = procmsg_get_message_file(msginfo);
@@ -437,6 +436,8 @@ static gboolean virtual_search_recursive_func(GNode *node, gpointer data)
if (!item->path)
return FALSE;
+ if (info->exclude_trash && item->stype == F_TRASH)
+ return FALSE;
mlist = virtual_search_folder(info, item);
info->mlist = g_slist_concat(info->mlist, mlist);
@@ -497,6 +498,17 @@ static GSList *virtual_get_msg_list(Folder *folder, FolderItem *item,
if (!info.fp)
goto finish;
+ info.requires_full_headers =
+ filter_rule_requires_full_headers(rule);
+
+ if (rule->recursive) {
+ if (target->stype == F_TRASH)
+ info.exclude_trash = FALSE;
+ else
+ info.exclude_trash = TRUE;
+ } else
+ info.exclude_trash = FALSE;
+
if (rule->recursive) {
g_node_traverse(target->node, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
virtual_search_recursive_func, &info);
diff --git a/libsylph/virtual.h b/libsylph/virtual.h
index 1a7ba38f..86a74b3d 100644
--- a/libsylph/virtual.h
+++ b/libsylph/virtual.h
@@ -1,6 +1,6 @@
/*
* LibSylph -- E-Mail client library
- * Copyright (C) 1999-2005 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2006 Hiroyuki Yamamoto
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public