aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNotZed <NotZed@HelixCode.com>2000-05-17 12:09:07 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-05-17 12:09:07 +0800
commitba7f533031784b4c46d744f6e0bae9fe7feee981 (patch)
tree4f66fea2f834948957bcef866879ff1746fe31e2
parent07f1218fa41afb5c737b80cb036abdcdf4c42534 (diff)
downloadgsoc2013-evolution-ba7f533031784b4c46d744f6e0bae9fe7feee981.tar.gz
gsoc2013-evolution-ba7f533031784b4c46d744f6e0bae9fe7feee981.tar.zst
gsoc2013-evolution-ba7f533031784b4c46d744f6e0bae9fe7feee981.zip
Fix some html formatting.
2000-05-17 NotZed <NotZed@HelixCode.com> * filter-druid.c: Fix some html formatting. 2000-05-16 NotZed <NotZed@HelixCode.com> * filter-driver.c (filter_driver_run): Delete all processed messages. This is probably going to slow it down a bit. (filter_driver_run): Close folders before destroying them *sigh*. (open_folder): Actually open the folder. Doh. svn path=/trunk/; revision=3101
-rw-r--r--filter/ChangeLog9
-rw-r--r--filter/filter-driver.c52
-rw-r--r--filter/filter-driver.h2
-rw-r--r--filter/filter-druid.c6
-rw-r--r--filter/filter-xml.c3
5 files changed, 49 insertions, 23 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog
index b483b6ba84..d88acdccad 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,5 +1,14 @@
+2000-05-17 NotZed <NotZed@HelixCode.com>
+
+ * filter-druid.c: Fix some html formatting.
+
2000-05-16 NotZed <NotZed@HelixCode.com>
+ * filter-driver.c (filter_driver_run): Delete all processed
+ messages. This is probably going to slow it down a bit.
+ (filter_driver_run): Close folders before destroying them *sigh*.
+ (open_folder): Actually open the folder. Doh.
+
* filtertypes.xml: Initial filter rules.
* filter-xml.c (filter_write_optionset): Save the description
diff --git a/filter/filter-driver.c b/filter/filter-driver.c
index 94c69c93b0..ce836a16d4 100644
--- a/filter/filter-driver.c
+++ b/filter/filter-driver.c
@@ -195,6 +195,8 @@ int filter_driver_set_rules(FilterDriver *d, const char *description, const char
struct _FilterDriverPrivate *p = _PRIVATE(d);
xmlDocPtr desc, filt;
+ printf("Loading system '%s'\nLoading user '%s'\n", description, filter);
+
#warning "fix leaks, free xml docs here"
desc = xmlParseFile(description);
p->rules = filter_load_ruleset(desc);
@@ -387,7 +389,7 @@ do_copy(struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *d)
int i;
struct _FilterDriverPrivate *p = _PRIVATE(d);
- printf("doing copy on the following messages to:");
+ printf("doing copy\n");
for (i=0;i<argc;i++) {
if (argv[i]->type == ESEXP_RES_STRING) {
char *folder = argv[i]->value.string;
@@ -468,12 +470,21 @@ open_folder(FilterDriver *d, const char *folder_url)
goto fail;
}
- g_free(store);
-
if (!camel_folder_exists(camelfolder, p->ex)) {
camel_folder_create(camelfolder, p->ex);
}
+ camel_folder_open(camelfolder, FOLDER_OPEN_RW, p->ex);
+
+ if (camel_exception_get_id (p->ex)) {
+ printf ("Could not open folder: %s: %s", folder, camel_exception_get_description (p->ex));
+ goto fail;
+ }
+
+ printf("opening folder: %s\n", folder_url);
+
+ g_free(store);
+
g_hash_table_insert(p->folders, g_strdup(folder_url), camelfolder);
return camelfolder;
@@ -490,6 +501,8 @@ close_folder(void *key, void *value, void *data)
FilterDriver *d = data;
struct _FilterDriverPrivate *p = _PRIVATE(d);
+ printf("closing folder: %s\n", key);
+
g_free(key);
camel_folder_close(f, TRUE, p->ex);
gtk_object_unref((GtkObject *)f);
@@ -518,6 +531,7 @@ filter_driver_run(FilterDriver *d, CamelFolder *source, CamelFolder *inbox)
GString *s, *a;
GList *all, *m;
+#warning "This must be made mega-robust"
p->source = source;
/* setup runtime data */
@@ -543,6 +557,8 @@ filter_driver_run(FilterDriver *d, CamelFolder *source, CamelFolder *inbox)
while (m) {
GList *n = m->next;
+ printf("matched: %s\n", m->data);
+
/* for all matching id's, so we can work out what to default */
if (g_hash_table_lookup(p->processed, m->data) == NULL) {
g_hash_table_insert(p->processed, g_strdup(m->data), (void *)1);
@@ -569,33 +585,35 @@ filter_driver_run(FilterDriver *d, CamelFolder *source, CamelFolder *inbox)
options = g_list_next(options);
}
- /* apply the default of copying to an inbox, if we are given one */
- if (inbox) {
- all = camel_folder_get_uid_list(p->source, p->ex);
- m = all;
- while (m) {
- char *uid = m->data;
-
- if (g_hash_table_lookup(p->processed, uid) == NULL) {
- CamelMimeMessage *mm;
+ /* apply the default of copying to an inbox, if we are given one, and make sure
+ we delete everything as well */
+ all = camel_folder_get_uid_list(p->source, p->ex);
+ m = all;
+ while (m) {
+ char *uid = m->data, *procuid;
+ CamelMimeMessage *mm;
+ procuid = g_hash_table_lookup(p->processed, uid);
+ if (procuid == NULL) {
+ if (inbox) {
printf("Applying default rule to message %s\n", uid);
mm = camel_folder_get_message_by_uid(p->source, m->data, p->ex);
camel_folder_append_message(inbox, mm, p->ex);
+ camel_mime_message_set_flags(mm, CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED);
gtk_object_unref((GtkObject *)mm);
-
}
- m = m->next;
+ } else {
+ camel_folder_delete_message_by_uid(p->source, uid, p->ex);
}
- g_list_free(all);
+ m = m->next;
}
+ g_list_free(all);
g_hash_table_destroy(p->processed);
g_hash_table_destroy(p->terminated);
- g_hash_table_destroy(p->folders);
-
close_folders(d);
+ g_hash_table_destroy(p->folders);
return 0;
}
diff --git a/filter/filter-driver.h b/filter/filter-driver.h
index 0d87a4586a..dc670bc85e 100644
--- a/filter/filter-driver.h
+++ b/filter/filter-driver.h
@@ -49,7 +49,7 @@ guint filter_driver_get_type (void);
FilterDriver *filter_driver_new (void);
void filter_driver_set_session(FilterDriver *, CamelSession *);
-int filter_driver_set_rules(FilterDriver *, const char *description, const char *filter);
+int filter_driver_set_rules(FilterDriver *, const char *system, const char *filter);
void filter_driver_set_global(FilterDriver *, const char *name, const char *value);
/* apply rules to a folder, unmatched messages goto inbox, if not NULL */
diff --git a/filter/filter-druid.c b/filter/filter-druid.c
index 5dfd66acca..43e7d1e705 100644
--- a/filter/filter-druid.c
+++ b/filter/filter-druid.c
@@ -185,9 +185,9 @@ static int display_order[] = {
FILTER_XML_ACTION,
};
static char *display_pretext[] = {
- "<b>For messages matching:</b><br><ul>",
- "<b>Unless:</b><br><ul>",
- "<b>Perform these actions:</b><br><ul>",
+ "<b>For messages matching:</b><ul>",
+ "<b>Unless:</b><ul>",
+ "<b>Perform these actions:</b><ul>",
};
static char *display_posttext[] = {
"</ul>",
diff --git a/filter/filter-xml.c b/filter/filter-xml.c
index ada718778e..1979ab76f7 100644
--- a/filter/filter-xml.c
+++ b/filter/filter-xml.c
@@ -342,8 +342,7 @@ write_description(xmlDocPtr doc, GList *descl)
desc = descl->data;
d = xmlNewDocNode(doc, NULL, "description", NULL);
- if (desc->type == FILTER_XML_TEXT)
- xmlNodeSetContent(d, desc->data);
+ xmlNodeSetContent(d, desc->data);
return d;
}