aboutsummaryrefslogtreecommitdiffstats
path: root/libemail-engine
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2012-10-19 01:44:35 +0800
committerMilan Crha <mcrha@redhat.com>2012-10-19 01:44:35 +0800
commitbf8eaa185a845fc1118b3ebd9ad474a0de58abf6 (patch)
tree443c542b2485e04c42eb202906882f94bda97129 /libemail-engine
parentb3ec9c8c2f6d4711b1fbd710891de01ab81500b6 (diff)
downloadgsoc2013-evolution-bf8eaa185a845fc1118b3ebd9ad474a0de58abf6.tar
gsoc2013-evolution-bf8eaa185a845fc1118b3ebd9ad474a0de58abf6.tar.gz
gsoc2013-evolution-bf8eaa185a845fc1118b3ebd9ad474a0de58abf6.tar.bz2
gsoc2013-evolution-bf8eaa185a845fc1118b3ebd9ad474a0de58abf6.tar.lz
gsoc2013-evolution-bf8eaa185a845fc1118b3ebd9ad474a0de58abf6.tar.xz
gsoc2013-evolution-bf8eaa185a845fc1118b3ebd9ad474a0de58abf6.tar.zst
gsoc2013-evolution-bf8eaa185a845fc1118b3ebd9ad474a0de58abf6.zip
Bug #268618 - Add: Save replies in the folder of the message being replied to
Diffstat (limited to 'libemail-engine')
-rw-r--r--libemail-engine/e-mail-session-utils.c11
-rw-r--r--libemail-engine/mail-ops.c19
2 files changed, 28 insertions, 2 deletions
diff --git a/libemail-engine/e-mail-session-utils.c b/libemail-engine/e-mail-session-utils.c
index f26981df33..33e7effa47 100644
--- a/libemail-engine/e-mail-session-utils.c
+++ b/libemail-engine/e-mail-session-utils.c
@@ -813,6 +813,7 @@ e_mail_session_send_to (EMailSession *session,
const gchar *resent_from;
gchar *transport_uid = NULL;
gchar *sent_folder_uri = NULL;
+ gboolean replies_to_origin_folder = FALSE;
GError *error = NULL;
g_return_if_fail (E_IS_MAIL_SESSION (session));
@@ -848,6 +849,8 @@ e_mail_session_send_to (EMailSession *session,
string = e_source_mail_submission_get_transport_uid (extension);
transport_uid = g_strdup (string);
+ replies_to_origin_folder = e_source_mail_submission_get_replies_to_origin_folder (extension);
+
g_object_unref (source);
}
@@ -859,6 +862,14 @@ e_mail_session_send_to (EMailSession *session,
if (transport_uid == NULL && string != NULL)
transport_uid = g_strstrip (g_strdup (string));
+ if (replies_to_origin_folder) {
+ string = camel_header_raw_find (&xev, "X-Evolution-Source-Folder", NULL);
+ if (string != NULL && camel_header_raw_find (&xev, "X-Evolution-Source-Message", NULL) != NULL) {
+ g_free (sent_folder_uri);
+ sent_folder_uri = g_strstrip (g_strdup (string));
+ }
+ }
+
post_to_uris = g_ptr_array_new ();
for (header = xev; header != NULL; header = header->next) {
gchar *folder_uri;
diff --git a/libemail-engine/mail-ops.c b/libemail-engine/mail-ops.c
index 115c2c7bd2..e24e8c9752 100644
--- a/libemail-engine/mail-ops.c
+++ b/libemail-engine/mail-ops.c
@@ -527,7 +527,8 @@ static gboolean
get_submission_details_from_identity (EMailSession *session,
const gchar *identity_uid,
gchar **out_transport_uid,
- gchar **out_sent_folder_uri)
+ gchar **out_sent_folder_uri,
+ gboolean *out_replies_to_origin_folder)
{
ESource *source;
ESourceRegistry *registry;
@@ -556,6 +557,10 @@ get_submission_details_from_identity (EMailSession *session,
e_source_mail_submission_dup_transport_uid (
E_SOURCE_MAIL_SUBMISSION (extension));
+ *out_replies_to_origin_folder =
+ e_source_mail_submission_get_replies_to_origin_folder (
+ E_SOURCE_MAIL_SUBMISSION (extension));
+
g_object_unref (source);
return TRUE;
@@ -579,6 +584,7 @@ mail_send_message (struct _send_queue_msg *m,
gchar *transport_uid = NULL;
gchar *sent_folder_uri = NULL;
const gchar *resent_from, *tmp;
+ gboolean replies_to_origin_folder = FALSE;
CamelFolder *folder = NULL;
GString *err = NULL;
struct _camel_header_raw *xev, *header;
@@ -603,7 +609,8 @@ mail_send_message (struct _send_queue_msg *m,
identity_uid = g_strstrip (g_strdup (tmp));
get_submission_details_from_identity (
m->session, identity_uid,
- &transport_uid, &sent_folder_uri);
+ &transport_uid, &sent_folder_uri,
+ &replies_to_origin_folder);
g_free (identity_uid);
}
@@ -615,6 +622,14 @@ mail_send_message (struct _send_queue_msg *m,
if (sent_folder_uri == NULL && tmp != NULL)
sent_folder_uri = g_strstrip (g_strdup (tmp));
+ if (replies_to_origin_folder) {
+ tmp = camel_header_raw_find (&xev, "X-Evolution-Source-Folder", NULL);
+ if (tmp != NULL && camel_header_raw_find (&xev, "X-Evolution-Source-Message", NULL) != NULL) {
+ g_free (sent_folder_uri);
+ sent_folder_uri = g_strstrip (g_strdup (tmp));
+ }
+ }
+
service = camel_session_ref_service (
CAMEL_SESSION (m->session), transport_uid);
if (service != NULL)