From 37362c7b255ab1b932db1c9e41da146dd43abfa7 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 8 Jan 2009 11:09:02 +0000 Subject: ** Fix for bug #339879 2009-01-08 Milan Crha ** Fix for bug #339879 * filter/filter-code.h: (filter_code_new): * filter/filter-code.c: (filter_code_new), (build_code): * filter/rule-context.c: (new_element): Have two types of code expression, one "code", which adds also a "match-all" into the expression, and a "rawcode" without it. * addressbook/gui/widgets/addresstypes.xml: Use "rawcode" instead of "code" to have not added a "match-all" into the expression. svn path=/trunk/; revision=37014 --- addressbook/ChangeLog | 8 ++++++++ addressbook/gui/widgets/addresstypes.xml | 2 +- filter/ChangeLog | 10 ++++++++++ filter/filter-code.c | 20 ++++++++++++++++---- filter/filter-code.h | 2 +- filter/rule-context.c | 4 +++- 6 files changed, 39 insertions(+), 7 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 7b3c69c232..f2f213fb92 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,6 +1,14 @@ +2009-01-08 Milan Crha + + ** Fix for bug #339879 + + * gui/widgets/addresstypes.xml: Use "rawcode" instead of "code" + to have not added a "match-all" into the expression. + 2009-01-07 Matt Davey ** Fix for bugs #201167 and #269342 + * conduit/address-conduit.c: Add support for category syncing. Also, retain an existing given/first name split if it exists in the pilot record. diff --git a/addressbook/gui/widgets/addresstypes.xml b/addressbook/gui/widgets/addresstypes.xml index c93f9cac19..cef8000cc4 100644 --- a/addressbook/gui/widgets/addresstypes.xml +++ b/addressbook/gui/widgets/addresstypes.xml @@ -79,7 +79,7 @@ Expression - + diff --git a/filter/ChangeLog b/filter/ChangeLog index 2bfb8a6aa1..d6093ddfb1 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,13 @@ +2009-01-08 Milan Crha + + ** Fix for bug #339879 + + * filter-code.h: (filter_code_new): + * filter-code.c: (filter_code_new), (build_code): + * rule-context.c: (new_element): + Have two types of code expression, one "code", which adds also + a "match-all" into the expression, and a "rawcode" without it. + 2008-12-15 Milan Crha ** Part of fix for bug #563669 diff --git a/filter/filter-code.c b/filter/filter-code.c index 2ca98313b6..1de9c3aba6 100644 --- a/filter/filter-code.c +++ b/filter/filter-code.c @@ -98,9 +98,16 @@ filter_code_finalise (GObject *obj) * Return value: A new #FilterCode object. **/ FilterCode * -filter_code_new (void) +filter_code_new (gboolean raw_code) { - return (FilterCode *) g_object_new (FILTER_TYPE_CODE, NULL, NULL); + FilterCode *fc = (FilterCode *) g_object_new (FILTER_TYPE_CODE, NULL, NULL); + + if (fc && raw_code) { + xmlFree (((FilterInput *) fc)->type); + ((FilterInput *) fc)->type = (char *)xmlStrdup ((const unsigned char *)"rawcode"); + } + + return fc; } /* here, the string IS the code */ @@ -109,14 +116,19 @@ build_code (FilterElement *fe, GString *out, struct _FilterPart *ff) { GList *l; FilterInput *fi = (FilterInput *)fe; + gboolean is_rawcode = fi && fi->type && g_str_equal (fi->type, "rawcode"); + + if (!is_rawcode) + g_string_append(out, "(match-all "); - g_string_append(out, "(match-all "); l = fi->values; while (l) { g_string_append(out, (char *)l->data); l = g_list_next(l); } - g_string_append(out, ")"); + + if (!is_rawcode) + g_string_append (out, ")"); } /* and we have no value */ diff --git a/filter/filter-code.h b/filter/filter-code.h index 3ea5559a2c..7199bcef68 100644 --- a/filter/filter-code.h +++ b/filter/filter-code.h @@ -49,7 +49,7 @@ struct _FilterCodeClass { }; GType filter_code_get_type (void); -FilterCode *filter_code_new (void); +FilterCode *filter_code_new (gboolean raw_code); /* methods */ diff --git a/filter/rule-context.c b/filter/rule-context.c index 304d230568..cc81513784 100644 --- a/filter/rule-context.c +++ b/filter/rule-context.c @@ -906,7 +906,9 @@ new_element(RuleContext *rc, const char *type) /* FIXME: temporary ... need real address type */ return (FilterElement *) filter_input_new_type_name (type); } else if (!strcmp (type, "code")) { - return (FilterElement *) filter_code_new (); + return (FilterElement *) filter_code_new (FALSE); + } else if (!strcmp (type, "rawcode")) { + return (FilterElement *) filter_code_new (TRUE); } else if (!strcmp (type, "colour")) { return (FilterElement *) filter_colour_new (); } else if (!strcmp (type, "optionlist")) { -- cgit v1.2.3