aboutsummaryrefslogtreecommitdiffstats
path: root/filter
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
parent8d10a9b54423f8d4bffd2bd9412360a71c859117 (diff)
downloadgsoc2013-evolution-37362c7b255ab1b932db1c9e41da146dd43abfa7.tar
gsoc2013-evolution-37362c7b255ab1b932db1c9e41da146dd43abfa7.tar.gz
gsoc2013-evolution-37362c7b255ab1b932db1c9e41da146dd43abfa7.tar.bz2
gsoc2013-evolution-37362c7b255ab1b932db1c9e41da146dd43abfa7.tar.lz
gsoc2013-evolution-37362c7b255ab1b932db1c9e41da146dd43abfa7.tar.xz
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')
-rw-r--r--filter/ChangeLog10
-rw-r--r--filter/filter-code.c20
-rw-r--r--filter/filter-code.h2
-rw-r--r--filter/rule-context.c4
4 files changed, 30 insertions, 6 deletions
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 <mcrha@redhat.com>
+
+ ** 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 <mcrha@redhat.com>
** 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")) {