aboutsummaryrefslogtreecommitdiffstats
path: root/composer/e-msg-composer-attachment-bar.c
diff options
context:
space:
mode:
Diffstat (limited to 'composer/e-msg-composer-attachment-bar.c')
-rw-r--r--composer/e-msg-composer-attachment-bar.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index 57eb2d42b6..5041164d9b 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -608,12 +608,11 @@ attach_to_multipart (CamelMultipart *multipart,
CamelMimePart *part;
struct stat st;
int fd;
+ char *data;
part = camel_mime_part_new ();
fd = open (attachment->file_name, O_RDONLY);
if (fd != -1 && fstat (fd, &st) != -1) {
- char *data;
-
data = g_malloc (st.st_size);
read (fd, data, st.st_size);
close (fd);
@@ -631,6 +630,16 @@ attach_to_multipart (CamelMultipart *multipart,
g_basename (attachment->file_name));
camel_mime_part_set_description (part, attachment->description);
+ /* Kludge a bit on CTE. For now, we set QP for text/ and message/
+ * and B64 for all else. FIXME.
+ */
+
+ if (!strncasecmp (attachment->mime_type, "text/", 5) ||
+ !strncasecmp (attachment->mime_type, "message/", 8))
+ camel_mime_part_set_encoding (part, CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE);
+ else
+ camel_mime_part_set_encoding (part, CAMEL_MIME_PART_ENCODING_BASE64);
+
camel_multipart_add_part (multipart, part);
gtk_object_unref (GTK_OBJECT (part));
}