aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--filter/ChangeLog12
-rw-r--r--filter/filter-arg-types.c12
-rw-r--r--filter/filter-arg.c22
-rw-r--r--filter/filter-druid.c4
-rw-r--r--filter/filter-format.c43
-rw-r--r--filter/filter-xml.c9
-rw-r--r--filter/filter-xml.h1
-rw-r--r--filter/filtertypes.xml6
-rw-r--r--filter/vfoldertypes.xml6
9 files changed, 46 insertions, 69 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 9cbf2f1d98..865b8a00f4 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,3 +1,15 @@
+2000-07-09 Dan Winship <danw@helixcode.com>
+
+ * filter-xml.[ch]: add a "string" type
+
+ * filtertype.xml, vfoldertypes.xml: Use type="string" rather than
+ "folder" for subject/body matching.
+
+ * filter-arg-types.c: Update some strings for "text" input. Fix
+ some warnings (including one that pointed out a real bug).
+
+ * filter-arg.c, filter-druid.c, filter-format.c: fix warnings
+
2000-07-07 Dan Winship <danw@helixcode.com>
* filter-driver.c: Update for camel_folder_search_by_expression
diff --git a/filter/filter-arg-types.c b/filter/filter-arg-types.c
index 578eeee64e..5d09b4817b 100644
--- a/filter/filter-arg-types.c
+++ b/filter/filter-arg-types.c
@@ -73,7 +73,7 @@ arg_string_write_text(FilterArg *argin, GString *string)
l = argin->values;
if (l == NULL) {
- g_string_append(string, "folder");
+ g_string_append(string, "text");
}
while (l) {
a = l->data;
@@ -105,7 +105,7 @@ arg_string_edit_value (FilterArg *arg, int index)
dialogue = (GnomeDialog *)gnome_dialog_new ("Edit value", "Ok", "Cancel", 0);
hbox = gtk_hbox_new (FALSE, 0);
- label = gtk_label_new ("Option value");
+ label = gtk_label_new ("Text");
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
entry = gtk_entry_new();
gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
@@ -420,8 +420,10 @@ arg_address_get_value_as_string(FilterArg *argin, void *data)
}
static void
-arg_address_free_value(FilterArg *arg, struct filter_arg_address *a)
+arg_address_free_value(FilterArg *arg, void *v)
{
+ struct filter_arg_address *a = v;
+
g_free(a->name);
g_free(a->email);
g_free(a);
@@ -573,7 +575,7 @@ arg_folder_edit_value (FilterArg *arg, int index)
if (physical_uri != NULL && physical_uri[0] != '\0') {
GList *node;
- if (index >= 0 && (node = g_list_index (arg->values, index)))
+ if (index >= 0 && (node = g_list_nth (arg->values, index)))
node->data = physical_uri;
else
arg->values = g_list_append (arg->values, physical_uri);
@@ -748,6 +750,8 @@ filter_arg_folder_class_init (FilterArgFolderClass *class)
filter_class->values_get_xml = arg_folder_values_get_xml;
filter_class->values_add_xml = arg_folder_values_add_xml;
+
+ filter_class->get_value_as_string = arg_folder_get_value_as_string;
}
static void
diff --git a/filter/filter-arg.c b/filter/filter-arg.c
index 8d659d7af9..622986ce43 100644
--- a/filter/filter-arg.c
+++ b/filter/filter-arg.c
@@ -33,7 +33,7 @@ static void filter_arg_init (FilterArg *gspaper);
struct _FilterArgPrivate {
GtkWidget *dialogue; /* editor widget */
- xmlNodePtr *oldargs;
+ xmlNodePtr oldargs;
};
static GtkObjectClass *parent_class;
@@ -100,10 +100,10 @@ edit_values_nothing(FilterArg *arg)
/* empty */
}
-static void *
-edit_value_nothing(FilterArg *arg, void *v)
+static int
+edit_value_nothing(FilterArg *arg, int index)
{
- return v;
+ return index;
}
static void
@@ -112,12 +112,6 @@ free_value_nothing(FilterArg *arg, void *v)
/* empty */
}
-static gint
-compare_pointers(gpointer a, gpointer b)
-{
- return a == b;
-}
-
static void
filter_arg_class_init (FilterArgClass *class)
{
@@ -434,9 +428,9 @@ filter_arg_edit_clicked(GnomeDialog *d, int button, struct filter_arg_edit *edat
while (edata->arg->values) {
filter_arg_remove(edata->arg, edata->arg->values->data);
}
- filter_arg_values_add_xml(edata->arg, (xmlNodePtr) p->oldargs);
+ filter_arg_values_add_xml(edata->arg, p->oldargs);
}
- xmlFreeNodeList((xmlNodePtr) p->oldargs);
+ xmlFreeNodeList(p->oldargs);
p->oldargs = NULL;
p->dialogue = NULL;
gnome_dialog_close(d);
@@ -451,8 +445,8 @@ filter_arg_edit_destroy(GnomeDialog *d, struct filter_arg_edit *edata)
while (edata->arg->values) {
filter_arg_remove(edata->arg, edata->arg->values->data);
}
- filter_arg_values_add_xml(edata->arg, (xmlNodePtr) p->oldargs);
- xmlFreeNodeList((xmlNodePtr) p->oldargs);
+ filter_arg_values_add_xml(edata->arg, p->oldargs);
+ xmlFreeNodeList(p->oldargs);
p->oldargs = NULL;
}
diff --git a/filter/filter-druid.c b/filter/filter-druid.c
index f516112d5d..a90dd79a0e 100644
--- a/filter/filter-druid.c
+++ b/filter/filter-druid.c
@@ -97,7 +97,7 @@ filter_druid_get_type (void)
}
static void
-object_destroy(FilterDruid *obj)
+object_destroy(GtkObject *obj)
{
struct _FilterDruidPrivate *p = _PRIVATE(obj);
@@ -107,7 +107,7 @@ object_destroy(FilterDruid *obj)
/* FIXME: free lists? */
- GTK_OBJECT_CLASS(filter_druid_parent)->destroy(GTK_OBJECT (obj));
+ GTK_OBJECT_CLASS(filter_druid_parent)->destroy(obj);
}
static void
diff --git a/filter/filter-format.c b/filter/filter-format.c
index b7a2a956be..7f8f388ef5 100644
--- a/filter/filter-format.c
+++ b/filter/filter-format.c
@@ -13,46 +13,6 @@
#define d(x)
-/* FIXME: remove static, this is defined in filter-xml */
-static int
-filter_find_rule(struct filter_rule *a, char *name)
-{
- d(printf("finding, is %s = %s?\n", a->name, name));
- return strcmp(a->name, name);
-}
-
-static int
-filter_find_arg(FilterArg *a, char *name)
-{
- d(printf("finding, is %s = %s?\n", a->name, name));
- return strcmp(a->name, name);
-}
-
-static int display_order[] = { FILTER_XML_MATCH, FILTER_XML_ACTION, FILTER_XML_EXCEPT };
-
-static struct filter_option *
-option_clone(struct filter_option *source)
-{
- struct filter_option *dest = g_malloc0(sizeof(*dest));
- GList *loptions;
- struct filter_optionrule *old, *new;
-
- dest->type = source->type;
- dest->description = source->description;
- loptions = dest->options;
- while (loptions) {
- old = loptions->data;
- new = g_malloc0(sizeof(*new));
- new->rule = old->rule;
- /* FIXME: need to copy any args as well!!! */
- dest->options = g_list_append(dest->options, new);
- loptions = g_list_next(loptions);
- }
- return dest;
-}
-
-
-
struct description_decode_lambda {
GString *str;
GList *args;
@@ -64,7 +24,7 @@ static char *
arg_text(FilterArg *arg)
{
char *out = NULL;
- GList *value, *next;
+ GList *value;
GString *str;
value = arg->values;
@@ -189,7 +149,6 @@ description_decode_html(struct filter_desc *d, struct description_decode_lambda
void
filter_description_html_write(GList *description, GList *args, GtkHTML *html, GtkHTMLStream *stream)
{
- char *txt;
struct description_decode_lambda l;
d(printf("\ndecoding ...\n"));
diff --git a/filter/filter-xml.c b/filter/filter-xml.c
index ca95112127..61788286bf 100644
--- a/filter/filter-xml.c
+++ b/filter/filter-xml.c
@@ -38,6 +38,7 @@ struct token_tab token_table[] = {
{ "ruleset", FILTER_XML_RULESET },
{ "send", FILTER_XML_SEND },
{ "source", FILTER_XML_SOURCE },
+ { "string", FILTER_XML_STRING },
{ "text", FILTER_XML_TEXT },
};
@@ -243,6 +244,9 @@ load_optionvalue(struct filter_desc *desc, xmlNodePtr node)
case FILTER_XML_FOLDER:
arg = filter_arg_folder_new(desc->varname);
break;
+ case FILTER_XML_STRING:
+ arg = filter_arg_string_new(desc->varname);
+ break;
default:
d(printf("ok, maybe we're not\n"));
/* unknown arg type, drop it */
@@ -458,6 +462,9 @@ filter_optionrule_new_from_rule(struct filter_rule *rule)
case FILTER_XML_FOLDER:
arg = filter_arg_folder_new(desc->varname);
break;
+ case FILTER_XML_STRING:
+ arg = filter_arg_string_new(desc->varname);
+ break;
}
if (arg) {
or->args = g_list_append(or->args, arg);
@@ -568,7 +575,7 @@ GList *filter_load_optionset_file(const char *name, GList *rules)
int filter_write_optionset_file(const char *name, GList *optionl)
{
xmlDocPtr out;
- xmlDocPtr optionset;
+ xmlNodePtr optionset;
xmlNodePtr filteroptions;
int ret;
diff --git a/filter/filter-xml.h b/filter/filter-xml.h
index ce8a5ffc3a..00b4758feb 100644
--- a/filter/filter-xml.h
+++ b/filter/filter-xml.h
@@ -22,6 +22,7 @@ enum filter_xml_token {
FILTER_XML_RECEIVE,
FILTER_XML_ADDRESS,
FILTER_XML_FOLDER,
+ FILTER_XML_STRING,
FILTER_XML_NAME,
FILTER_XML_MATCH,
FILTER_XML_ACTION,
diff --git a/filter/filtertypes.xml b/filter/filtertypes.xml
index dcba45dc00..2a94de574f 100644
--- a/filter/filtertypes.xml
+++ b/filter/filtertypes.xml
@@ -20,14 +20,14 @@
<code>
(match-all (header-contains "Subject" ${words}))
</code>
- <description lang="en">The Subject contains <source type="folder" name="words">words</source>.</description>
+ <description lang="en">The Subject contains <source type="string" name="words">words</source>.</description>
</rule>
<rule name="body-contains">
<code>
(match-all (body-contains ${words}))
</code>
- <description lang="en">The body contains <source type="folder" name="words">words</source>.</description>
+ <description lang="en">The body contains <source type="string" name="words">words</source>.</description>
</rule>
<rule name="cc-address">
@@ -85,7 +85,7 @@
<code>
(match-all (not (body-contains ${words})))
</code>
- <description lang="en">The body does not contain <source type="folder" name="words">words</source>.</description>
+ <description lang="en">The body does not contain <source type="string" name="words">words</source>.</description>
</rule>
</ruleset>
diff --git a/filter/vfoldertypes.xml b/filter/vfoldertypes.xml
index 537cbf9331..5363d6bfc4 100644
--- a/filter/vfoldertypes.xml
+++ b/filter/vfoldertypes.xml
@@ -20,14 +20,14 @@
<code>
(match-all (header-contains "Subject" ${words}))
</code>
- <description lang="en">The Subject contains <source type="folder" name="words">words</source>.</description>
+ <description lang="en">The Subject contains <source type="string" name="words">words</source>.</description>
</rule>
<rule name="body-contains">
<code>
(match-all (body-contains ${words}))
</code>
- <description lang="en">The body contains <source type="folder" name="words">words</source>.</description>
+ <description lang="en">The body contains <source type="string" name="words">words</source>.</description>
</rule>
<rule name="cc-address">
@@ -50,7 +50,7 @@
<code>
(match-all (not (body-contains ${words})))
</code>
- <description lang="en">The body does not contain <source type="folder" name="words">words</source>.</description>
+ <description lang="en">The body does not contain <source type="string" name="words">words</source>.</description>
</rule>
</ruleset>