TnyMsg*
modest_tny_msg_new (const gchar* mailto, const gchar* from, const gchar *cc,
- const gchar *bcc, const gchar* subject,
+ const gchar *bcc, const gchar* subject,
const gchar *references, const gchar *in_reply_to,
const gchar *body,
GList *attachments, gint *attached, GError **err)
TnyHeader *header;
gchar *content_type;
gint tmp_attached = 0;
-
+
/* Create new msg */
new_msg = modest_formatter_create_message (NULL, TRUE, (attachments != NULL), FALSE);
header = tny_msg_get_header (new_msg);
-
+
if ((from != NULL) && (strlen(from) > 0)) {
tny_header_set_from (TNY_HEADER (header), from);
tny_header_set_replyto (TNY_HEADER (header), from);
tny_header_set_to (TNY_HEADER (header), removed_to);
g_free (removed_to);
}
- if ((cc != NULL) && (strlen(cc) > 0))
+ if ((cc != NULL) && (strlen(cc) > 0))
tny_header_set_cc (TNY_HEADER (header), cc);
- if ((bcc != NULL) && (strlen(bcc) > 0))
+ if ((bcc != NULL) && (strlen(bcc) > 0))
tny_header_set_bcc (TNY_HEADER (header), bcc);
-
- if ((subject != NULL) && (strlen(subject) > 0))
+
+ if ((subject != NULL) && (strlen(subject) > 0))
tny_header_set_subject (TNY_HEADER (header), subject);
content_type = get_content_type(body);
if (in_reply_to)
tny_mime_part_set_header_pair (TNY_MIME_PART (new_msg), "In-Reply-To", in_reply_to);
-
+
/* Add the body of the new mail */
/* This is needed even if body is NULL or empty. */
add_body_part (new_msg, body, content_type);
g_free (content_type);
-
+
/* Add attachments */
if (attachments)
tmp_attached = add_attachments (TNY_MIME_PART (new_msg), attachments, FALSE, err);
old_from = tny_header_dup_from (header);
if (!old_from && !old_reply_to) {
- g_warning ("%s: failed to get either Reply-To: or From: from header",
+ g_debug ("%s: failed to get either Reply-To: or From: from header",
__FUNCTION__);
return NULL;
}
if (reply_mode == MODEST_TNY_MSG_REPLY_MODE_ALL) {
gchar *old_to = tny_header_dup_to (header);
if (!old_to)
- g_warning ("%s: no To: address found in source mail",
+ g_debug ("%s: no To: address found in source mail",
__FUNCTION__);
else {
/* append the old To: */
new_header = tny_msg_get_header(new_msg);
new_to = get_new_to (msg, header, from, reply_mode);
if (!new_to)
- g_warning ("%s: failed to get new To:", __FUNCTION__);
+ g_debug ("%s: failed to get new To:", __FUNCTION__);
else {
tny_header_set_to (new_header, new_to);
g_free (new_to);
g_string_append(type, "; charset=\"utf-8\"");
} else {
/* it should be impossible to reach this, but better safe than sorry */
- g_warning("invalid utf8 in message");
+ g_debug("invalid utf8 in message");
g_string_append(type, "; charset=\"latin1\"");
}
}