aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-07-16 00:20:16 +0800
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-07-16 00:20:16 +0800
commit51a41db621693114f5ee60d48e7e6442fc85fcc4 (patch)
treea9db9c3a0d3258b4b73d603028f1e76a998fd82e /mail
parent21b0925061702c0c2a6ee30819c739409bba39d2 (diff)
downloadgsoc2013-evolution-51a41db621693114f5ee60d48e7e6442fc85fcc4.tar.gz
gsoc2013-evolution-51a41db621693114f5ee60d48e7e6442fc85fcc4.tar.zst
gsoc2013-evolution-51a41db621693114f5ee60d48e7e6442fc85fcc4.zip
Add nag popup when mailing list hijacks private reply with Reply-To: header
Diffstat (limited to 'mail')
-rw-r--r--mail/e-mail-reader.c43
-rw-r--r--mail/em-composer-utils.c29
-rw-r--r--mail/em-composer-utils.h3
-rw-r--r--mail/evolution-mail.schemas.in12
-rw-r--r--mail/mail-config.ui15
-rw-r--r--mail/mail.error.xml8
6 files changed, 108 insertions, 2 deletions
diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c
index 9a6d5cb3ea..3548bfa962 100644
--- a/mail/e-mail-reader.c
+++ b/mail/e-mail-reader.c
@@ -980,6 +980,46 @@ action_mail_reply_sender_check(CamelFolder *folder, const gchar *uid, CamelMimeM
mode = REPLY_MODE_LIST;
else if (response == GTK_RESPONSE_CANCEL)
return;
+ } else if (gconf_client_get_bool(gconf, "/apps/evolution/mail/prompts/list_reply_to", NULL)) {
+ GtkDialog *dialog;
+ GtkWidget *content_area, *vbox, *check_again, *check_always_ignore;
+ gint response;
+
+ dialog = (GtkDialog*) e_alert_dialog_new_for_args (e_mail_reader_get_window (reader),
+ "mail:ask-list-honour-reply-to", NULL);
+
+ /*Check buttons*/
+ vbox = gtk_vbox_new (FALSE, 0);
+ content_area = gtk_dialog_get_content_area (dialog);
+ gtk_container_set_border_width((GtkContainer *)vbox, 12);
+ gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
+ gtk_widget_show (vbox);
+
+ check_again = gtk_check_button_new_with_mnemonic (_("_Do not ask me again."));
+ gtk_box_pack_start (GTK_BOX (vbox), check_again, TRUE, TRUE, 0);
+ gtk_widget_show (check_again);
+
+ check_always_ignore = gtk_check_button_new_with_mnemonic (_("_Always ignore Reply-To: for mailing lists."));
+ gtk_box_pack_start (GTK_BOX (vbox), check_always_ignore, TRUE, TRUE, 0);
+ gtk_widget_show (check_always_ignore);
+
+ response = gtk_dialog_run ((GtkDialog *) dialog);
+
+ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_again)))
+ gconf_client_set_bool(gconf, "/apps/evolution/mail/prompts/list_reply_to", FALSE, NULL);
+
+ gconf_client_set_bool(gconf, "/apps/evolution/mail/composer/ignore_list_reply_to",
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(check_always_ignore)),
+ NULL);
+
+ gtk_widget_destroy((GtkWidget *)dialog);
+
+ if (response == GTK_RESPONSE_NO)
+ mode = REPLY_MODE_FROM;
+ else if (response == GTK_RESPONSE_OK)
+ mode = REPLY_MODE_LIST;
+ else if (response == GTK_RESPONSE_CANCEL)
+ return;
}
e_mail_reader_reply_to_message (reader, message, mode);
@@ -992,7 +1032,8 @@ action_mail_reply_sender_cb (GtkAction *action,
GConfClient *gconf;
gconf = mail_config_get_gconf_client ();
- if (gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/private_list_reply", NULL) &&
+ if ((gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/private_list_reply", NULL) ||
+ gconf_client_get_bool (gconf, "/apps/evolution/mail/prompts/list_reply_to", NULL)) &&
e_mail_reader_check_state(reader) & E_MAIL_READER_SELECTION_IS_MAILING_LIST) {
CamelMimeMessage *message = NULL;
EWebView *web_view;
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 4bc91c65a0..d01a421013 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1861,6 +1861,29 @@ em_utils_get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to,
}
static void
+get_reply_from (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto)
+{
+ CamelInternetAddress *from;
+ const gchar *name, *addr, *posthdr;
+ gint i;
+
+ /* check whether there is a 'Newsgroups: ' header in there */
+ if (postto
+ && ((posthdr = camel_medium_get_header((CamelMedium *)message, "Followup-To"))
+ || (posthdr = camel_medium_get_header((CamelMedium *)message, "Newsgroups")))) {
+ camel_address_decode((CamelAddress *)postto, posthdr);
+ return;
+ }
+
+ from = camel_mime_message_get_from (message);
+
+ if (from) {
+ for (i = 0; camel_internet_address_get (from, i, &name, &addr); i++)
+ camel_internet_address_add (to, name, addr);
+ }
+}
+
+static void
concat_unique_addrs (CamelInternetAddress *dest, CamelInternetAddress *src, GHashTable *rcpt_hash)
{
const gchar *name, *addr;
@@ -2274,6 +2297,12 @@ em_utils_reply_to_message(CamelFolder *folder, const gchar *uid, CamelMimeMessag
flags = CAMEL_MESSAGE_ANSWERED | CAMEL_MESSAGE_SEEN;
switch (mode) {
+ case REPLY_MODE_FROM:
+ if (folder)
+ postto = camel_nntp_address_new();
+
+ get_reply_from (message, to, postto);
+ break;
case REPLY_MODE_SENDER:
if (folder)
postto = camel_nntp_address_new();
diff --git a/mail/em-composer-utils.h b/mail/em-composer-utils.h
index a1d2da374d..eaa46d9d20 100644
--- a/mail/em-composer-utils.h
+++ b/mail/em-composer-utils.h
@@ -53,7 +53,8 @@ void em_utils_handle_receipt (CamelFolder *folder, const gchar *uid, CamelMimeMe
void em_utils_send_receipt (CamelFolder *folder, CamelMimeMessage *message);
enum {
- REPLY_MODE_SENDER,
+ REPLY_MODE_SENDER, /* Reply-To?:From */
+ REPLY_MODE_FROM,
REPLY_MODE_ALL,
REPLY_MODE_LIST
};
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index de4f4daa8f..2cc0fb06e4 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -1106,6 +1106,18 @@
</schema>
<schema>
+ <key>/schemas/apps/evolution/mail/prompts/list_reply_to</key>
+ <applyto>/apps/evolution/mail/prompts/list_reply_to</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>true</default>
+ <locale name="C">
+ <short>Prompt when mailing list hijacks private replies</short>
+ <long>It disables/enables the repeated prompts to warn that you are trying sending a private reply to a message which arrived via a mailing list, but the list sets a Reply-To: header which redirects your reply back to the list</long>
+ </locale>
+ </schema>
+
+ <schema>
<key>/schemas/apps/evolution/mail/prompts/reply_many_recips</key>
<applyto>/apps/evolution/mail/prompts/reply_many_recips</applyto>
<owner>evolution-mail</owner>
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index 8603940dcd..2a4ce8b9e0 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -4861,6 +4861,21 @@ For example: "Work" or "Personal"</property>
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="chkPromptListReplyTo">
+ <property name="label" translatable="yes">Prompt when mailing list redirects private reply back to list</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/mail/mail.error.xml b/mail/mail.error.xml
index 962a5090a2..f376cfaec2 100644
--- a/mail/mail.error.xml
+++ b/mail/mail.error.xml
@@ -58,6 +58,14 @@ Many email systems add an Apparently-To header to messages that only have BCC re
<button _label="_Send" response="GTK_RESPONSE_YES"/>
</error>
+ <error id="ask-list-honour-reply-to" type="question" default="GTK_RESPONSE_CANCEL">
+ <_primary>Send private reply?</_primary>
+ <_secondary>You are replying privately to a message which arrived via a mailing list, but the list is trying to redirect your reply to go back to the list. Are you sure you want to proceed?</_secondary>
+ <button response="GTK_RESPONSE_NO" _label="Reply _Privately"/>
+ <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/>
+ <button response="GTK_RESPONSE_OK" _label="Reply to _List"></button>
+ </error>
+
<error id="ask-list-private-reply" type="question" default="GTK_RESPONSE_CANCEL">
<_primary>Send private reply?</_primary>
<_secondary>You are replying to a message which arrived via a mailing list, but you are replying privately to the sender; not to the list. Are you sure you want to proceed?</_secondary>