aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-autofilter.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-03-31 18:09:04 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-03-31 18:09:04 +0800
commit9e126a8d01dd36a19ab34a9d3edf016897b12d7e (patch)
tree9a57659490abf68cb1abd341a0d939f30fc1074e /mail/mail-autofilter.c
parentd239a18ce4bff4bd07c17118ca429f5020fc1731 (diff)
downloadgsoc2013-evolution-9e126a8d01dd36a19ab34a9d3edf016897b12d7e.tar
gsoc2013-evolution-9e126a8d01dd36a19ab34a9d3edf016897b12d7e.tar.gz
gsoc2013-evolution-9e126a8d01dd36a19ab34a9d3edf016897b12d7e.tar.bz2
gsoc2013-evolution-9e126a8d01dd36a19ab34a9d3edf016897b12d7e.tar.lz
gsoc2013-evolution-9e126a8d01dd36a19ab34a9d3edf016897b12d7e.tar.xz
gsoc2013-evolution-9e126a8d01dd36a19ab34a9d3edf016897b12d7e.tar.zst
gsoc2013-evolution-9e126a8d01dd36a19ab34a9d3edf016897b12d7e.zip
Cleaned up header inclusions and added plenty of forward declarations.
2004-03-31 Not Zed <NotZed@Ximian.com> * *.[ch]: Cleaned up header inclusions and added plenty of forward declarations. Sped up complete re-compilation by upto 20%. ** See bug #55950. * em-utils.c (em_utils_in_addressbook): utility for checking if an email address is in the addressbook. I can't tell if it works 'cause it crashes eds. * em-format-html.c (emfh_gethttp): handle addressbook checking. 2004-03-30 Not Zed <NotZed@Ximian.com> * mail-config.h: clean up the headers and use some forward decl's instead. * em-format-html.c (em_format_html_set_load_http): change state to an int 'style' instead. * em-folder-view.c (emfv_setting_notify): set the format load http option to the config value directly. ** See bug #56147. * message-list.c (clear_info): set the node data to NULL when we unref its data. (ml_get_save_id): use a different test for the root node, and return NULL if we don't have any data on the node (because we're cleaing it). ** See bug #54962. * em-folder-tree.c (emft_popup_new_folder_response): put back the old hack to open the vfolder editor if you try to create a folder under vfolders. ** See bug #55940. * mail-autofilter.c (mail_filter_rename_uri): map the uri to an email uri before passing to filter code. (mail_filter_delete_uri): same here. svn path=/trunk/; revision=25261
Diffstat (limited to 'mail/mail-autofilter.c')
-rw-r--r--mail/mail-autofilter.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index 394cb46dd5..d6c5b8e462 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -378,17 +378,20 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag
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;
GList *changed;
-
+ char *eolduri, *enewuri;
+
+ eolduri = em_uri_from_camel(olduri);
+ enewuri = em_uri_from_camel(newuri);
+
fc = filter_context_new ();
user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
rule_context_load ((RuleContext *)fc, system, user);
- changed = rule_context_rename_uri((RuleContext *)fc, olduri, newuri, uri_cmp);
+ changed = rule_context_rename_uri((RuleContext *)fc, eolduri, enewuri, g_str_equal);
if (changed) {
printf("Folder rename '%s' -> '%s' changed filters, resaving\n", olduri, newuri);
if (rule_context_save((RuleContext *)fc, user) == -1)
@@ -397,23 +400,28 @@ mail_filter_rename_uri(CamelStore *store, const char *olduri, const char *newuri
}
g_free(user);
- g_object_unref (fc);
+ g_object_unref(fc);
+
+ g_free(enewuri);
+ g_free(eolduri);
}
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;
GList *deleted;
-
+ char *euri;
+
+ euri = em_uri_from_camel(uri);
+
fc = filter_context_new ();
user = g_strdup_printf ("%s/mail/filters.xml", mail_component_peek_base_directory (mail_component_peek ()));
system = EVOLUTION_PRIVDATADIR "/filtertypes.xml";
rule_context_load ((RuleContext *)fc, system, user);
- deleted = rule_context_delete_uri ((RuleContext *) fc, uri, uri_cmp);
+ deleted = rule_context_delete_uri ((RuleContext *) fc, euri, g_str_equal);
if (deleted) {
GtkWidget *dialog;
GString *s;
@@ -426,7 +434,7 @@ mail_filter_delete_uri(CamelStore *store, const char *uri)
l = l->next;
}
g_string_append_printf (s, _("Used the removed folder:\n '%s'\n"
- "And have been updated."), uri);
+ "And have been updated."), euri);
dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE, "%s", s->str);
@@ -436,12 +444,13 @@ mail_filter_delete_uri(CamelStore *store, const char *uri)
gtk_widget_show (dialog);
- printf("Folder deleterename '%s' changed filters, resaving\n", uri);
+ printf("Folder deleterename '%s' changed filters, resaving\n", euri);
if (rule_context_save ((RuleContext *) fc, user) == -1)
g_warning ("Could not write out changed filter rules\n");
rule_context_free_uri_list ((RuleContext *) fc, deleted);
}
- g_free (user);
- g_object_unref (fc);
+ g_free(user);
+ g_object_unref(fc);
+ g_free(euri);
}