[evolution/gnome-3-22] Bug 778541 - Prefer Sent/Drafts folder account for non-existent identity
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution/gnome-3-22] Bug 778541 - Prefer Sent/Drafts folder account for non-existent identity
- Date: Tue, 28 Feb 2017 14:44:45 +0000 (UTC)
commit 793d74da0bf24982ae376196e9efdbdc0de6d633
Author: Milan Crha <mcrha redhat com>
Date: Tue Feb 28 15:38:52 2017 +0100
Bug 778541 - Prefer Sent/Drafts folder account for non-existent identity
mail/em-composer-utils.c | 34 +++++++++++++++++++++++++++++++++-
1 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 1518e24..48ff947 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1802,6 +1802,37 @@ em_composer_utils_get_original_marker (void)
return quoting_text (QUOTING_ORIGINAL);
}
+static gboolean
+emcu_message_references_existing_account (CamelMimeMessage *message,
+ EMsgComposer *composer)
+{
+ ESource *source;
+ gchar *identity_uid;
+ gboolean res = FALSE;
+
+ g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), FALSE);
+ g_return_val_if_fail (E_IS_MSG_COMPOSER (composer), FALSE);
+
+ identity_uid = (gchar *) camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Identity");
+ if (!identity_uid) {
+ /* for backward compatibility */
+ identity_uid = (gchar *) camel_medium_get_header (CAMEL_MEDIUM (message),
"X-Evolution-Account");
+ }
+
+ if (!identity_uid)
+ return FALSE;
+
+ identity_uid = g_strstrip (g_strdup (identity_uid));
+ source = e_composer_header_table_ref_source (e_msg_composer_get_header_table (composer),
identity_uid);
+
+ res = source != NULL;
+
+ g_clear_object (&source);
+ g_free (identity_uid);
+
+ return res;
+}
+
/**
* em_utils_edit_message:
* @composer: an #EMsgComposer
@@ -1872,7 +1903,8 @@ em_utils_edit_message (EMsgComposer *composer,
}
if (folder) {
- if (!folder_is_sent && !folder_is_drafts && !folder_is_outbox && !folder_is_templates) {
+ if ((!folder_is_sent && !folder_is_drafts && !folder_is_outbox && !folder_is_templates) ||
+ (!folder_is_outbox && !folder_is_templates && !emcu_message_references_existing_account
(message, composer))) {
CamelStore *store;
store = camel_folder_get_parent_store (folder);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]