* modest-pair.[ch]:
[modest] / src / modest-tny-msg-actions.c
index 442d69d..ccce454 100644 (file)
@@ -27,8 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-
-#include <gtk/gtk.h>
+#include <string.h>
 #include <gtkhtml/gtkhtml.h>
 #include <tny-gtk-text-buffer-stream.h>
 #include <tny-simple-list.h>
@@ -70,31 +69,6 @@ get_body_text (TnyMsg *msg, gboolean want_html)
        return to_quote;
 }
 
-gchar*
-modest_tny_msg_actions_quote (TnyMsg * self, const gchar * from,
-                             time_t sent_date, gint limit,
-                             const gchar * to_quote)
-{
-       gchar *quoted_msg = NULL;
-       const gchar *body;
-
-       /* 2 cases: */
-
-       /* a) quote text from selection */
-       if (to_quote != NULL) 
-               return modest_text_utils_quote (to_quote, from, sent_date,
-                                               limit);
-       
-       /* b) try to find a text/plain part in the msg and quote it */
-       body = get_body_text (self, FALSE);
-       if (body)
-               quoted_msg = modest_text_utils_quote (body, from, sent_date, limit);
-       
-       return quoted_msg;
-}
-
-
-
 static TnyMimePart*
 modest_tny_msg_actions_find_body_part_from_mime_part (TnyMimePart *msg, gboolean want_html)
 {
@@ -116,21 +90,31 @@ modest_tny_msg_actions_find_body_part_from_mime_part (TnyMimePart *msg, gboolean
                return TNY_MIME_PART (g_object_ref(G_OBJECT(msg)));
        else {
                do {
-                       const gchar* content_type;
+                       const gchar *ct;
+                       gchar *content_type;
                        part = TNY_MIME_PART(tny_iterator_get_current (iter));
-                       
-                       if (tny_mime_part_content_type_is (part, mime_type) &&
-                           !tny_mime_part_is_attachment (part)) 
+
+                       /* we need to strdown the content type, because
+                        * tny_mime_part_has_content_type does not do it...
+                        */
+                       ct = tny_mime_part_get_content_type (part);
+                       content_type = g_ascii_strdown (ct, strlen(ct));
+                                               
+                       if (g_str_has_prefix (content_type, mime_type) &&
+                           !tny_mime_part_is_attachment (part)) {
+                               g_free (content_type);
                                break;
+                       }
                        
-                       content_type = tny_mime_part_get_content_type (part);
                        if (g_str_has_prefix(content_type, "multipart")) {
                                part = modest_tny_msg_actions_find_body_part_from_mime_part (part,
                                                                                             want_html);
+                               g_free (content_type);
                                if (part)
                                        break;
                        }
 
+                       g_free (content_type);
                        part = NULL;
                        tny_iterator_next (iter);
 
@@ -151,7 +135,7 @@ modest_tny_msg_actions_find_body_part_from_mime_part (TnyMimePart *msg, gboolean
                return modest_tny_msg_actions_find_body_part_from_mime_part (msg, FALSE);
 
        if (!part)
-               g_warning ("cannot find body part");
+               g_printerr ("modest: cannot find body part\n");
        
        return part ? part : NULL;
 }