aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-autofilter.c
diff options
context:
space:
mode:
author8 <NotZed@Ximian.com>2001-10-28 18:53:02 +0800
committerMichael Zucci <zucchi@src.gnome.org>2001-10-28 18:53:02 +0800
commit4229e6849ddbb2ecef6bef8177203c9b90c98686 (patch)
tree47f5b887300c08292f1b17acd03bc6b20c967edb /mail/mail-autofilter.c
parent4ee4cf5693acf3ec206b9dda7ddaf772aa441489 (diff)
downloadgsoc2013-evolution-4229e6849ddbb2ecef6bef8177203c9b90c98686.tar
gsoc2013-evolution-4229e6849ddbb2ecef6bef8177203c9b90c98686.tar.gz
gsoc2013-evolution-4229e6849ddbb2ecef6bef8177203c9b90c98686.tar.bz2
gsoc2013-evolution-4229e6849ddbb2ecef6bef8177203c9b90c98686.tar.lz
gsoc2013-evolution-4229e6849ddbb2ecef6bef8177203c9b90c98686.tar.xz
gsoc2013-evolution-4229e6849ddbb2ecef6bef8177203c9b90c98686.tar.zst
gsoc2013-evolution-4229e6849ddbb2ecef6bef8177203c9b90c98686.zip
Remove uic, kill dumb warning.
2001-10-28 <NotZed@Ximian.com> * folder-browser-ui.c (fbui_sensitize_timeout): Remove uic, kill dumb warning. * mail-autofilter.c (mail_filter_rename_uri): Implement function for filters to keep track of uri's being renamed. (mail_filter_delete_uri): Similarly for deleting uri's. Note that these functions are just noops though. (real_flush_updates): Also rename and delete uri's from filters. (mls_delete_folder): Unref the store when done. (mls_rename_folder): Fix implementation, shell already created destination folder, so we can't just rename :( (xfer_folder): Manually call rename code, since the shell will do a remove/add later on, AND there's no way we can determine the new path from the crock of an api we have to work with. svn path=/trunk/; revision=14291
Diffstat (limited to 'mail/mail-autofilter.c')
-rw-r--r--mail/mail-autofilter.c48
1 files changed, 46 insertions, 2 deletions
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index 2eeafccf1d..43bba61c57 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -48,6 +48,8 @@
#include "filter/filter-editor.h"
#include "filter/filter-option.h"
+extern char *evolution_dir;
+
static void
rule_match_recipients (RuleContext *context, FilterRule *rule, CamelInternetAddress *iaddr)
{
@@ -319,7 +321,6 @@ filter_gui_add_from_message (CamelMimeMessage *msg, int flags)
FilterContext *fc;
char *user, *system;
FilterRule *rule;
- extern char *evolution_dir;
g_return_if_fail (msg != NULL);
@@ -342,7 +343,6 @@ filter_gui_add_from_mlist (const char *mlist)
FilterContext *fc;
char *user, *system;
FilterRule *rule;
- extern char *evolution_dir;
fc = filter_context_new ();
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
@@ -356,3 +356,47 @@ filter_gui_add_from_mlist (const char *mlist)
g_free (user);
gtk_object_unref (GTK_OBJECT (fc));
}
+
+void
+mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri)
+{
+ GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name;
+ FilterContext *fc;
+ char *user, *system;
+
+ fc = filter_context_new ();
+ user = g_strdup_printf ("%s/filters.xml", evolution_dir);
+ system = EVOLUTION_DATADIR "/evolution/filtertypes.xml";
+ rule_context_load ((RuleContext *)fc, system, user);
+
+ if (rule_context_rename_uri((RuleContext *)fc, olduri, newuri, uri_cmp) > 0) {
+ printf("Folder rename '%s' -> '%s' changed filters, resaving\n", olduri, newuri);
+ if (rule_context_save((RuleContext *)fc, user) == -1)
+ g_warning("Could not write out changed filter rules\n");
+ }
+
+ g_free(user);
+ gtk_object_unref (GTK_OBJECT (fc));
+}
+
+void
+mail_filter_delete_uri(CamelStore *store, const char *uri)
+{
+ GCompareFunc uri_cmp = CAMEL_STORE_CLASS(CAMEL_OBJECT_GET_CLASS(store))->compare_folder_name;
+ FilterContext *fc;
+ char *user, *system;
+
+ fc = filter_context_new ();
+ user = g_strdup_printf ("%s/filters.xml", evolution_dir);
+ system = EVOLUTION_DATADIR "/evolution/filtertypes.xml";
+ rule_context_load ((RuleContext *)fc, system, user);
+
+ if (rule_context_delete_uri((RuleContext *)fc, uri, uri_cmp) > 0) {
+ printf("Folder deleterename '%s' changed filters, resaving\n", uri);
+ if (rule_context_save((RuleContext *)fc, user) == -1)
+ g_warning("Could not write out changed filter rules\n");
+ }
+
+ g_free(user);
+ gtk_object_unref (GTK_OBJECT (fc));
+}