From 51a41db621693114f5ee60d48e7e6442fc85fcc4 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Thu, 15 Jul 2010 17:20:16 +0100 Subject: Add nag popup when mailing list hijacks private reply with Reply-To: header --- mail/em-composer-utils.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'mail/em-composer-utils.c') 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 @@ -1860,6 +1860,29 @@ em_utils_get_reply_sender (CamelMimeMessage *message, CamelInternetAddress *to, get_reply_sender (message, to, postto); } +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) { @@ -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(); -- cgit