aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-03-05 21:14:31 +0800
committerMilan Crha <mcrha@redhat.com>2013-03-05 21:14:31 +0800
commit853abba1d383c27733c0fca23aaae165c30eea54 (patch)
tree589ba7fd64d75898477fcedf18d8f050aaf6b90f /libemail-engine
parent642eaed17fcc9aa6b8cbd5c0fcf8916e29ab39e3 (diff)
downloadgsoc2013-evolution-853abba1d383c27733c0fca23aaae165c30eea54.tar
gsoc2013-evolution-853abba1d383c27733c0fca23aaae165c30eea54.tar.gz
gsoc2013-evolution-853abba1d383c27733c0fca23aaae165c30eea54.tar.bz2
gsoc2013-evolution-853abba1d383c27733c0fca23aaae165c30eea54.tar.lz
gsoc2013-evolution-853abba1d383c27733c0fca23aaae165c30eea54.tar.xz
gsoc2013-evolution-853abba1d383c27733c0fca23aaae165c30eea54.tar.zst
gsoc2013-evolution-853abba1d383c27733c0fca23aaae165c30eea54.zip
Bug #693254 - Mail reply uses wrong "From:" account
Diffstat (limited to 'libemail-engine')
-rw-r--r--libemail-engine/e-mail-utils.c45
-rw-r--r--libemail-engine/e-mail-utils.h16
2 files changed, 51 insertions, 10 deletions
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index cc5ef7342e..7b406ec9ab 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -484,10 +484,12 @@ mail_account_in_recipients (ESourceRegistry *registry,
}
ESource *
-em_utils_guess_mail_account_with_recipients (ESourceRegistry *registry,
- CamelMimeMessage *message,
- CamelFolder *folder,
- const gchar *message_uid)
+em_utils_guess_mail_account_with_recipients_and_sort (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder,
+ const gchar *message_uid,
+ EMailUtilsSourtSourcesFunc sort_func,
+ gpointer sort_func_data)
{
ESource *source = NULL;
GHashTable *recipients;
@@ -552,6 +554,9 @@ second_preference:
extension_name = E_SOURCE_EXTENSION_MAIL_ACCOUNT;
list = e_source_registry_list_sources (registry, extension_name);
+ if (sort_func)
+ sort_func (&list, sort_func_data);
+
for (iter = list; iter != NULL; iter = g_list_next (iter)) {
ESource *temp = E_SOURCE (iter->data);
@@ -578,10 +583,12 @@ exit:
}
ESource *
-em_utils_guess_mail_identity_with_recipients (ESourceRegistry *registry,
- CamelMimeMessage *message,
- CamelFolder *folder,
- const gchar *message_uid)
+em_utils_guess_mail_identity_with_recipients_and_sort (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder,
+ const gchar *message_uid,
+ EMailUtilsSourtSourcesFunc sort_func,
+ gpointer sort_func_data)
{
ESource *source;
ESourceExtension *extension;
@@ -591,8 +598,8 @@ em_utils_guess_mail_identity_with_recipients (ESourceRegistry *registry,
g_return_val_if_fail (E_IS_SOURCE_REGISTRY (registry), NULL);
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
- source = em_utils_guess_mail_account_with_recipients (
- registry, message, folder, message_uid);
+ source = em_utils_guess_mail_account_with_recipients_and_sort (
+ registry, message, folder, message_uid, sort_func, sort_func_data);
if (source == NULL)
return NULL;
@@ -619,6 +626,24 @@ em_utils_guess_mail_identity_with_recipients (ESourceRegistry *registry,
}
ESource *
+em_utils_guess_mail_account_with_recipients (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder,
+ const gchar *message_uid)
+{
+ return em_utils_guess_mail_account_with_recipients_and_sort (registry, message, folder, message_uid, NULL, NULL);
+}
+
+ESource *
+em_utils_guess_mail_identity_with_recipients (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder,
+ const gchar *message_uid)
+{
+ return em_utils_guess_mail_identity_with_recipients_and_sort (registry, message, folder, message_uid, NULL, NULL);
+}
+
+ESource *
em_utils_ref_mail_identity_for_store (ESourceRegistry *registry,
CamelStore *store)
{
diff --git a/libemail-engine/e-mail-utils.h b/libemail-engine/e-mail-utils.h
index 87bf337e71..b9201d9c14 100644
--- a/libemail-engine/e-mail-utils.h
+++ b/libemail-engine/e-mail-utils.h
@@ -25,6 +25,8 @@
#include <camel/camel.h>
#include <libedataserver/libedataserver.h>
+typedef void (* EMailUtilsSourtSourcesFunc) (GList **psources, gpointer user_data);
+
gboolean em_utils_folder_is_drafts (ESourceRegistry *registry,
CamelFolder *folder);
gboolean em_utils_folder_is_templates (ESourceRegistry *registry,
@@ -51,6 +53,20 @@ ESource * em_utils_guess_mail_identity_with_recipients
CamelMimeMessage *message,
CamelFolder *folder,
const gchar *message_uid);
+ESource * em_utils_guess_mail_account_with_recipients_and_sort
+ (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder,
+ const gchar *message_uid,
+ EMailUtilsSourtSourcesFunc sort_func,
+ gpointer sort_func_data);
+ESource * em_utils_guess_mail_identity_with_recipients_and_sort
+ (ESourceRegistry *registry,
+ CamelMimeMessage *message,
+ CamelFolder *folder,
+ const gchar *message_uid,
+ EMailUtilsSourtSourcesFunc sort_func,
+ gpointer sort_func_data);
ESource * em_utils_ref_mail_identity_for_store
(ESourceRegistry *registry,
CamelStore *store);