aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/em-composer-utils.c105
-rw-r--r--mail/evolution-mail.schemas.in21
-rw-r--r--mail/mail-config.ui19
3 files changed, 108 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>