#include <glib/gi18n.h>
#include <string.h>
#include <tny-header.h>
+#include <tny-gtk-text-buffer-stream.h>
+#include <tny-camel-stream.h>
+#include <camel/camel-stream-mem.h>
#include "modest-formatter.h"
#include "modest-text-utils.h"
+#include "modest-tny-platform-factory.h"
typedef struct _ModestFormatterPrivate ModestFormatterPrivate;
struct _ModestFormatterPrivate {
if (strcmp (tny_mime_part_get_content_type (body), priv->content_type)) {
if (!strcmp (priv->content_type, "text/html"))
converted_text = modest_text_utils_convert_to_html (text);
-/* else */
+ else
+ converted_text = g_strdup (text);
/* converted_text = modest_text_utils_convert_to_plain (text); */
g_free (text);
TnyMsg *new_msg;
gchar *body_text = NULL, *txt = NULL;
ModestFormatterPrivate *priv;
+ TnyPlatformFactory *fact;
+
+ g_return_val_if_fail (self, NULL);
+ g_return_val_if_fail (body, NULL);
+ g_return_val_if_fail (header, NULL);
+ g_return_val_if_fail (func, NULL);
/* Build new part */
- new_msg = TNY_MSG (tny_camel_msg_new ());
+ fact = modest_tny_platform_factory_get_instance ();
+ new_msg = tny_platform_factory_new_msg (fact);
body_text = extract_text (self, body);
txt = (gchar *) func (self, (const gchar*) body_text, header);
priv = MODEST_FORMATTER_GET_PRIVATE (self);
TnyMsg *
modest_formatter_cite (ModestFormatter *self, TnyMimePart *body, TnyHeader *header)
{
- modest_formatter_do (self, body, header, modest_formatter_wrapper_cite);
+ return modest_formatter_do (self, body, header, modest_formatter_wrapper_cite);
}
TnyMsg *
modest_formatter_quote (ModestFormatter *self, TnyMimePart *body, TnyHeader *header)
{
- modest_formatter_do (self, body, header, modest_formatter_wrapper_quote);
+ return modest_formatter_do (self, body, header, modest_formatter_wrapper_quote);
}
TnyMsg *
modest_formatter_inline (ModestFormatter *self, TnyMimePart *body, TnyHeader *header)
{
- modest_formatter_do (self, body, header, modest_formatter_wrapper_inline);
+ return modest_formatter_do (self, body, header, modest_formatter_wrapper_inline);
}
TnyMsg *
gchar *attach_text = NULL;
TnyMimePart *body_part = NULL, *attach_part = NULL;
ModestFormatterPrivate *priv;
+ TnyPlatformFactory *fact;
+ fact = modest_tny_platform_factory_get_instance ();
/* Build new part */
- new_msg = TNY_MSG (tny_camel_msg_new ());
- body_part = TNY_MIME_PART (tny_camel_mime_part_new (camel_mime_part_new()));
- attach_part = TNY_MIME_PART (tny_camel_mime_part_new (camel_mime_part_new()));
+ new_msg = tny_platform_factory_new_msg (fact);
+ body_part = tny_platform_factory_new_mime_part (fact);
+ attach_part = tny_platform_factory_new_mime_part (fact);
/* Create the two parts */
priv = MODEST_FORMATTER_GET_PRIVATE (self);
parent_class = g_type_class_peek_parent (class);
object_class = (GObjectClass*) class;
-
+ object_class->finalize = modest_formatter_finalize;
+
g_type_class_add_private (object_class, sizeof (ModestFormatterPrivate));
}