* src/modest-tny-msg.c
[modest] / src / modest-tny-msg.c
index f711496..8680c82 100644 (file)
 #include <tny-folder.h>
 #include <modest-runtime.h>
 #include "modest-formatter.h"
-#include <tny-camel-stream.h>
+#include <tny-camel-mem-stream.h>
 #include <tny-camel-mime-part.h>
-#include <camel/camel-stream-buffer.h>
-#include <camel/camel-stream-mem.h>
 #include <glib/gprintf.h>
 #include <modest-tny-folder.h>
 #include "modest-tny-mime-part.h"
@@ -171,9 +169,8 @@ add_body_part (TnyMsg *msg,
        TnyStream *text_body_stream;
 
        /* Create the stream */
-       text_body_stream = TNY_STREAM (tny_camel_stream_new
-                                      (camel_stream_mem_new_with_buffer
-                                       (body, (body ? strlen(body) : 0))));
+       text_body_stream = TNY_STREAM (tny_camel_mem_stream_new_with_buffer
+                                       (body, (body ? strlen(body) : 0)));
 
        text_body_part = modest_formatter_create_body_part (NULL, msg);
 
@@ -200,9 +197,8 @@ add_html_body_part (TnyMsg *msg,
        TnyStream *html_body_stream;
 
        /* Create the stream */
-       html_body_stream = TNY_STREAM (tny_camel_stream_new
-                                      (camel_stream_mem_new_with_buffer
-                                       (body, strlen(body))));
+       html_body_stream = TNY_STREAM (tny_camel_mem_stream_new_with_buffer
+                                       (body, strlen(body)));
 
        /* Create body part if needed */
        html_body_part = modest_formatter_create_body_part (NULL, msg);
@@ -402,7 +398,7 @@ modest_tny_msg_find_body_part_from_mime_part (TnyMimePart *msg, gboolean want_ht
        TnyList *parts = NULL;
        TnyIterator *iter = NULL;
        gchar *header_content_type;
-       gchar *header_content_type_lower;
+       gchar *header_content_type_lower = NULL;
        
        if (!msg)
                return NULL;
@@ -410,10 +406,13 @@ modest_tny_msg_find_body_part_from_mime_part (TnyMimePart *msg, gboolean want_ht
        /* If it's an application multipart, then we don't get into as we don't
         * support them (for example application/sml or wap messages */
        header_content_type = modest_tny_mime_part_get_header_value (msg, "Content-Type");
-       header_content_type = g_strstrip (header_content_type);
-       header_content_type_lower = header_content_type?g_ascii_strdown (header_content_type, -1):NULL;
+       if (header_content_type) {
+               header_content_type = g_strstrip (header_content_type);
+               header_content_type_lower = g_ascii_strdown (header_content_type, -1);
+       }
        if (header_content_type_lower && 
            g_str_has_prefix (header_content_type_lower, "multipart/") &&
+           !g_str_has_prefix (header_content_type_lower, "multipart/signed") &&
            strstr (header_content_type_lower, "application/")) {
                g_free (header_content_type_lower);
                g_free (header_content_type);
@@ -809,7 +808,7 @@ modest_tny_msg_create_reply_msg (TnyMsg *msg,
 
        new_msg = create_reply_forward_mail (msg, header, from, signature, TRUE, reply_type,
                                             attachments_list);
-       if (attachments_list) {
+       if (attachments_list != NULL) {
                g_list_foreach (attachments_list, (GFunc) g_object_unref, NULL);
                g_list_free (attachments_list);
        }