[sylpheed:33952] Re: Filter conundrum
Randy Dunlap
rdunlap at xenotime.net
Tue May 11 08:43:36 JST 2010
On Tue, 11 May 2010 08:36:34 +0900 (EIT) IW wrote:
> Menurut penulis Gene Goldenfeld
> > Update: My post filtered to the Sylpheed folder, as it should, so my
>
> I have noticed issues with sylpheed filtering. For example, I have a
> filter that says
> if email address = x then move to folder Y
> if email address = y then move to folder Y
>
> several times over.
>
> I have a folder which is my daily archive of personal emails I send to
> family. So any time I email anyone in my family, collectively or
> individually, that outgoing email should go to that archive folder. About
> 80% it does. The rest of the time it does not. I have scratched my head
> and checked the filter multiple times but cannot see any problems. It just
> seems to be random! Whether on Windows or Ubuntu I see the same issue.
I had some issues/questions about filter rules.
I have a small patch to sylpheed (see below).
I run "sylpheed --debug" so that I can see which filter rules cause
message to be filtered to what folders.
Maybe it can help...
---
When debug_mode is enabled ("--debug"), log filter decisions via
debug_print() so one can see why certain filtering rules are being applied.
---
libsylph/filter.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+)
diff -Naurp sylpheed-2.2.9/libsylph/filter.c~logit sylpheed-2.2.9/libsylph/filter.c
--- sylpheed-2.2.9/libsylph/filter.c~logit 2006-08-31 01:21:16.000000000 -0700
+++ sylpheed-2.2.9/libsylph/filter.c 2006-09-25 17:11:43.000000000 -0700
@@ -364,6 +364,9 @@ static gboolean filter_match_cond(Filter
case FLT_COND_BODY:
matched = procmime_find_string(msginfo, cond->str_value,
cond->match_func);
+ if (matched)
+ debug_print("filter-log: match in procmime_find_string (in body): str_value: [%s]\n",
+ cond->str_value);
break;
case FLT_COND_CMD_TEST:
file = procmsg_get_message_file(msginfo);
@@ -371,29 +374,54 @@ static gboolean filter_match_cond(Filter
matched = (execute_command_line(cmdline, FALSE) == 0);
g_free(cmdline);
g_free(file);
+ if (matched)
+ debug_print("filter-log: match in procmsg_get_message_file (in command test): str_value: [%s]\n",
+ cond->str_value);
break;
case FLT_COND_SIZE_GREATER:
matched = (msginfo->size > cond->int_value * 1024);
+ if (matched)
+ debug_print("filter-log: match in (SIZE_GREATER): %d > %d\n",
+ msginfo->size, cond->int_value * 1024);
break;
case FLT_COND_AGE_GREATER:
matched = (time(NULL) - msginfo->date_t >
cond->int_value * 24 * 60 * 60);
+ if (matched)
+ debug_print("filter-log: match in (AGE_GREATER): %d > %d\n",
+ time(NULL) - msginfo->date_t,
+ cond->int_value * 24 * 60 * 60);
break;
case FLT_COND_UNREAD:
matched = MSG_IS_UNREAD(msginfo->flags);
+ if (matched)
+ debug_print("filter-log: match in (UNREAD): flags: %d\n",
+ msginfo->flags);
break;
case FLT_COND_MARK:
matched = MSG_IS_MARKED(msginfo->flags);
+ if (matched)
+ debug_print("filter-log: match in (MARKED): flags: %d\n",
+ msginfo->flags);
break;
case FLT_COND_COLOR_LABEL:
matched = (MSG_GET_COLORLABEL_VALUE(msginfo->flags) != 0);
+ if (matched)
+ debug_print("filter-log: match in (COLOR_LABEL): %d\n",
+ msginfo->flags);
break;
case FLT_COND_MIME:
matched = MSG_IS_MIME(msginfo->flags);
+ if (matched)
+ debug_print("filter-log: match in (IS_MIME): %d\n",
+ msginfo->flags);
break;
case FLT_COND_ACCOUNT:
cond_ac = account_find_from_id(cond->int_value);
matched = (cond_ac != NULL && cond_ac == fltinfo->account);
+ if (matched)
+ debug_print("filter-log: match in (ACCOUNT): %d\n",
+ cond->int_value);
break;
default:
g_warning("filter_match_cond(): unknown condition: %d\n",
@@ -451,6 +479,9 @@ static gboolean filter_match_header_cond
if (FLT_IS_NOT_MATCH(cond->match_flag))
matched = !matched;
+ if (matched)
+ debug_print("filter-log: match in %s: header_name: [%s], str_value: [%s]\n",
+ __func__, cond->header_name, cond->str_value);
return matched;
}
More information about the Sylpheed
mailing list