aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--libsylph/filter.c62
2 files changed, 59 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index f83c712a..482b8b51 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2011-01-06
+ * libsylph/filter.c: filter_match_rule(): optimized by modifying the
+ order of condition matching.
+
+2011-01-06
+
* src/prefs_common_dialog.c: modified 'Address auto-completion'
setting layout.
diff --git a/libsylph/filter.c b/libsylph/filter.c
index 288564a9..1a4c1c29 100644
--- a/libsylph/filter.c
+++ b/libsylph/filter.c
@@ -368,20 +368,66 @@ gboolean filter_match_rule(FilterRule *rule, MsgInfo *msginfo, GSList *hlist,
if (rule->bool_op == FLT_AND) {
for (cur = rule->cond_list; cur != NULL; cur = cur->next) {
cond = (FilterCond *)cur->data;
- matched = filter_match_cond(cond, msginfo, hlist,
- fltinfo);
- if (matched == FALSE)
- return FALSE;
+ if (cond->type >= FLT_COND_SIZE_GREATER) {
+ matched = filter_match_cond
+ (cond, msginfo, hlist, fltinfo);
+ if (matched == FALSE)
+ return FALSE;
+ }
+ }
+
+ for (cur = rule->cond_list; cur != NULL; cur = cur->next) {
+ cond = (FilterCond *)cur->data;
+ if (cond->type <= FLT_COND_TO_OR_CC) {
+ matched = filter_match_cond
+ (cond, msginfo, hlist, fltinfo);
+ if (matched == FALSE)
+ return FALSE;
+ }
+ }
+
+ for (cur = rule->cond_list; cur != NULL; cur = cur->next) {
+ cond = (FilterCond *)cur->data;
+ if (cond->type == FLT_COND_BODY ||
+ cond->type == FLT_COND_CMD_TEST) {
+ matched = filter_match_cond
+ (cond, msginfo, hlist, fltinfo);
+ if (matched == FALSE)
+ return FALSE;
+ }
}
return TRUE;
} else if (rule->bool_op == FLT_OR) {
for (cur = rule->cond_list; cur != NULL; cur = cur->next) {
cond = (FilterCond *)cur->data;
- matched = filter_match_cond(cond, msginfo, hlist,
- fltinfo);
- if (matched == TRUE)
- return TRUE;
+ if (cond->type >= FLT_COND_SIZE_GREATER) {
+ matched = filter_match_cond
+ (cond, msginfo, hlist, fltinfo);
+ if (matched == TRUE)
+ return TRUE;
+ }
+ }
+
+ for (cur = rule->cond_list; cur != NULL; cur = cur->next) {
+ cond = (FilterCond *)cur->data;
+ if (cond->type <= FLT_COND_TO_OR_CC) {
+ matched = filter_match_cond
+ (cond, msginfo, hlist, fltinfo);
+ if (matched == TRUE)
+ return TRUE;
+ }
+ }
+
+ for (cur = rule->cond_list; cur != NULL; cur = cur->next) {
+ cond = (FilterCond *)cur->data;
+ if (cond->type == FLT_COND_BODY ||
+ cond->type == FLT_COND_CMD_TEST) {
+ matched = filter_match_cond
+ (cond, msginfo, hlist, fltinfo);
+ if (matched == TRUE)
+ return TRUE;
+ }
}
return FALSE;