aboutsummaryrefslogtreecommitdiffstats
path: root/mail/mail-tools.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-28 01:26:34 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-28 01:26:34 +0800
commit16daf75376145e9d64973f413667441767135ebc (patch)
treef02ab65f79e58b074bcb148ec7641fd75f349b22 /mail/mail-tools.c
parentfcefade8381d8305dd3c3448ba0559f6f07bad03 (diff)
downloadgsoc2013-evolution-16daf75376145e9d64973f413667441767135ebc.tar
gsoc2013-evolution-16daf75376145e9d64973f413667441767135ebc.tar.gz
gsoc2013-evolution-16daf75376145e9d64973f413667441767135ebc.tar.bz2
gsoc2013-evolution-16daf75376145e9d64973f413667441767135ebc.tar.lz
gsoc2013-evolution-16daf75376145e9d64973f413667441767135ebc.tar.xz
gsoc2013-evolution-16daf75376145e9d64973f413667441767135ebc.tar.zst
gsoc2013-evolution-16daf75376145e9d64973f413667441767135ebc.zip
Remove X-Evolution* headers. (mail_tool_remove_xevolution_headers): New
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. svn path=/trunk/; revision=12484
Diffstat (limited to 'mail/mail-tools.c')
-rw-r--r--mail/mail-tools.c59
1 files changed, 59 insertions, 0 deletions
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;