diff options
author | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-12-21 08:19:23 +0000 |
---|---|---|
committer | hiro <hiro@ee746299-78ed-0310-b773-934348b2243d> | 2005-12-21 08:19:23 +0000 |
commit | a185556cfbf5881f994da3575777ebdcafd91091 (patch) | |
tree | e8460871671266a33da23796dbad3c3a4f753a32 /libsylph | |
parent | cf84cac1795e9141138a8c630ba8d5b516d24a47 (diff) |
some modification of searching.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@848 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r-- | libsylph/filter.c | 23 | ||||
-rw-r--r-- | libsylph/procmsg.h | 1 | ||||
-rw-r--r-- | libsylph/virtual.c | 19 |
3 files changed, 38 insertions, 5 deletions
diff --git a/libsylph/filter.c b/libsylph/filter.c index dc2be18b..019ad24c 100644 --- a/libsylph/filter.c +++ b/libsylph/filter.c @@ -543,6 +543,7 @@ static gboolean filter_xml_node_func(GNode *node, gpointer data) const gchar *type = NULL; const gchar *name = NULL; const gchar *value = NULL; + gboolean case_sens = FALSE; FilterCond *cond; FilterCondType cond_type = FLT_COND_HEADER; FilterMatchType match_type = FLT_CONTAIN; @@ -555,22 +556,28 @@ static gboolean filter_xml_node_func(GNode *node, gpointer data) XMLAttr *attr = (XMLAttr *)list->data; if (!attr || !attr->name || !attr->value) continue; - if (!strcmp(attr->name, "type")) + + STR_SWITCH(attr->name) + STR_CASE_BEGIN("type") type = attr->value; - else if (!strcmp(attr->name, "name")) + STR_CASE("name") name = attr->value; - else if (!strcmp(attr->name, "recursive")) { + STR_CASE("case") + case_sens = TRUE; + STR_CASE("recursive") if (!strcmp(attr->value, "true")) recursive = TRUE; else recursive = FALSE; - } + STR_CASE_END } if (type) { filter_rule_match_type_str_to_enum (type, &match_type, &match_flag); } + if (case_sens) + match_flag |= FLT_CASE_SENS; value = xmlnode->element; STR_SWITCH(xmlnode->tag->tag) @@ -799,18 +806,26 @@ void filter_write_file(GSList *list, const gchar *file) NODE_NEW("match-header", cond->str_value); ADD_ATTR("type", match_type); ADD_ATTR("name", cond->header_name); + if (FLT_IS_CASE_SENS(cond->match_flag)) + ADD_ATTR("case", "true"); break; case FLT_COND_ANY_HEADER: NODE_NEW("match-any-header", cond->str_value); ADD_ATTR("type", match_type); + if (FLT_IS_CASE_SENS(cond->match_flag)) + ADD_ATTR("case", "true"); break; case FLT_COND_TO_OR_CC: NODE_NEW("match-to-or-cc", cond->str_value); ADD_ATTR("type", match_type); + if (FLT_IS_CASE_SENS(cond->match_flag)) + ADD_ATTR("case", "true"); break; case FLT_COND_BODY: NODE_NEW("match-body-text", cond->str_value); ADD_ATTR("type", match_type); + if (FLT_IS_CASE_SENS(cond->match_flag)) + ADD_ATTR("case", "true"); break; case FLT_COND_CMD_TEST: NODE_NEW("command-test", cond->str_value); diff --git a/libsylph/procmsg.h b/libsylph/procmsg.h index 8cae4440..c8a3ba16 100644 --- a/libsylph/procmsg.h +++ b/libsylph/procmsg.h @@ -88,6 +88,7 @@ typedef guint32 MsgPermFlags; #define MSG_IMAP (1U << 19) #define MSG_NEWS (1U << 20) #define MSG_SIGNED (1U << 21) +#define MSG_FLAG_CHANGED (1U << 27) #define MSG_CACHED (1U << 28) #define MSG_MIME (1U << 29) #define MSG_INVALID (1U << 30) diff --git a/libsylph/virtual.c b/libsylph/virtual.c index 897a7070..985215ee 100644 --- a/libsylph/virtual.c +++ b/libsylph/virtual.c @@ -144,19 +144,26 @@ static GSList *virtual_search_folder(FilterRule *rule, FolderItem *item) GSList *cur; FilterInfo fltinfo; gboolean full_headers; + gint count = 1, total; + GTimeVal tv_prev, tv_cur; g_return_val_if_fail(rule != NULL, NULL); g_return_val_if_fail(item != NULL, NULL); + g_return_val_if_fail(item->path != NULL, NULL); /* prevent circular reference */ if (item->stype == F_VIRTUAL) return NULL; + g_get_current_time(&tv_prev); + status_print(_("Searching %s ..."), item->path); + mlist = folder_item_get_msg_list(item, TRUE); + total = g_slist_length(mlist); memset(&fltinfo, 0, sizeof(FilterInfo)); - debug_print("start query search: %s\n", item->path ? item->path : ""); + debug_print("start query search: %s\n", item->path); full_headers = filter_rule_requires_full_headers(rule); @@ -164,6 +171,16 @@ static GSList *virtual_search_folder(FilterRule *rule, FolderItem *item) MsgInfo *msginfo = (MsgInfo *)cur->data; GSList *hlist; + g_get_current_time(&tv_cur); + if (tv_cur.tv_sec > tv_prev.tv_sec || + tv_cur.tv_usec - tv_prev.tv_usec > + PROGRESS_UPDATE_INTERVAL * 1000) { + status_print(_("Searching %s (%d / %d)..."), + item->path, count, total); + tv_prev = tv_cur; + } + ++count; + fltinfo.flags = msginfo->flags; if (full_headers) { gchar *file; |