aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog13
-rw-r--r--mail/mail-callbacks.c2
-rw-r--r--mail/mail-tools.c59
-rw-r--r--mail/mail-tools.h12
4 files changed, 85 insertions, 1 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index b8695e5bd0..45da2cd300 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,16 @@
+2001-08-27 Jeffrey Stedfast <fejj@ximian.com>
+
+ * mail-tools.c (mail_tool_make_message_attachment): Remove
+ X-Evolution* headers.
+ (mail_tool_remove_xevolution_headers): New function to convenience
+ removing the X-Evolution headers.
+ (mail_tool_restore_xevolution_headers): New convenience function
+ to restore the X-Evolution headers.
+ (mail_tool_destroy_xevolution): New function to cleanup the
+ structure.
+ (mail_tool_forward_message): Remove and restore the X-Evolution
+ headers here too.
+
2001-08-26 Jeffrey Stedfast <fejj@ximian.com>
* mail-send-recv.c (receive_update_got_store): If the store is not
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index cf3f43336b..a99cde4317 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -1003,7 +1003,7 @@ void
forward (GtkWidget *widget, gpointer user_data)
{
MailConfigForwardStyle style = mail_config_get_default_forward_style ();
-
+
if (style == MAIL_CONFIG_FORWARD_ATTACHED)
forward_attached (widget, user_data);
else
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 36ce800e14..56575ef4b1 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -227,11 +227,60 @@ mail_tool_generate_forward_subject (CamelMimeMessage *msg)
return fwd_subj;
}
+XEvolution *
+mail_tool_remove_xevolution_headers (CamelMimeMessage *message)
+{
+ XEvolution *xev;
+
+ xev = g_new (XEvolution, 1);
+ xev->flags = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution"));
+ xev->source = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Source"));
+ xev->transport = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Transport"));
+ xev->account = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Account"));
+ xev->fcc = g_strdup (camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc"));
+
+ /* rip off the X-Evolution* headers */
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution");
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Source");
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Transport");
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Account");
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc");
+
+ return xev;
+}
+
+void
+mail_tool_restore_xevolution_headers (CamelMimeMessage *message, XEvolution *xev)
+{
+ if (xev->flags)
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution", xev->flags);
+ if (xev->source)
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Source", xev->source);
+ if (xev->transport)
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", xev->transport);
+ if (xev->account)
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", xev->account);
+ if (xev->fcc)
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", xev->fcc);
+}
+
+void
+mail_tool_destroy_xevolution (XEvolution *xev)
+{
+ g_free (xev->flags);
+ g_free (xev->source);
+ g_free (xev->transport);
+ g_free (xev->account);
+ g_free (xev->fcc);
+ g_free (xev);
+}
+
CamelMimePart *
mail_tool_make_message_attachment (CamelMimeMessage *message)
{
CamelMimePart *part;
const char *subject;
+ XEvolution *xev;
char *desc;
subject = camel_mime_message_get_subject (message);
@@ -245,6 +294,10 @@ mail_tool_make_message_attachment (CamelMimeMessage *message)
desc = e_utf8_from_locale_string (_("Forwarded message"));
}
+ /* rip off the X-Evolution headers */
+ xev = mail_tool_remove_xevolution_headers (message);
+ mail_tool_destroy_xevolution (xev);
+
part = camel_mime_part_new ();
camel_mime_part_set_disposition (part, "inline");
camel_mime_part_set_description (part, desc);
@@ -432,12 +485,18 @@ mail_tool_forward_message (CamelMimeMessage *message)
{
CamelDataWrapper *contents;
gboolean want_plain, is_html;
+ XEvolution *xev;
gchar *text;
+ xev = mail_tool_remove_xevolution_headers (message);
+
want_plain = !mail_config_get_send_html ();
contents = camel_medium_get_content_object (CAMEL_MEDIUM (message));
text = mail_get_message_body (contents, want_plain, &is_html);
+ mail_tool_restore_xevolution_headers (message, xev);
+ mail_tool_destroy_xevolution (xev);
+
/* Set the quoted reply text. */
if (text) {
gchar *ret_text, *credits = NULL;
diff --git a/mail/mail-tools.h b/mail/mail-tools.h
index 57802e0be9..0573840dd6 100644
--- a/mail/mail-tools.h
+++ b/mail/mail-tools.h
@@ -28,6 +28,14 @@
#include <camel/camel.h>
#include <camel/camel-filter-driver.h> /*eek*/
+typedef struct xevolution {
+ char *flags;
+ char *source;
+ char *transport;
+ char *account;
+ char *fcc;
+} XEvolution;
+
/* Get a CamelFolder from a root url and a foldername (uses the global session)*/
CamelFolder *
mail_tool_get_folder_from_urlname (const gchar *url, const gchar *name,
@@ -58,6 +66,10 @@ mail_tool_do_movemail (const gchar *source_url, CamelException *ex);
void
mail_tool_move_folder_contents (CamelFolder *source, CamelFolder *dest, gboolean use_cache, CamelException *ex);
+XEvolution *mail_tool_remove_xevolution_headers (CamelMimeMessage *message);
+void mail_tool_restore_xevolution_headers (CamelMimeMessage *message, XEvolution *xev);
+void mail_tool_destroy_exevolution (XEvolution *xev);
+
/* Generates the subject for a message forwarding @msg */
gchar *
mail_tool_generate_forward_subject (CamelMimeMessage *msg);