diff options
-rw-r--r-- | filter/ChangeLog | 10 | ||||
-rw-r--r-- | filter/Makefile.am | 4 | ||||
-rw-r--r-- | filter/filter-arg.c | 1 | ||||
-rw-r--r-- | filter/filter-editor.c | 3 | ||||
-rw-r--r-- | filter/filter-xml.c | 20 | ||||
-rw-r--r-- | filter/filtertypes.xml | 94 |
6 files changed, 131 insertions, 1 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index 78b6a0823d..b483b6ba84 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,5 +1,15 @@ 2000-05-16 NotZed <NotZed@HelixCode.com> + * filtertypes.xml: Initial filter rules. + + * filter-xml.c (filter_write_optionset): Save the description + also. + (write_description): Routine to save description - only saves 1 + node of description. + + * filter-arg.c (filter_arg_edit_clicked): Dont free edata here, + let the destroy do it(?) + * filter-editor.c (main): Simple driver program for testing, so i can fix all this really broken code *sigh* diff --git a/filter/Makefile.am b/filter/Makefile.am index 17cac3ccf0..32ef89f638 100644 --- a/filter/Makefile.am +++ b/filter/Makefile.am @@ -29,3 +29,7 @@ libfilter_la_SOURCES = \ filter-driver.h EXTRA_DIST = blank.xpm check.xpm + +# basic rules. +filterdir = $(prefix)/share/evolution +filter_DATA = filtertypes.xml diff --git a/filter/filter-arg.c b/filter/filter-arg.c index 867afdc94e..77dffe284b 100644 --- a/filter/filter-arg.c +++ b/filter/filter-arg.c @@ -452,7 +452,6 @@ filter_arg_edit_clicked(GnomeDialog *d, int button, struct filter_arg_edit *edat } xmlFreeNodeList(p->oldargs); p->oldargs = NULL; - g_free(edata); p->dialogue = NULL; gnome_dialog_close(d); } diff --git a/filter/filter-editor.c b/filter/filter-editor.c index af064b32eb..ec6320b649 100644 --- a/filter/filter-editor.c +++ b/filter/filter-editor.c @@ -350,6 +350,9 @@ filter_editor_set_rule_files(FilterEditor *e, const char *systemrules, const cha out = xmlParseFile(userrules); if (out) options = filter_load_optionset(out, rules); + + printf("Loading system rules: %s = %p = %p\n", systemrules, doc, rules); + printf("Loading user rules: %s = %p = %p\n", userrules, out, options); filter_editor_set_rules(e, rules, options2, options); } diff --git a/filter/filter-xml.c b/filter/filter-xml.c index 0df8f49ad5..ada718778e 100644 --- a/filter/filter-xml.c +++ b/filter/filter-xml.c @@ -334,6 +334,19 @@ filter_load_optionset(xmlDocPtr doc, GList *rules) return l; } +static xmlNodePtr +write_description(xmlDocPtr doc, GList *descl) +{ + xmlNodePtr d; + struct filter_desc *desc; + + desc = descl->data; + d = xmlNewDocNode(doc, NULL, "description", NULL); + if (desc->type == FILTER_XML_TEXT) + xmlNodeSetContent(d, desc->data); + return d; +} + xmlNodePtr filter_write_optionset(xmlDocPtr doc, GList *optionl) { @@ -350,6 +363,13 @@ filter_write_optionset(xmlDocPtr doc, GList *optionl) option = xmlNewDocNode(doc, NULL, "option", NULL); xmlSetProp(option, "type", detokenise(op->type)); + if (op->description) { + xmlNodePtr desc; + + desc = write_description(doc, op->description); + xmlAddChild(option, desc); + } + optionrulel = op->options; while (optionrulel) { or = optionrulel->data; diff --git a/filter/filtertypes.xml b/filter/filtertypes.xml new file mode 100644 index 0000000000..f93a7b9c35 --- /dev/null +++ b/filter/filtertypes.xml @@ -0,0 +1,94 @@ +<?xml version="1.0"?> +<filterdescription> +<ruleset type="match"> +<rule name="from-address"> + <code> + (match-all (header-contains "From" ${sender})) + </code> + <description lang="en">The From address matches <source type="address" name="sender">sender(s)</source>.</description> +</rule> + +<rule name="to-address"> + <code> + (match-all (header-contains "To" ${receipient})) + </code> + <description lang="en">The To address matches <source type="address" name="receipient">receipients</source>.</description> +</rule> + +<rule name="subject-contains"> + <code> + (match-all (header-contains "Subject" ${words})) + </code> + <description lang="en">The Subject contains <source type="folder" name="words">words</source>.</description> +</rule> + +<rule name="cc-address"> + <code> + (match-all (header-contains "CC" ${self-email})) + </code> + <description lang="en">I am in the cc list.</description> +</rule> + +<rule name="msg-size"> + <code> + (& (> message-size (size-lower size-range)) + (< message-size (size-uppwer size-range))) + </code> + <description lang="en">The message is a <source type="size-range" name="size">certain size</source>.</description> +</rule> +</ruleset> + +<ruleset type="action"> +<rule name="copy-me"> + <code> + (copy-to ${folder}) + </code> + <description language="en">Send a copy to <source type="folder" name="folder">folder</source>.</description> +</rule> +<rule name="forward"> + <code> + (forward-to ${address}) + </code> + <description language="en">Forward the message to <source type="address" name="address">people</source>.</description> +</rule> +<rule name="delete"> + <code> + (delete) + </code> + <description language="en">Delete message.</description> +</rule> +<rule name="stop"> + <code> + (stop) + </code> + <description language="en">Stop processing further rules for this message.</description> +</rule> +</ruleset> + +<ruleset type="except"> +<rule name="except-me"> + <code> + (match-all (not (header-contains "To" ${self-email}))) + </code> + <description language="en">When I am the receipient.</description> +</rule> +</ruleset> + +<optionset> + <option type="receive"> + <description language="en">When a message arrives.</description> + </option> + <option type="send"> + <description language="en">When a message is sent.</description> + </option> + <option type="receive"> + <description language="en">Copy incoming messages from a certain address to specific folder.</description> + <optionrule type="match" rule="from-address"/> + <optionrule type="action" rule="copy-me"/> + </option> + <option type="send"> + <description language="en">Copy sent messages to a specific folder.</description> + <optionrule type="action" rule="copy-me"/> + </option> +</optionset> +</filterdescription> |