diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2010-07-15 18:24:01 +0800 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-07-15 23:48:45 +0800 |
commit | ff8615ec0ad504b3fb81784747b82fca42ed1457 (patch) | |
tree | 3fcd2114e1e3c2e5b7e307498e4300457881f0dd | |
parent | 8ae4bf802aac4218ebfbe10cae09693ba64c05f3 (diff) | |
download | gsoc2013-evolution-ff8615ec0ad504b3fb81784747b82fca42ed1457.tar gsoc2013-evolution-ff8615ec0ad504b3fb81784747b82fca42ed1457.tar.gz gsoc2013-evolution-ff8615ec0ad504b3fb81784747b82fca42ed1457.tar.bz2 gsoc2013-evolution-ff8615ec0ad504b3fb81784747b82fca42ed1457.tar.lz gsoc2013-evolution-ff8615ec0ad504b3fb81784747b82fca42ed1457.tar.xz gsoc2013-evolution-ff8615ec0ad504b3fb81784747b82fca42ed1457.tar.zst gsoc2013-evolution-ff8615ec0ad504b3fb81784747b82fca42ed1457.zip |
Don't show the "reply in private?" nag popup for munged Reply-To: list messages
-rw-r--r-- | mail/e-mail-reader.c | 62 | ||||
-rw-r--r-- | mail/em-composer-utils.c | 41 | ||||
-rw-r--r-- | mail/em-composer-utils.h | 1 |
3 files changed, 84 insertions, 20 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index 74f0e7c544..7e3ac3950e 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -920,15 +920,24 @@ action_mail_reply_list_cb (GtkAction *action, } static void -action_mail_reply_sender_cb (GtkAction *action, - EMailReader *reader) +action_mail_reply_sender_check(CamelFolder *folder, const gchar *uid, CamelMimeMessage *message, gpointer user_data) { + GConfClient *gconf = mail_config_get_gconf_client (); + EMailReader *reader = user_data; gint mode = REPLY_MODE_SENDER; - GConfClient *gconf; - gconf = mail_config_get_gconf_client (); - if (gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/private_list_reply", NULL) && - e_mail_reader_check_state(reader) & E_MAIL_READER_SELECTION_IS_MAILING_LIST) { + if (!message) + return; + + /* get_message_free() will unref the message, so we need to take an + extra ref for e_mail_reader_reply_to_message() to own. */ + g_object_ref(message); + + /* Don't do the "Are you sure you want to reply in private?" pop-up if + it's a Reply-To: munged list message... unless we're ignoring munging */ + if (gconf_client_get_bool (gconf, + "/apps/evolution/mail/composer/ignore_list_reply_to", NULL) + || !em_utils_is_munged_list_message (message)) { GtkDialog *dialog; GtkWidget *content_area, *check; gint response; @@ -957,7 +966,46 @@ action_mail_reply_sender_cb (GtkAction *action, else if (response == GTK_RESPONSE_CANCEL) return; } - e_mail_reader_reply_to_message (reader, NULL, mode); + + e_mail_reader_reply_to_message (reader, message, mode); +} + +static void +action_mail_reply_sender_cb (GtkAction *action, + EMailReader *reader) +{ + GConfClient *gconf; + + gconf = mail_config_get_gconf_client (); + if (gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/private_list_reply", NULL) && + e_mail_reader_check_state(reader) & E_MAIL_READER_SELECTION_IS_MAILING_LIST) { + CamelMimeMessage *message = NULL; + EWebView *web_view; + EMFormatHTML *formatter; + + formatter = e_mail_reader_get_formatter (reader); + web_view = em_format_html_get_web_view (formatter); + if (gtk_widget_get_mapped (GTK_WIDGET(web_view))) + message = CAMEL_MIME_MESSAGE (EM_FORMAT (formatter)->message); + + if (!message) { + CamelFolder *folder; + GtkWidget *message_list; + gchar *uid; + + folder = e_mail_reader_get_folder (reader); + message_list = e_mail_reader_get_message_list (reader); + + uid = MESSAGE_LIST (message_list)->cursor_uid; + g_return_if_fail (uid != NULL); + + mail_get_message(folder, uid, action_mail_reply_sender_check, reader, mail_msg_unordered_push); + return; + } + action_mail_reply_sender_check(NULL, NULL, message, reader); + return; + } + e_mail_reader_reply_to_message (reader, NULL, REPLY_MODE_SENDER); } static void diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c index 4884432492..4bc91c65a0 100644 --- a/mail/em-composer-utils.c +++ b/mail/em-composer-utils.c @@ -1776,19 +1776,15 @@ get_reply_list (CamelMimeMessage *message, CamelInternetAddress *to) return TRUE; } -static CamelInternetAddress * -get_reply_to (CamelMimeMessage *message) +gboolean +em_utils_is_munged_list_message(CamelMimeMessage *message) { - CamelInternetAddress *reply_to; - GConfClient *gconf; - gboolean ignore_list_reply_to; - - gconf = mail_config_get_gconf_client (); - ignore_list_reply_to = gconf_client_get_bool (gconf, "/apps/evolution/mail/composer/ignore_list_reply_to", NULL); + CamelInternetAddress *reply_to, *list; + gboolean result = FALSE; reply_to = camel_mime_message_get_reply_to (message); - if (reply_to && ignore_list_reply_to) { - CamelInternetAddress *list = camel_internet_address_new (); + if (reply_to) { + list = camel_internet_address_new (); if (get_reply_list (message, list) && camel_address_length (CAMEL_ADDRESS(list)) == camel_address_length (CAMEL_ADDRESS(reply_to))) { @@ -1804,12 +1800,31 @@ get_reply_to (CamelMimeMessage *message) if (strcmp (l_addr, r_addr)) break; } - if (i == camel_address_length (CAMEL_ADDRESS(list))) { - reply_to = NULL; - } + if (i == camel_address_length (CAMEL_ADDRESS(list))) + result = TRUE; } g_object_unref (list); } + return result; +} + +static CamelInternetAddress * +get_reply_to (CamelMimeMessage *message) +{ + CamelInternetAddress *reply_to; + + reply_to = camel_mime_message_get_reply_to (message); + if (reply_to) { + GConfClient *gconf; + gboolean ignore_list_reply_to; + + gconf = mail_config_get_gconf_client (); + ignore_list_reply_to = gconf_client_get_bool (gconf, + "/apps/evolution/mail/composer/ignore_list_reply_to", NULL); + + if (ignore_list_reply_to && em_utils_is_munged_list_message (message)) + reply_to = NULL; + } if (!reply_to) reply_to = camel_mime_message_get_from (message); diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h index 1a8c48038b..a1d2da374d 100644 --- a/mail/em-composer-utils.h +++ b/mail/em-composer-utils.h @@ -59,6 +59,7 @@ enum { }; gchar *em_utils_construct_composer_text (CamelMimeMessage *message, EMFormat *source); +gboolean em_utils_is_munged_list_message (CamelMimeMessage *message); void em_utils_get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto); void em_utils_get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInternetAddress *cc, CamelNNTPAddress *postto); EMsgComposer * em_utils_reply_to_message (CamelFolder *, const gchar *uid, CamelMimeMessage *message, gint mode, EMFormat *source); |