aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-07-11 01:21:28 +0800
committerMilan Crha <mcrha@redhat.com>2012-07-11 01:21:28 +0800
commit20973f9281767871e8db287cf55aceae7f68b6df (patch)
treeca9d48b7693677d34dbb0876c3fa3e6d3f52bf23
parent8ca9931144651903d7ecb01b6f0dc694b0ae9f77 (diff)
downloadgsoc2013-evolution-20973f9281767871e8db287cf55aceae7f68b6df.tar.gz
gsoc2013-evolution-20973f9281767871e8db287cf55aceae7f68b6df.tar.zst
gsoc2013-evolution-20973f9281767871e8db287cf55aceae7f68b6df.zip
Bug #548778 - Use original location when replying in Search Folder
-rw-r--r--libemail-engine/e-mail-session.c2
-rw-r--r--libemail-engine/e-mail-utils.c39
-rw-r--r--libemail-engine/e-mail-utils.h12
-rw-r--r--mail/em-composer-utils.c4
-rw-r--r--modules/itip-formatter/itip-view.c2
-rw-r--r--modules/mdn/evolution-mdn.c4
6 files changed, 42 insertions, 21 deletions
diff --git a/libemail-engine/e-mail-session.c b/libemail-engine/e-mail-session.c
index 881f6801a8..850f9b0d97 100644
--- a/libemail-engine/e-mail-session.c
+++ b/libemail-engine/e-mail-session.c
@@ -1377,7 +1377,7 @@ mail_session_forward_to (CamelSession *session,
/* This returns a new ESource reference. */
source = em_utils_guess_mail_identity_with_recipients (
- registry, message, folder);
+ registry, message, folder, NULL);
if (source == NULL) {
g_set_error (
error, CAMEL_ERROR, CAMEL_ERROR_GENERIC,
diff --git a/libemail-engine/e-mail-utils.c b/libemail-engine/e-mail-utils.c
index 20b96f7d26..fffe388fbe 100644
--- a/libemail-engine/e-mail-utils.c
+++ b/libemail-engine/e-mail-utils.c
@@ -900,7 +900,8 @@ emu_free_mail_cache (void)
static ESource *
guess_mail_account_from_folder (ESourceRegistry *registry,
- CamelFolder *folder)
+ CamelFolder *folder,
+ const gchar *message_uid)
{
ESource *source;
CamelStore *store;
@@ -908,6 +909,18 @@ guess_mail_account_from_folder (ESourceRegistry *registry,
/* Lookup an ESource by CamelStore UID. */
store = camel_folder_get_parent_store (folder);
+ if (message_uid && folder && CAMEL_IS_VEE_STORE (store)) {
+ CamelMessageInfo *mi = camel_folder_get_message_info (folder, message_uid);
+ if (mi) {
+ CamelFolder *location;
+
+ location = camel_vee_folder_get_location (CAMEL_VEE_FOLDER (folder), (CamelVeeMessageInfo *) mi, NULL);
+ if (location)
+ store = camel_folder_get_parent_store (location);
+ camel_folder_free_message_info (folder, mi);
+ }
+ }
+
uid = camel_service_get_uid (CAMEL_SERVICE (store));
source = e_source_registry_ref_source (registry, uid);
@@ -954,7 +967,8 @@ guess_mail_account_from_message (ESourceRegistry *registry,
ESource *
em_utils_guess_mail_account (ESourceRegistry *registry,
CamelMimeMessage *message,
- CamelFolder *folder)
+ CamelFolder *folder,
+ const gchar *message_uid)
{
ESource *source = NULL;
const gchar *newsgroups;
@@ -969,11 +983,11 @@ em_utils_guess_mail_account (ESourceRegistry *registry,
newsgroups = camel_medium_get_header (
CAMEL_MEDIUM (message), "Newsgroups");
if (folder != NULL && newsgroups != NULL)
- source = guess_mail_account_from_folder (registry, folder);
+ source = guess_mail_account_from_folder (registry, folder, message_uid);
/* check for source folder */
if (source == NULL && folder != NULL)
- source = guess_mail_account_from_folder (registry, folder);
+ source = guess_mail_account_from_folder (registry, folder, message_uid);
/* then message source */
if (source == NULL)
@@ -985,7 +999,8 @@ em_utils_guess_mail_account (ESourceRegistry *registry,
ESource *
em_utils_guess_mail_identity (ESourceRegistry *registry,
CamelMimeMessage *message,
- CamelFolder *folder)
+ CamelFolder *folder,
+ const gchar *message_uid)
{
ESource *source;
ESourceExtension *extension;
@@ -998,7 +1013,7 @@ em_utils_guess_mail_identity (ESourceRegistry *registry,
if (folder != NULL)
g_return_val_if_fail (CAMEL_IS_FOLDER (folder), NULL);
- source = em_utils_guess_mail_account (registry, message, folder);
+ source = em_utils_guess_mail_account (registry, message, folder, message_uid);
if (source == NULL)
return NULL;
@@ -1075,7 +1090,8 @@ mail_account_in_recipients (ESourceRegistry *registry,
ESource *
em_utils_guess_mail_account_with_recipients (ESourceRegistry *registry,
CamelMimeMessage *message,
- CamelFolder *folder)
+ CamelFolder *folder,
+ const gchar *message_uid)
{
ESource *source = NULL;
GHashTable *recipients;
@@ -1122,7 +1138,7 @@ em_utils_guess_mail_account_with_recipients (ESourceRegistry *registry,
* in the list of To: or Cc: recipients. */
if (folder != NULL)
- source = guess_mail_account_from_folder (registry, folder);
+ source = guess_mail_account_from_folder (registry, folder, message_uid);
if (source == NULL)
goto second_preference;
@@ -1158,7 +1174,7 @@ second_preference:
goto exit;
/* Last Preference: Defer to em_utils_guess_mail_account(). */
- source = em_utils_guess_mail_account (registry, message, folder);
+ source = em_utils_guess_mail_account (registry, message, folder, message_uid);
exit:
g_hash_table_destroy (recipients);
@@ -1169,7 +1185,8 @@ exit:
ESource *
em_utils_guess_mail_identity_with_recipients (ESourceRegistry *registry,
CamelMimeMessage *message,
- CamelFolder *folder)
+ CamelFolder *folder,
+ const gchar *message_uid)
{
ESource *source;
ESourceExtension *extension;
@@ -1180,7 +1197,7 @@ em_utils_guess_mail_identity_with_recipients (ESourceRegistry *registry,
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (message), NULL);
source = em_utils_guess_mail_account_with_recipients (
- registry, message, folder);
+ registry, message, folder, message_uid);
if (source == NULL)
return NULL;
diff --git a/libemail-engine/e-mail-utils.h b/libemail-engine/e-mail-utils.h
index 812dde2dfb..7c993f662f 100644
--- a/libemail-engine/e-mail-utils.h
+++ b/libemail-engine/e-mail-utils.h
@@ -43,18 +43,22 @@ CamelMimePart * em_utils_contact_photo (ESourceRegistry *registry,
GCancellable *cancellable);
ESource * em_utils_guess_mail_account (ESourceRegistry *registry,
CamelMimeMessage *message,
- CamelFolder *folder);
+ CamelFolder *folder,
+ const gchar *message_uid);
ESource * em_utils_guess_mail_identity (ESourceRegistry *registry,
CamelMimeMessage *message,
- CamelFolder *folder);
+ CamelFolder *folder,
+ const gchar *message_uid);
ESource * em_utils_guess_mail_account_with_recipients
(ESourceRegistry *registry,
CamelMimeMessage *message,
- CamelFolder *folder);
+ CamelFolder *folder,
+ const gchar *message_uid);
ESource * em_utils_guess_mail_identity_with_recipients
(ESourceRegistry *registry,
CamelMimeMessage *message,
- CamelFolder *folder);
+ CamelFolder *folder,
+ const gchar *message_uid);
ESource * em_utils_ref_mail_identity_for_store
(ESourceRegistry *registry,
CamelStore *store);
diff --git a/mail/em-composer-utils.c b/mail/em-composer-utils.c
index 71754a6d0d..33b24ae08a 100644
--- a/mail/em-composer-utils.c
+++ b/mail/em-composer-utils.c
@@ -1961,7 +1961,7 @@ redirect_get_composer (EShell *shell,
/* This returns a new ESource reference. */
source = em_utils_guess_mail_identity_with_recipients (
- registry, message, NULL);
+ registry, message, NULL, NULL);
if (source != NULL) {
identity_uid = e_source_dup_uid (source);
@@ -2899,7 +2899,7 @@ em_utils_reply_to_message (EShell *shell,
/* This returns a new ESource reference. */
source = em_utils_guess_mail_identity_with_recipients (
- registry, message, folder);
+ registry, message, folder, message_uid);
if (source != NULL) {
identity_uid = e_source_dup_uid (source);
g_object_unref (source);
diff --git a/modules/itip-formatter/itip-view.c b/modules/itip-formatter/itip-view.c
index 1fddba9061..86c2456498 100644
--- a/modules/itip-formatter/itip-view.c
+++ b/modules/itip-formatter/itip-view.c
@@ -3167,7 +3167,7 @@ find_to_address (EMailPartItip *itip_part,
ESource *source;
source = em_utils_guess_mail_identity (
- registry, itip_part->msg, itip_part->folder);
+ registry, itip_part->msg, itip_part->folder, itip_part->uid);
if (source != NULL) {
extension = e_source_get_extension (source, extension_name);
diff --git a/modules/mdn/evolution-mdn.c b/modules/mdn/evolution-mdn.c
index c30e875982..cd6d3edac7 100644
--- a/modules/mdn/evolution-mdn.c
+++ b/modules/mdn/evolution-mdn.c
@@ -513,7 +513,7 @@ mdn_message_loaded_cb (EMailReader *reader,
/* This returns a new ESource reference. */
source = em_utils_guess_mail_account_with_recipients (
- registry, message, folder);
+ registry, message, folder, message_uid);
if (source == NULL)
goto exit;
@@ -603,7 +603,7 @@ mdn_message_seen_cb (EMailReader *reader,
/* This returns a new ESource reference. */
source = em_utils_guess_mail_account_with_recipients (
- registry, message, folder);
+ registry, message, folder, message_uid);
if (source == NULL)
goto exit;