aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2010-07-14 17:13:10 +0800
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-07-15 23:48:45 +0800
commit1e6adfccc83fdbf7862fabd883ca1ba8d9a848c2 (patch)
tree81841a441ab7cc7e5dfbe41a02bc059941e99efc
parent8b8fdabfa64d627ba3e13a77cbb104d463d29fb5 (diff)
downloadgsoc2013-evolution-1e6adfccc83fdbf7862fabd883ca1ba8d9a848c2.tar
gsoc2013-evolution-1e6adfccc83fdbf7862fabd883ca1ba8d9a848c2.tar.gz
gsoc2013-evolution-1e6adfccc83fdbf7862fabd883ca1ba8d9a848c2.tar.bz2
gsoc2013-evolution-1e6adfccc83fdbf7862fabd883ca1ba8d9a848c2.tar.lz
gsoc2013-evolution-1e6adfccc83fdbf7862fabd883ca1ba8d9a848c2.tar.xz
gsoc2013-evolution-1e6adfccc83fdbf7862fabd883ca1ba8d9a848c2.tar.zst
gsoc2013-evolution-1e6adfccc83fdbf7862fabd883ca1ba8d9a848c2.zip
Add support for ignoring mailing list Reply-To: headers
-rw-r--r--mail/em-composer-utils.c105
-rw-r--r--mail/evolution-mail.schemas.in21
-rw-r--r--mail/mail-config.ui19
-rw-r--r--modules/mail/e-mail-shell-settings.c4
-rw-r--r--modules/mail/em-composer-prefs.c5
5 files changed, 117 insertions, 37 deletions
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index ab8b62166b..e077e27e76 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1736,37 +1736,6 @@ reply_get_composer (CamelMimeMessage *message, EAccount *account,
return composer;
}
-static void
-get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto)
-{
- CamelInternetAddress *reply_to;
- 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;
- }
-
- reply_to = camel_mime_message_get_reply_to (message);
- if (!reply_to)
- reply_to = camel_mime_message_get_from (message);
-
- if (reply_to) {
- for (i = 0; camel_internet_address_get (reply_to, i, &name, &addr); i++)
- camel_internet_address_add (to, name, addr);
- }
-}
-
-void
-em_utils_get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto)
-{
- get_reply_sender (message, to, postto);
-}
-
static gboolean
get_reply_list (CamelMimeMessage *message, CamelInternetAddress *to)
{
@@ -1807,6 +1776,75 @@ get_reply_list (CamelMimeMessage *message, CamelInternetAddress *to)
return TRUE;
}
+static CamelInternetAddress *
+get_reply_to (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);
+
+ reply_to = camel_mime_message_get_reply_to (message);
+ if (reply_to && ignore_list_reply_to) {
+ CamelInternetAddress *list = camel_internet_address_new ();
+
+ if (get_reply_list (message, list) &&
+ camel_address_length (CAMEL_ADDRESS(list)) == camel_address_length (CAMEL_ADDRESS(reply_to))) {
+ gint i;
+ const gchar *r_name, *r_addr;
+ const gchar *l_name, *l_addr;
+
+ for (i = 0; i < camel_address_length (CAMEL_ADDRESS(list)); i++) {
+ if (!camel_internet_address_get (reply_to, i, &r_name, &r_addr))
+ break;
+ if (!camel_internet_address_get (list, i, &l_name, &l_addr))
+ break;
+ if (strcmp (l_addr, r_addr))
+ break;
+ }
+ if (i == camel_address_length (CAMEL_ADDRESS(list))) {
+ reply_to = NULL;
+ }
+ }
+ g_object_unref (list);
+ }
+ if (!reply_to)
+ reply_to = camel_mime_message_get_from (message);
+
+ return reply_to;
+}
+
+static void
+get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto)
+{
+ CamelInternetAddress *reply_to;
+ 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;
+ }
+
+ reply_to = get_reply_to (message);
+
+ if (reply_to) {
+ for (i = 0; camel_internet_address_get (reply_to, i, &name, &addr); i++)
+ camel_internet_address_add (to, name, addr);
+ }
+}
+
+void
+em_utils_get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, CamelNNTPAddress *postto)
+{
+ get_reply_sender (message, to, postto);
+}
+
static void
concat_unique_addrs (CamelInternetAddress *dest, CamelInternetAddress *src, GHashTable *rcpt_hash)
{
@@ -1839,10 +1877,7 @@ get_reply_all (CamelMimeMessage *message, CamelInternetAddress *to, CamelInterne
rcpt_hash = em_utils_generate_account_hash ();
- reply_to = camel_mime_message_get_reply_to (message);
- if (!reply_to)
- reply_to = camel_mime_message_get_from (message);
-
+ reply_to = get_reply_to(message);
to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in
index a8024a7aec..aa63695f2b 100644
--- a/mail/evolution-mail.schemas.in
+++ b/mail/evolution-mail.schemas.in
@@ -269,6 +269,27 @@
</locale>
</schema>
+ <schema>
+ <key>/schemas/apps/evolution/mail/composer/ignore_list_reply_to</key>
+ <applyto>/apps/evolution/mail/composer/ignore_list_reply_to</applyto>
+ <owner>evolution-mail</owner>
+ <type>bool</type>
+ <default>false</default>
+ <locale name="C">
+ <short>Ignore list Reply-To:</short>
+ <long>
+ Some mailing lists set a Reply-To: header to trick users into
+ sending replies to the list, even when they ask Evolution to
+ make a private reply. Setting this option to TRUE will attempt
+ to ignore such Reply-To: headers, so that Evolution will do
+ as you ask it. If you use the private reply action, it will
+ reply privately, while if you use the 'Reply to List' action
+ it will do that. It works by comparing the Reply-To: header
+ with a List-Post: header, if there is one.
+ </long>
+ </locale>
+ </schema>
+
<!-- Display Settings -->
<schema>
diff --git a/mail/mail-config.ui b/mail/mail-config.ui
index 6c1f57b080..a5110ee9b8 100644
--- a/mail/mail-config.ui
+++ b/mail/mail-config.ui
@@ -4515,6 +4515,21 @@ For example: "Work" or "Personal"</property>
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="chkIgnoreListReplyTo">
+ <property name="label" translatable="yes">Ignore Reply-To: for mailing lists</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">5</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkTable" id="tableForwardsReplies">
<property name="visible">True</property>
<property name="n_rows">3</property>
@@ -4642,7 +4657,7 @@ For example: "Work" or "Personal"</property>
</child>
</object>
<packing>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -4718,7 +4733,7 @@ For example: "Work" or "Personal"</property>
</child>
</object>
<packing>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
</object>
diff --git a/modules/mail/e-mail-shell-settings.c b/modules/mail/e-mail-shell-settings.c
index 5c30ddf634..29433aa3e6 100644
--- a/modules/mail/e-mail-shell-settings.c
+++ b/modules/mail/e-mail-shell-settings.c
@@ -216,6 +216,10 @@ e_mail_shell_settings_init (EShell *shell)
"/apps/evolution/mail/composer/outlook_filenames");
e_shell_settings_install_property_for_key (
+ "composer-ignore-list-reply-to",
+ "/apps/evolution/mail/composer/ignore_list_reply_to");
+
+ e_shell_settings_install_property_for_key (
"composer-prompt-only-bcc",
"/apps/evolution/mail/prompts/only_bcc");
diff --git a/modules/mail/em-composer-prefs.c b/modules/mail/em-composer-prefs.c
index 37da770b14..ad3cb46041 100644
--- a/modules/mail/em-composer-prefs.c
+++ b/modules/mail/em-composer-prefs.c
@@ -447,6 +447,11 @@ em_composer_prefs_construct (EMComposerPrefs *prefs,
shell_settings, "composer-outlook-filenames",
widget, "active");
+ widget = e_builder_get_widget (prefs->builder, "chkIgnoreListReplyTo");
+ e_mutual_binding_new (
+ shell_settings, "composer-ignore-list-reply-to",
+ widget, "active");
+
widget = e_builder_get_widget (prefs->builder, "chkTopSignature");
e_mutual_binding_new (
shell_settings, "composer-top-signature",