- 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)
-{
- TnyMsg *new_msg;
- TnyHeader *new_header, *header;
- gchar *new_subject;
- TnyMimePart *body;
- ModestFormatter *formatter;
-
- /* Get body from original msg */
- header = tny_msg_get_header (msg);
- body = modest_tny_msg_actions_find_body_part (msg, TRUE);
-
- /* 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));
-
- /* Fill the header */
- new_header = TNY_HEADER (tny_camel_header_new ());
- 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));