aboutsummaryrefslogtreecommitdiffstats
path: root/filter/filter-code.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-01-08 19:09:02 +0800
committerMilan Crha <mcrha@src.gnome.org>2009-01-08 19:09:02 +0800
commit37362c7b255ab1b932db1c9e41da146dd43abfa7 (patch)
tree77ee9e72512aa9025a79cb59ff3bcf3a6a6e138e /filter/filter-code.c
parent8d10a9b54423f8d4bffd2bd9412360a71c859117 (diff)
downloadgsoc2013-evolution-37362c7b255ab1b932db1c9e41da146dd43abfa7.tar.gz
gsoc2013-evolution-37362c7b255ab1b932db1c9e41da146dd43abfa7.tar.zst
gsoc2013-evolution-37362c7b255ab1b932db1c9e41da146dd43abfa7.zip
** Fix for bug #339879
2009-01-08 Milan Crha <mcrha@redhat.com> ** 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
Diffstat (limited to 'filter/filter-code.c')
-rw-r--r--filter/filter-code.c20
1 files changed, 16 insertions, 4 deletions
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 */