[evolution] Try also with the From address when looking up correct From account for composer



commit 2cb3aa872bba2a83c24089e209385252ccdda659
Author: Milan Crha <mcrha redhat com>
Date:   Wed Jun 27 09:38:49 2018 +0200

    Try also with the From address when looking up correct From account for composer
    
    This can be useful for Sent and Outbox folders, when the account
    cannot be guessed from the To/CC recipients.

 src/libemail-engine/e-mail-utils.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
---
diff --git a/src/libemail-engine/e-mail-utils.c b/src/libemail-engine/e-mail-utils.c
index 84de797c89..9b43130475 100644
--- a/src/libemail-engine/e-mail-utils.c
+++ b/src/libemail-engine/e-mail-utils.c
@@ -651,6 +651,27 @@ second_preference:
                }
        }
 
+       /* Third Preference: Try with the From address (like in Outbox/Sent folders) */
+       if (!source && message) {
+               CamelInternetAddress *from;
+               const gchar *email = NULL;
+
+               from = camel_mime_message_get_from (message);
+               if (from && camel_internet_address_get (from, 0, NULL, &email) && email) {
+                       g_hash_table_remove_all (recipients);
+                       g_hash_table_add (recipients, (gpointer) email);
+
+                       for (iter = list; iter != NULL; iter = g_list_next (iter)) {
+                               ESource *temp = E_SOURCE (iter->data);
+
+                               if (mail_account_in_recipients (registry, temp, recipients, identity_name, 
identity_address)) {
+                                       source = g_object_ref (temp);
+                                       break;
+                               }
+                       }
+               }
+       }
+
        g_list_free_full (list, (GDestroyNotify) g_object_unref);
 
        if (source != NULL)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]