diff options
author | Not Zed <NotZed@HelixCode.com> | 2000-05-28 14:14:53 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2000-05-28 14:14:53 +0800 |
commit | d11f78c349719e66a6eb569f6f1a65d268a6dec4 (patch) | |
tree | 0ca5820b101fda23a3aae53539e7018abac554d8 /filter/filter-driver.c | |
parent | 350fde81677a44e5203a38c833e5175c3b649de2 (diff) | |
download | gsoc2013-evolution-d11f78c349719e66a6eb569f6f1a65d268a6dec4.tar gsoc2013-evolution-d11f78c349719e66a6eb569f6f1a65d268a6dec4.tar.gz gsoc2013-evolution-d11f78c349719e66a6eb569f6f1a65d268a6dec4.tar.bz2 gsoc2013-evolution-d11f78c349719e66a6eb569f6f1a65d268a6dec4.tar.lz gsoc2013-evolution-d11f78c349719e66a6eb569f6f1a65d268a6dec4.tar.xz gsoc2013-evolution-d11f78c349719e66a6eb569f6f1a65d268a6dec4.tar.zst gsoc2013-evolution-d11f78c349719e66a6eb569f6f1a65d268a6dec4.zip |
New file - lists rules appropriate for vfolders (no actions, etc).
2000-05-27 Not Zed <NotZed@HelixCode.com>
* vfoldertypes.xml: New file - lists rules appropriate for
vfolders (no actions, etc).
* Makefile.am (EXTRA_DIST): Add vfoldertypes.xml
* filter-driver.c (filter_driver_expand_option): Made public from
expand_filter_option.
(filter_driver_rule_count): find out how many user rules are
defined.
(filter_driver_rule_get): Get a user rule by index.
svn path=/trunk/; revision=3240
Diffstat (limited to 'filter/filter-driver.c')
-rw-r--r-- | filter/filter-driver.c | 76 |
1 files changed, 48 insertions, 28 deletions
diff --git a/filter/filter-driver.c b/filter/filter-driver.c index 17ced7412d..e43f543611 100644 --- a/filter/filter-driver.c +++ b/filter/filter-driver.c @@ -301,46 +301,52 @@ expand_variables(GString *out, char *source, GList *args, GHashTable *globals) /* build an expression for the filter */ -static void -expand_filter_option(FilterDriver *d, GString *s, GString *action, struct filter_option *op) +void +filter_driver_expand_option(FilterDriver *d, GString *s, GString *action, struct filter_option *op) { GList *optionl; FilterArg *arg; struct _FilterDriverPrivate *p = _PRIVATE(d); - g_string_append(s, "(and "); - optionl = op->options; - while (optionl) { - struct filter_optionrule *or = optionl->data; - if (or->rule->type == FILTER_XML_MATCH - || or->rule->type == FILTER_XML_EXCEPT) { - if (or->args) { - arg = or->args->data; - if (arg) { - printf("arg = %s\n", arg->name); + if (s) { + g_string_append(s, "(and "); + optionl = op->options; + while (optionl) { + struct filter_optionrule *or = optionl->data; + if (or->rule->type == FILTER_XML_MATCH + || or->rule->type == FILTER_XML_EXCEPT) { + if (or->args) { + arg = or->args->data; + if (arg) { + printf("arg = %s\n", arg->name); + } } + expand_variables(s, or->rule->code, or->args, p->globals); } - expand_variables(s, or->rule->code, or->args, p->globals); + optionl = g_list_next(optionl); } - optionl = g_list_next(optionl); - } - g_string_append(s, ")"); + g_string_append(s, ")"); + } - g_string_append(action, "(begin "); - optionl = op->options; - while (optionl) { - struct filter_optionrule *or = optionl->data; - if (or->rule->type == FILTER_XML_ACTION) { - expand_variables(action, or->rule->code, or->args, p->globals); - g_string_append(action, " "); + if (action) { + g_string_append(action, "(begin "); + optionl = op->options; + while (optionl) { + struct filter_optionrule *or = optionl->data; + if (or->rule->type == FILTER_XML_ACTION) { + expand_variables(action, or->rule->code, or->args, p->globals); + g_string_append(action, " "); + } + optionl = g_list_next(optionl); } - optionl = g_list_next(optionl); + g_string_append(action, ")"); } - g_string_append(action, ")"); - printf("combined rule '%s'\n", s->str); - printf("combined action '%s'\n", action->str); + if (s) + printf("combined rule '%s'\n", s->str); + if (action) + printf("combined action '%s'\n", action->str); } static ESExpResult * @@ -523,6 +529,20 @@ close_folders(FilterDriver *d) } int +filter_driver_rule_count(FilterDriver *d) +{ + struct _FilterDriverPrivate *p = _PRIVATE(d); + return g_list_length(p->options); +} + +struct filter_option * +filter_driver_rule_get(FilterDriver *d, int n) +{ + struct _FilterDriverPrivate *p = _PRIVATE(d); + return g_list_nth_data(p->options, n); +} + +int filter_driver_run(FilterDriver *d, CamelFolder *source, CamelFolder *inbox) { struct _FilterDriverPrivate *p = _PRIVATE(d); @@ -549,7 +569,7 @@ filter_driver_run(FilterDriver *d, CamelFolder *source, CamelFolder *inbox) s = g_string_new(""); a = g_string_new(""); - expand_filter_option(d, s, a, fo); + filter_driver_expand_option(d, s, a, fo); printf("searching expression %s\n", s->str); p->matches = camel_folder_search_by_expression (p->source, s->str, p->ex); |