aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-utils.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-10-16 03:02:42 +0800
committerMilan Crha <mcrha@redhat.com>2009-10-16 03:02:42 +0800
commitf74a1448947259f52293ba922b64b2b3b8ff726c (patch)
treea85e893277db5a7564ba2857f87b8f256227f06d /mail/em-utils.c
parent3766e19a2aafccaae1f662bc8770f074fdcc4a2d (diff)
downloadgsoc2013-evolution-f74a1448947259f52293ba922b64b2b3b8ff726c.tar.gz
gsoc2013-evolution-f74a1448947259f52293ba922b64b2b3b8ff726c.tar.zst
gsoc2013-evolution-f74a1448947259f52293ba922b64b2b3b8ff726c.zip
Bug #322261 - vCalendar replies are sent out using the default account
Diffstat (limited to 'mail/em-utils.c')
-rw-r--r--mail/em-utils.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 79b11bc031..6198fbde40 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -2254,3 +2254,41 @@ em_utils_url_unescape_amp (const gchar *url)
return buff;
}
+
+static EAccount *
+guess_account_folder (CamelFolder *folder)
+{
+ EAccount *account;
+ gchar *tmp;
+
+ tmp = camel_url_to_string (CAMEL_SERVICE (folder->parent_store)->url, CAMEL_URL_HIDE_ALL);
+ account = mail_config_get_account_by_source_url (tmp);
+ g_free (tmp);
+
+ return account;
+}
+
+EAccount *
+em_utils_guess_account (CamelMimeMessage *message, CamelFolder *folder)
+{
+ EAccount *account = NULL;
+ const gchar *tmp;
+
+ /* check for newsgroup header */
+ if (folder
+ && camel_medium_get_header ((CamelMedium *)message, "Newsgroups")
+ && (account = guess_account_folder (folder)))
+ return account;
+
+ /* check for source folder */
+ if (folder)
+ account = guess_account_folder (folder);
+
+ /* then message source */
+ if (account == NULL
+ && (tmp = camel_mime_message_get_source (message))) {
+ account = mail_config_get_account_by_source_url (tmp);
+ }
+
+ return account;
+}