diff options
author | Not Zed <NotZed@Ximian.com> | 2002-08-06 10:45:07 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-08-06 10:45:07 +0800 |
commit | abafd9de4f2e7f63ec522aae1009a671cb19425c (patch) | |
tree | c1e2bed3b503d952f824d6db055e0af2a61fb162 /mail/mail-autofilter.c | |
parent | 4e8deb5e4cb135b2e4f6eed3e1ab8b51fa4228fd (diff) | |
download | gsoc2013-evolution-abafd9de4f2e7f63ec522aae1009a671cb19425c.tar.gz gsoc2013-evolution-abafd9de4f2e7f63ec522aae1009a671cb19425c.tar.zst gsoc2013-evolution-abafd9de4f2e7f63ec522aae1009a671cb19425c.zip |
Unref the driver before returning to main thread, so any closing
2002-08-06 Not Zed <NotZed@Ximian.com>
* mail-ops.c (filter_folder_filter): Unref the driver before
returning to main thread, so any closing operations are handled
async (as in fetch_mail_fetch()), for #28072.
** fixes for #24605.
* mail-vfolder.c (vfolder_gui_add_from_mlist): Removed.
* folder-browser.c (filter_type_uid,vfolder_type_uid): Changed to
accept args directly. Fixed callers.
(filter_mlist_uid,vfolder_mlist_uid): Use filter_type_uid instead
of mlist variant.
(vfolder_type_current): new function to handle setup of vfolders
from the main menu. It now uses the vfolder_type_uid function the
same as the popup.
(vfolder_subject, vfolder_sender, vfolder_recipient,
vfolder_mlist): Changed to use vfolder_type_current.
(filter_type_current): Similar for filters.
(filter_subject, filter_sender, filter_recipient,
filter_mlist): Changed to use filter_type_current.
* mail-autofilter.c (rule_from_message): Handle AUTO_MLIST type.
(rule_from_mlist):
(vfolder_rule_from_mlist):
(filter_rule_from_mlist): Removed.
(filter_gui_add_from_mlist): Removed.
* mail-autofilter.h: Added AUTO_MLIST type.
svn path=/trunk/; revision=17704
Diffstat (limited to 'mail/mail-autofilter.c')
-rw-r--r-- | mail/mail-autofilter.c | 99 |
1 files changed, 31 insertions, 68 deletions
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index a4807b1f32..cb69a420fb 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -208,6 +208,25 @@ rule_match_subject (RuleContext *context, FilterRule *rule, const char *subject) } static void +rule_match_mlist(RuleContext *context, FilterRule *rule, const char *mlist) +{ + FilterPart *part; + FilterElement *element; + + if (mlist[0] == 0) + return; + + part = rule_context_create_part(context, "mlist"); + filter_rule_add_part(rule, part); + + element = filter_part_find_element(part, "mlist-type"); + filter_option_set_current((FilterOption *)element, "is"); + + element = filter_part_find_element (part, "mlist"); + filter_input_set_value((FilterInput *)element, mlist); +} + +static void rule_from_message (FilterRule *rule, RuleContext *context, CamelMimeMessage *msg, int flags) { CamelInternetAddress *addr; @@ -247,6 +266,18 @@ rule_from_message (FilterRule *rule, RuleContext *context, CamelMimeMessage *msg addr = (CamelInternetAddress *)camel_mime_message_get_recipients (msg, CAMEL_RECIPIENT_TYPE_CC); rule_match_recipients (context, rule, addr); } + if (flags & AUTO_MLIST) { + char *name, *mlist; + + mlist = header_raw_check_mailing_list(&((CamelMimePart *)msg)->headers); + if (mlist) { + rule_match_mlist(context, rule, mlist); + name = g_strdup_printf(U_("%s mailing list"), mlist); + filter_rule_set_name(rule, name); + g_free(name); + } + g_free(mlist); + } } FilterRule * @@ -276,54 +307,6 @@ filter_rule_from_message (FilterContext *context, CamelMimeMessage *msg, int fla return (FilterRule *)rule; } -static void -rule_from_mlist(FilterRule *rule, RuleContext *context, const char *mlist) -{ - FilterPart *part; - FilterElement *element; - char *rule_name; - - part = rule_context_create_part(context, "mlist"); - filter_rule_add_part(rule, part); - - element = filter_part_find_element(part, "mlist-type"); - filter_option_set_current((FilterOption *)element, "is"); - - element = filter_part_find_element (part, "mlist"); - filter_input_set_value((FilterInput *)element, mlist); - - rule_name = g_strdup_printf(U_("%s mailing list"), mlist); - filter_rule_set_name((FilterRule *) rule, rule_name); - g_free (rule_name); -} - -FilterRule * -vfolder_rule_from_mlist(VfolderContext *context, const char *mlist, const char *source) -{ - VfolderRule *rule; - - rule = vfolder_rule_new (); - vfolder_rule_add_source (rule, source); - rule_from_mlist((FilterRule *)rule, (RuleContext *)context, mlist); - - return (FilterRule *)rule; -} - -FilterRule * -filter_rule_from_mlist (FilterContext *context, const char *mlist) -{ - FilterFilter *rule; - FilterPart *part; - - rule = filter_filter_new (); - rule_from_mlist((FilterRule *)rule, (RuleContext *)context, mlist); - - part = filter_context_next_action (context, NULL); - filter_filter_add_action (rule, filter_part_clone (part)); - - return (FilterRule *)rule; -} - void filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flags) { @@ -347,26 +330,6 @@ filter_gui_add_from_message (CamelMimeMessage *msg, const char *source, int flag } void -filter_gui_add_from_mlist (const char *source, const char *mlist) -{ - FilterContext *fc; - char *user, *system; - FilterRule *rule; - - 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); - rule = filter_rule_from_mlist(fc, mlist); - - filter_rule_set_source (rule, source); - - rule_context_add_rule_gui ((RuleContext *)fc, rule, _("Add Filter Rule"), user); - 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; |