-
- modest_mail_operation_send_mail (self, transport_account, new_msg);
-
- g_object_unref (G_OBJECT(new_msg));
-}
-
-static void
-add_if_attachment (gpointer data, gpointer user_data)
-{
- TnyMimePart *part;
- GList *attachments_list;
-
- part = TNY_MIME_PART (data);
- attachments_list = (GList *) user_data;
-
- if (tny_mime_part_is_attachment (part))
- attachments_list = g_list_prepend (attachments_list, part);
-}
-
-
-static TnyMsg *
-create_reply_forward_mail (TnyMsg *msg, const gchar *from, gboolean is_reply, guint type)
-{
- TnyPlatformFactory *fact;
- TnyMsg *new_msg;
- TnyHeader *new_header, *header;
- gchar *new_subject;
- TnyMimePart *body;
- ModestFormatter *formatter;
-
- /* Get body from original msg. Always look for the text/plain
- part of the message to create the reply/forwarded mail */
- header = tny_msg_get_header (msg);
- body = modest_tny_msg_find_body_part (msg, FALSE);
-
- /* TODO: select the formatter from account prefs */
- formatter = modest_formatter_new ("text/plain");
-
- /* Format message body */
- if (is_reply) {
- switch (type) {
- case MODEST_MAIL_OPERATION_REPLY_TYPE_CITE:
- default:
- new_msg = modest_formatter_cite (formatter, body, header);
- break;
- case MODEST_MAIL_OPERATION_REPLY_TYPE_QUOTE:
- new_msg = modest_formatter_quote (formatter, body, header);
- break;
- }
- } else {
- switch (type) {
- case MODEST_MAIL_OPERATION_FORWARD_TYPE_INLINE:
- default:
- new_msg = modest_formatter_inline (formatter, body, header);
- break;
- case MODEST_MAIL_OPERATION_FORWARD_TYPE_ATTACHMENT:
- new_msg = modest_formatter_attach (formatter, body, header);
- break;
- }
- }
- g_object_unref (G_OBJECT(formatter));
- g_object_unref (G_OBJECT(body));
-
- /* Fill the header */
- fact = modest_tny_platform_factory_get_instance ();
- new_header = TNY_HEADER (tny_platform_factory_new_header (fact));
- tny_msg_set_header (new_msg, new_header);
- tny_header_set_from (new_header, from);
- tny_header_set_replyto (new_header, from);
-
- /* Change the subject */
- new_subject =
- (gchar *) modest_text_utils_derived_subject (tny_header_get_subject(header),
- (is_reply) ? _("Re:") : _("Fwd:"));
- tny_header_set_subject (new_header, (const gchar *) new_subject);
- g_free (new_subject);
-
- /* Clean */
- g_object_unref (G_OBJECT (new_header));
- g_object_unref (G_OBJECT (header));
-
- return new_msg;
-}