diff options
-rw-r--r-- | mail/ChangeLog | 40 | ||||
-rw-r--r-- | mail/Makefile.am | 2 | ||||
-rw-r--r-- | mail/component-factory.c | 2 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 106 | ||||
-rw-r--r-- | mail/mail-autofilter.c | 84 | ||||
-rw-r--r-- | mail/mail-autofilter.h | 34 | ||||
-rw-r--r-- | mail/mail-mlist-magic.c | 252 | ||||
-rw-r--r-- | mail/mail-mlist-magic.h | 33 | ||||
-rw-r--r-- | mail/mail.h | 3 | ||||
-rw-r--r-- | mail/message-list.c | 24 | ||||
-rw-r--r-- | mail/message-thread.c | 1 |
11 files changed, 543 insertions, 38 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 58979df4d8..987bb3d49e 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,43 @@ +2000-09-12 Ettore Perazzoli <ettore@helixcode.com> + + * folder-browser-factory.c: Use the latest, shiny, amazing TigerT + art for the toolbar. + + * component-factory.c: #include "mail-local-storage.h". + (owner_set_cb): Removed unused variable. + + * message-list.c (filter_sender): Made static. + (filter_recipient): Likewise. + (filter_subject): Likewise. + (vfolder_recipient): Likewise. + (vfolder_sender): Likewise. + (vfolder_subject): Likewise. + + * mail.h (vfolder_subject): Removed prototype [WTF was this doing + here?!?!]. + (vfolder_sender): Likewise. + (vfolder_recipient): Likewise. + (filter_subject): Likewise. + (filter_sender): Likewise. + (filter_recipient): Likewise. + + * message-list.c: Added a new "Filter on mailing list" menu item. + (filter_mlist): Callback for this menu item. Use + `filter_gui_add_for_mailing_list' to pop up the filter dialog with + the appropriate rule. + + * mail-autofilter.c (filter_gui_add_for_mailing_list): New. + + * message-thread.c (dump_tree): Removed unused variable. + + * mail-mlist-magic.c: New. + * mail-mlist-magic.h: New. + + * mail-autofilter.c (rule_match_recipients): Mark strings for + translation. + (rule_from_message): Likewise. + (filter_gui_add_from_message): Likewise. + 2000-09-12 Jeffrey Stedfast <fejj@helixcode.com> * mail-ops.c (do_fetch_mail): Was trying to unhook an event from diff --git a/mail/Makefile.am b/mail/Makefile.am index 7c2d0f19c5..4769a52d3c 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -58,6 +58,8 @@ evolution_mail_SOURCES = \ mail-local.h \ mail-local-storage.c \ mail-local-storage.h \ + mail-mlist-magic.c \ + mail-mlist-magic.h \ mail-ops.c \ mail-ops.h \ mail-threads.c \ diff --git a/mail/component-factory.c b/mail/component-factory.c index 00879c93ce..30c58d602d 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -39,6 +39,7 @@ #include "mail-tools.h" #include "mail-ops.h" #include "e-util/e-gui-utils.h" +#include "mail-local-storage.h" #include "component-factory.h" @@ -111,7 +112,6 @@ owner_set_cb (EvolutionShellComponent *shell_component, { GSList *sources; Evolution_Shell corba_shell; - Evolution_LocalStorage corba_local_storage; g_print ("evolution-mail: Yeeeh! We have an owner!\n"); /* FIXME */ diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index a3f6095c03..ef8777cffd 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -29,30 +29,6 @@ /* The FolderBrowser BonoboControls we have. */ static GList *control_list = NULL; -static GnomeUIInfo gnome_toolbar [] = { - GNOMEUIINFO_ITEM_STOCK (N_("Get Mail"), N_("Send queued mail and retrieve new mail"), - send_receieve_mail, GNOME_STOCK_PIXMAP_MAIL_RCV), - GNOMEUIINFO_ITEM_STOCK (N_("Compose"), N_("Compose a new message"), compose_msg, GNOME_STOCK_PIXMAP_MAIL_NEW), - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_ITEM_STOCK (N_("Reply"), N_("Reply to the sender of this message"), reply_to_sender, GNOME_STOCK_PIXMAP_MAIL_RPL), - GNOMEUIINFO_ITEM_STOCK (N_("Reply to All"), N_("Reply to all recipients of this message"), reply_to_all, GNOME_STOCK_PIXMAP_MAIL_RPL), - - GNOMEUIINFO_ITEM_STOCK (N_("Forward"), N_("Forward this message"), forward_msg, GNOME_STOCK_PIXMAP_MAIL_FWD), - - GNOMEUIINFO_SEPARATOR, - - GNOMEUIINFO_ITEM_STOCK (N_("Move"), N_("Move message to a new folder"), move_msg, GNOME_STOCK_PIXMAP_MAIL_SND), - GNOMEUIINFO_ITEM_STOCK (N_("Copy"), N_("Copy message to a new folder"), copy_msg, GNOME_STOCK_PIXMAP_MAIL_SND), - - GNOMEUIINFO_ITEM_STOCK (N_("Print"), N_("Print the selected message"), print_msg, GNOME_STOCK_PIXMAP_PRINT), - - GNOMEUIINFO_ITEM_STOCK (N_("Delete"), N_("Delete this message"), delete_msg, GNOME_STOCK_PIXMAP_TRASH), - - GNOMEUIINFO_END -}; - static void register_ondemand (RuleContext *f, FilterRule *rule, gpointer data) { @@ -109,6 +85,82 @@ remove_ondemand_hooks (FolderBrowser *fb, BonoboUIHandler *uih) } static void +add_button_to_toolbar (GtkToolbar *toolbar, + const char *label, + const char *hint, + const char *icon, + GtkSignalFunc callback, + void *data) +{ + GtkWidget *pixmap; + GtkWidget *widget; + char *path; + + path = g_concat_dir_and_file (EVOLUTION_DATADIR "/images/evolution/buttons", icon); + pixmap = gnome_pixmap_new_from_file (path); + g_free (path); + + gtk_widget_show (pixmap); + + widget = gtk_toolbar_append_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON, NULL, label, hint, NULL, pixmap, NULL, NULL); + gtk_signal_connect (GTK_OBJECT (widget), "clicked", callback, data); +} + +static void +add_stock_button_to_toolbar (GtkToolbar *toolbar, + const char *label, + const char *hint, + const char *icon, + GtkSignalFunc callback, + void *data) +{ + GtkWidget *pixmap; + GtkWidget *widget; + + pixmap = gnome_stock_pixmap_widget_new (GTK_WIDGET (toolbar), icon); + gtk_widget_show (pixmap); + + widget = gtk_toolbar_append_element (toolbar, GTK_TOOLBAR_CHILD_BUTTON, NULL, label, hint, NULL, pixmap, NULL, NULL); + gtk_signal_connect (GTK_OBJECT (widget), "clicked", callback, data); +} + +static void +fill_toolbar (FolderBrowser *folder_browser, + GtkToolbar *toolbar) +{ + add_button_to_toolbar (toolbar, _("Get Mail"), _("Send queued mail and retrieve new mail"), + "fetch-mail.png", send_receieve_mail, folder_browser); + add_button_to_toolbar (toolbar, _("Compose"), _("Compose a new message"), + "compose-message.png", compose_msg, folder_browser); + + gtk_toolbar_append_space (toolbar); + add_button_to_toolbar (toolbar, _("Reply"), _("Reply to the sender of this message"), + "reply.png", reply_to_sender, folder_browser); + add_button_to_toolbar (toolbar, _("Reply to All"), _("Reply to all recipients of this message"), + "reply-to-all.png", reply_to_all, folder_browser); + add_button_to_toolbar (toolbar, _("Forward"), _("Forward this message"), + "forward.png", forward_msg, folder_browser); + + gtk_toolbar_append_space (toolbar); + + add_button_to_toolbar (toolbar, _("Move"), _("Move message to a new folder"), + "move-message.png", move_msg, folder_browser); + add_button_to_toolbar (toolbar, _("Copy"), _("Move message to a new folder"), + "copy-message.png", move_msg, folder_browser); + + gtk_toolbar_append_space (toolbar); + + add_stock_button_to_toolbar (toolbar, _("Print"), _("Print the selected message"), + GNOME_STOCK_PIXMAP_PRINT, print_msg, folder_browser); + add_stock_button_to_toolbar (toolbar, _("Delete"), _("Delete this message"), + GNOME_STOCK_PIXMAP_TRASH, delete_msg, folder_browser); + + gtk_toolbar_set_style (toolbar, GTK_TOOLBAR_BOTH); + gtk_toolbar_set_button_relief (toolbar, GTK_RELIEF_NONE); + gtk_widget_show_all (GTK_WIDGET (toolbar)); +} + +static void control_activate (BonoboControl *control, BonoboUIHandler *uih, FolderBrowser *fb) { @@ -289,11 +341,7 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih, toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH); - gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar), - gnome_toolbar, - NULL, folder_browser); - - gtk_widget_show_all (toolbar); + fill_toolbar (FOLDER_BROWSER (folder_browser), GTK_TOOLBAR (toolbar)); behavior = GNOME_DOCK_ITEM_BEH_EXCLUSIVE | GNOME_DOCK_ITEM_BEH_NEVER_VERTICAL; diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c index 2de013a448..2b46f4288e 100644 --- a/mail/mail-autofilter.c +++ b/mail/mail-autofilter.c @@ -1,6 +1,29 @@ -/* - code for autogenerating rules or filters from a message -*/ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* mail-autofilter.c + * + * Copyright (C) 2000 Helix Code, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: + * Michael Zucchi <notzed@helixcode.com> + * Ettore Perazzoli <ettore@helixcode.com> + */ + +/* Code for autogenerating rules or filters from a message. */ #include <ctype.h> @@ -49,7 +72,7 @@ rule_match_recipients(RuleContext *context, FilterRule *rule, CamelInternetAddre element = filter_part_find_element(part, "recipient"); filter_input_set_value((FilterInput *)element, addr); - namestr = g_strdup_printf("Mail to %s", real&&real[0]?real:addr); + namestr = g_strdup_printf(_("Mail to %s"), real&&real[0]?real:addr); filter_rule_set_name(rule, namestr); g_free(namestr); } @@ -203,7 +226,7 @@ rule_from_message(FilterRule *rule, RuleContext *context, CamelMimeMessage *msg, name = scan->name; else name = scan->v.addr; - namestr = g_strdup_printf("Mail from %s", name); + namestr = g_strdup_printf(_("Mail from %s"), name); filter_rule_set_name(rule, namestr); g_free(namestr); } @@ -257,9 +280,58 @@ filter_gui_add_from_message(CamelMimeMessage *msg, int flags) systemrules = g_strdup_printf("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR); rule_context_load((RuleContext *)fc, systemrules, userrules, NULL, NULL); rule = filter_rule_from_message(fc, msg, flags); - rule_context_add_rule_gui((RuleContext *)fc, rule, "Add Filter Rule", userrules); + rule_context_add_rule_gui((RuleContext *)fc, rule, _("Add Filter Rule"), userrules); g_free (userrules); g_free (systemrules); gtk_object_unref((GtkObject *)fc); } +void +filter_gui_add_for_mailing_list (CamelMimeMessage *msg, + const char *list_name, + const char *header_name, + const char *header_value) +{ + FilterContext *fc; + FilterRule *rule; + FilterPart *part; + FilterElement *element; + char *userrules, *systemrules; + char *rule_name; + extern char *evolution_dir; + + g_return_if_fail (msg != NULL); + g_return_if_fail (CAMEL_IS_MIME_MESSAGE (msg)); + g_return_if_fail (list_name != NULL); + g_return_if_fail (header_name != NULL); + g_return_if_fail (header_value != NULL); + + fc = filter_context_new(); + userrules = g_strdup_printf("%s/filters.xml", evolution_dir); + systemrules = g_strdup_printf("%s/evolution/filtertypes.xml", EVOLUTION_DATADIR); + rule_context_load((RuleContext *)fc, systemrules, userrules, NULL, NULL); + + rule = filter_rule_new (); + + part = rule_context_create_part((RuleContext *)fc, "header"); + filter_rule_add_part((FilterRule *)rule, part); + + element = filter_part_find_element(part, "header-field"); + filter_input_set_value((FilterInput *)element, header_name); + + element = filter_part_find_element(part, "header-type"); + filter_option_set_current((FilterOption *)element, "contains"); + + element = filter_part_find_element(part, "word"); + filter_input_set_value((FilterInput *)element, header_value); + + rule_name = g_strdup_printf (_("%s mailing list"), list_name); + filter_rule_set_name ((FilterRule *) rule, rule_name); + g_free (rule_name); + + rule_context_add_rule_gui ((RuleContext *)fc, rule, _("Add Filter Rule"), userrules); + + g_free (userrules); + g_free (systemrules); + gtk_object_unref((GtkObject *)fc); +} diff --git a/mail/mail-autofilter.h b/mail/mail-autofilter.h index 61df9273fd..5787b74c7c 100644 --- a/mail/mail-autofilter.h +++ b/mail/mail-autofilter.h @@ -1,3 +1,28 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* mail-autofilter.h + * + * Copyright (C) 2000 Helix Code, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Authors: + * Michael Zucchi <notzed@helixcode.com> + * Ettore Perazzoli <ettore@helixcode.com> + */ + #ifndef _MAIL_AUTOFILTER_H #define _MAIL_AUTOFILTER_H @@ -16,6 +41,13 @@ FilterRule *vfolder_rule_from_message(VfolderContext *context, CamelMimeMessage FilterRule *filter_rule_from_message(FilterContext *context, CamelMimeMessage *msg, int flags); /* easiest place to put this */ -void filter_gui_add_from_message(CamelMimeMessage *msg, int flags); + +void filter_gui_add_from_message (CamelMimeMessage *msg, + int flags); + +void filter_gui_add_for_mailing_list (CamelMimeMessage *msg, + const char *list_name, + const char *header_name, + const char *header_value); #endif diff --git a/mail/mail-mlist-magic.c b/mail/mail-mlist-magic.c new file mode 100644 index 0000000000..7385688f64 --- /dev/null +++ b/mail/mail-mlist-magic.c @@ -0,0 +1,252 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* mail-mlist-magic.c + * + * Copyright (C) 2000 Helix Code, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli + */ + +/* Procmail-style magic mail rules for mailing lists: (from Joakim's own + `.procmailrc'.) + + :0: + * ^Sender: owner-\/[^@]+ + lists/$MATCH + + :0: + * ^X-BeenThere: \/[^@]+ + lists/$MATCH + + :0: + * ^Delivered-To: mailing list \/[^@]+ + lists/$MATCH + + :0: + * X-Mailing-List: <\/[^@]+ + lists/$MATCH + + :0: + * X-Loop: \/[^@]+ + lists/$MATCH + +*/ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <string.h> +#include <ctype.h> + +#include "camel.h" + +#include "mail-mlist-magic.h" + + +/* Utility functions. */ + +static char * +extract_until_at_sign (const char *s) +{ + const char *at_sign; + + at_sign = strchr (s, '@'); + if (at_sign == NULL) + return g_strdup (s); + + if (at_sign == s) + return NULL; + + return g_strndup (s, at_sign - s); +} + +static const char * +get_header (CamelMimeMessage *message, + const char *header_name) +{ + const char *value; + + value = camel_medium_get_header (CAMEL_MEDIUM (message), "Sender"); + if (value == NULL) + return NULL; + + /* FIXME: Correct? */ + while (isspace ((int) *value)) + value++; + + return value; +} + + +/* The checks. */ + +/* ^Sender: owner-\/[^@]+ */ +static char * +check_sender (CamelMimeMessage *message, + const char **header_name_return, + char **header_value_return) +{ + const char *value; + + value = get_header (message, "Sender"); + if (value == NULL) + return NULL; + + if (strncmp (value, "owner-", 6) != 0) + return NULL; + + if (value[6] == '\0' || value[6] == '@') + return NULL; + + *header_name_return = "Sender"; + *header_value_return = g_strdup (value); + return extract_until_at_sign (value + 6); +} + +/* ^X-BeenThere: \/[^@]+ */ +static char * +check_x_been_there (CamelMimeMessage *message, + const char **header_name_return, + char **header_value_return) +{ + const char *value; + + value = get_header (message, "X-BeenThere"); + if (value == NULL || *value == '@') + return NULL; + + *header_name_return = "X-BeenThere"; + *header_value_return = g_strdup (value); + + return extract_until_at_sign (value); +} + +/* ^Delivered-To: mailing list \/[^@]+ */ +static char * +check_delivered_to (CamelMimeMessage *message, + const char **header_name_return, + char **header_value_return) +{ + const char *value; + + value = get_header (message, "Delivered-To"); + if (value == NULL) + return NULL; + + /* FIXME uh? */ + if (strncmp (value, "mailing list ", 13) != 0) + return NULL; + + if (value[13] == '\0' || value[13] == '@') + return NULL; + + *header_name_return = "Delivered-To"; + *header_value_return = g_strdup (value); + return extract_until_at_sign (value + 13); +} + +/* X-Mailing-List: <\/[^@]+ */ +static char * +check_x_mailing_list (CamelMimeMessage *message, + const char **header_name_return, + char **header_value_return) +{ + const char *value; + int value_length; + + value = get_header (message, "X-Mailing-List"); + if (value == NULL) + return NULL; + + if (value[0] != '<' || value[1] == '\0' || value[1] == '@') + return NULL; + + value_length = strlen (value); + if (value[value_length - 1] != '>') + return NULL; + + *header_name_return = "X-Mailing-List"; + *header_value_return = g_strdup (value); + return extract_until_at_sign (value + 1); +} + +/* X-Loop: \/[^@]+ */ +static char * +check_x_loop (CamelMimeMessage *message, + const char **header_name_return, + char **header_value_return) +{ + const char *value; + + value = get_header (message, "X-Loop"); + if (value == NULL) + return NULL; + + if (*value == '\0' || *value == '@') + return NULL; + + *header_name_return = "X-Loop"; + *header_value_return = g_strdup (value); + + return extract_until_at_sign (value); +} + + +/** + * mail_mlist_magic_detect_list: + * @message: + * @header_name_return: + * @header_value_return: + * + * Detect if message was delivered by a mailing list. + * + * Return value: The name of the mailing list, if the message appears to be + * sent from a mailing list. NULL otherwise. + **/ +char * +mail_mlist_magic_detect_list (CamelMimeMessage *message, + const char **header_name_return, + char **header_value_return) +{ + char *list_name; + + g_return_val_if_fail (message != NULL, NULL); + g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL); + + list_name = check_sender (message, header_name_return, header_value_return); + if (list_name != NULL) + return list_name; + + list_name = check_x_been_there (message, header_name_return, header_value_return); + if (list_name != NULL) + return list_name; + + list_name = check_delivered_to (message, header_name_return, header_value_return); + if (list_name != NULL) + return list_name; + + list_name = check_x_mailing_list (message, header_name_return, header_value_return); + if (list_name != NULL) + return list_name; + + list_name = check_x_loop (message, header_name_return, header_value_return); + if (list_name != NULL) + return list_name; + + return NULL; +} diff --git a/mail/mail-mlist-magic.h b/mail/mail-mlist-magic.h new file mode 100644 index 0000000000..dcfe3f4bfc --- /dev/null +++ b/mail/mail-mlist-magic.h @@ -0,0 +1,33 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* mail-mlist-magic.h + * + * Copyright (C) 2000 Helix Code, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Ettore Perazzoli + */ + +#ifndef MAIL_MLIST_MAGIC_H +#define MAIL_MLIST_MAGIC_H + +#include "camel.h" + +char *mail_mlist_magic_detect_list (CamelMimeMessage *message, + const char **header_name_return, + char **header_value_return); + +#endif diff --git a/mail/mail.h b/mail/mail.h index 029a00f603..a6c5baf630 100644 --- a/mail/mail.h +++ b/mail/mail.h @@ -17,6 +17,8 @@ * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. */ +/* This file is a F*CKING MESS. Shame to us! */ + #include <gtkhtml/gtkhtml.h> #include <libgnomevfs/gnome-vfs-mime-handlers.h> #include "camel/camel.h" @@ -124,3 +126,4 @@ void vfolder_recipient(GtkWidget *w, FolderBrowser *fb); void filter_subject(GtkWidget *w, FolderBrowser *fb); void filter_sender(GtkWidget *w, FolderBrowser *fb); void filter_recipient(GtkWidget *w, FolderBrowser *fb); +void filter_mlist(GtkWidget *w, FolderBrowser *fb); diff --git a/mail/message-list.c b/mail/message-list.c index 65f035fe5b..110f96912e 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -18,16 +18,20 @@ #include <e-util/e-popup-menu.h> #include <camel/camel-exception.h> #include <camel/camel-folder.h> + #include "message-list.h" #include "message-thread.h" #include "mail-threads.h" #include "mail-tools.h" +#include "mail-mlist-magic.h" #include "mail-ops.h" #include "mail-config.h" #include "mail-vfolder.h" #include "mail-autofilter.h" #include "mail.h" + #include "Mail.h" + #include "widgets/e-table/e-table-header-item.h" #include "widgets/e-table/e-table-item.h" @@ -1204,6 +1208,25 @@ filter_recipient(GtkWidget *w, FolderBrowser *fb) filter_gui_add_from_message(fb->mail_display->current_message, AUTO_TO); } +void +filter_mlist (GtkWidget *w, FolderBrowser *fb) +{ + char *name; + char *header_value; + const char *header_name; + + name = mail_mlist_magic_detect_list (fb->mail_display->current_message, &header_name, &header_value); + if (name == NULL) { + g_print ("No fucking mlist!\n"); + return; + } + + filter_gui_add_for_mailing_list (fb->mail_display->current_message, name, header_name, header_value); + + g_free (name); + g_free (header_value); +} + static gint on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, MessageList *list) { @@ -1230,6 +1253,7 @@ on_right_click (ETableScrolled *table, gint row, gint col, GdkEvent *event, Mess { "Filter on Subject", NULL, GTK_SIGNAL_FUNC (filter_subject), 2 }, { "Filter on Sender", NULL, GTK_SIGNAL_FUNC (filter_sender), 2 }, { "Filter on Recipients", NULL, GTK_SIGNAL_FUNC (filter_recipient), 2 }, + { "Filter on Mailing List", NULL, GTK_SIGNAL_FUNC (filter_mlist), 2 }, { NULL, NULL, NULL, 0 } }; diff --git a/mail/message-thread.c b/mail/message-thread.c index 1306fafe0c..5f8085839a 100644 --- a/mail/message-thread.c +++ b/mail/message-thread.c @@ -330,7 +330,6 @@ dump_tree_rec(struct _tree_info *info, struct _container *c, int depth) int dump_tree(struct _container *c) { - char *p; int count; struct _tree_info info; |