diff options
author | Dan Winship <danw@src.gnome.org> | 2000-07-06 01:00:59 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2000-07-06 01:00:59 +0800 |
commit | 54376bf2c76cacef3e677a3bccfaf063bdde8c5d (patch) | |
tree | b98e18344e6e0c5c0f35a476cfa3344dd453d082 | |
parent | 55ad9bc04f1dcf2f0420d5bd1a69d1e3d0f08853 (diff) | |
download | gsoc2013-evolution-54376bf2c76cacef3e677a3bccfaf063bdde8c5d.tar gsoc2013-evolution-54376bf2c76cacef3e677a3bccfaf063bdde8c5d.tar.gz gsoc2013-evolution-54376bf2c76cacef3e677a3bccfaf063bdde8c5d.tar.bz2 gsoc2013-evolution-54376bf2c76cacef3e677a3bccfaf063bdde8c5d.tar.lz gsoc2013-evolution-54376bf2c76cacef3e677a3bccfaf063bdde8c5d.tar.xz gsoc2013-evolution-54376bf2c76cacef3e677a3bccfaf063bdde8c5d.tar.zst gsoc2013-evolution-54376bf2c76cacef3e677a3bccfaf063bdde8c5d.zip |
Add uids to the "processed" list only after succesfully doing something
* filter-driver.c (do_delete, do_copy, do_stop,
filter_driver_run): Add uids to the "processed" list only after
succesfully doing something with them. Fixes the problem where
copying a message to a folder that didn't exist would result in it
disapearing.
svn path=/trunk/; revision=3887
-rw-r--r-- | filter/ChangeLog | 8 | ||||
-rw-r--r-- | filter/filter-driver.c | 28 |
2 files changed, 22 insertions, 14 deletions
diff --git a/filter/ChangeLog b/filter/ChangeLog index c8f664298a..71b5807649 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,11 @@ +2000-07-05 Dan Winship <danw@helixcode.com> + + * filter-driver.c (do_delete, do_copy, do_stop, + filter_driver_run): Add uids to the "processed" list only after + succesfully doing something with them. Fixes the problem where + copying a message to a folder that didn't exist would result in it + disapearing. + 2000-07-02 Ettore Perazzoli <ettore@helixcode.com> * filter-driver.c (filter_driver_new): Don't free the ruleset nor diff --git a/filter/filter-driver.c b/filter/filter-driver.c index e42e93acbd..9fb3a78d7a 100644 --- a/filter/filter-driver.c +++ b/filter/filter-driver.c @@ -206,12 +206,6 @@ filter_driver_new (const char *system, const char *user, FilterFolderFetcher fet } else p->options = filter_load_optionset(filt, p->rules); -#warning "Zucchi: is this safe? Doesn't seem to cause problems..." -#if 0 - filter_load_ruleset_free (p->rules); - xmlFreeDoc (desc); -#endif - return new; } @@ -369,7 +363,10 @@ do_delete(struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver * while (m) { printf(" %s\n", (char *)m->data); - camel_folder_set_message_flags (p->source, m->data, CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED, p->ex); + camel_folder_delete_message (p->source, m->data, p->ex); + if (g_hash_table_lookup(p->processed, m->data) == NULL) { + g_hash_table_insert(p->processed, g_strdup(m->data), (void *)1); + } m = m->next; } @@ -423,6 +420,11 @@ do_copy(struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *d) camel_folder_append_message(outbox, mm, p->ex); gtk_object_unref((GtkObject *)mm); + if (!camel_exception_is_set(p->ex) && + g_hash_table_lookup(p->processed, m->data) == NULL) { + g_hash_table_insert(p->processed, g_strdup(m->data), (void *)1); + } + printf(" %s\n", (char *)m->data); m = m->next; } @@ -443,6 +445,9 @@ do_stop(struct _ESExp *f, int argc, struct _ESExpResult **argv, FilterDriver *d) while (m) { printf(" %s\n", (char *)m->data); g_hash_table_insert(p->terminated, g_strdup(m->data), (void *)1); + if (g_hash_table_lookup(p->processed, m->data) == NULL) { + g_hash_table_insert(p->processed, g_strdup(m->data), (void *)1); + } m = m->next; } return NULL; @@ -551,11 +556,6 @@ filter_driver_run(FilterDriver *d, CamelFolder *source, CamelFolder *inbox) printf("matched: %s\n", (char *) 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); - } - if (g_hash_table_lookup(p->terminated, m->data)) { printf("removing terminated message %s\n", (char *)m->data); p->matches = g_list_remove_link(p->matches, m); @@ -589,10 +589,10 @@ filter_driver_run(FilterDriver *d, CamelFolder *source, CamelFolder *inbox) if (inbox) { printf("Applying default rule to message %s\n", uid); - mm = camel_folder_get_message(p->source, all->pdata[i], p->ex); + mm = camel_folder_get_message(p->source, uid, p->ex); camel_folder_append_message(inbox, mm, p->ex); gtk_object_unref((GtkObject *)mm); - camel_folder_set_message_flags(p->source, all->pdata[i], CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_DELETED, p->ex); + camel_folder_delete_message(p->source, uid, p->ex); } } else { camel_folder_delete_message(p->source, uid, p->ex); |