* will hang modest
*/
#define HYPERLINKIFY_MAX_LENGTH (1024*50)
-#define SIGNATURE_MARKER "--"
-
/*
* we need these regexps to find URLs in plain text e-mails
if (!signature) {
tmp_sig = g_strdup (text);
} else {
- tmp_sig = g_strconcat (text, "\n", SIGNATURE_MARKER, "\n", signature, NULL);
+ tmp_sig = g_strconcat (text, "\n", MODEST_TEXT_UTILS_SIGNATURE_MARKER, "\n", signature, NULL);
}
if (strcmp (content_type, "text/html") == 0) {
/* if we hit the signature marker "-- ", we return -(indent + 1). This
* stops reformatting.
*/
- if (strcmp (l, "-- ") == 0) {
+ if (strcmp (l, MODEST_TEXT_UTILS_SIGNATURE_MARKER) == 0) {
return -1 - indent;
} else {
return indent;
q = g_string_new ("");
if (signature != NULL) {
- q = g_string_append (q, "\n--\n");
+ g_string_append_printf (q, "\n%s\n", MODEST_TEXT_UTILS_SIGNATURE_MARKER);
q = g_string_append (q, signature);
}
GString *quoted_text;
g_string_append (result_string, "<pre>\n");
if (signature) {
- quote_html_add_to_gstring (result_string, SIGNATURE_MARKER);
+ quote_html_add_to_gstring (result_string, MODEST_TEXT_UTILS_SIGNATURE_MARKER);
quote_html_add_to_gstring (result_string, signature);
}
quote_html_add_to_gstring (result_string, cite);
extern const guint FOLDER_NAME_FORBIDDEN_CHARS_LENGTH;
extern const guint USER_NAME_FORBIDDEN_CHARS_LENGTH;
+/* It includes a white space as RFC 3676 Section 4.3 about usenet
+ message signatures defines */
+#define MODEST_TEXT_UTILS_SIGNATURE_MARKER "-- "
+
/**
* modest_text_utils_derived_subject:
* @subject: a string which contains the original subject
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);
signature = modest_account_mgr_get_signature_from_recipient (mgr, recipient, &use_signature);
g_free (recipient);
if (body_str != NULL) {
- body = use_signature ? g_strconcat(body_str, "\n--\n", signature, NULL) : g_strdup(body_str);
+ body = use_signature ? g_strconcat(body_str, "\n",
+ MODEST_TEXT_UTILS_SIGNATURE_MARKER,
+ "\n", signature, NULL) : g_strdup(body_str);
} else {
- body = use_signature ? g_strconcat("\n--\n", signature, NULL) : g_strdup("");
+ body = use_signature ? g_strconcat("\n", MODEST_TEXT_UTILS_SIGNATURE_MARKER,
+ "\n", signature, NULL) : g_strdup("");
}
msg = modest_tny_msg_new (to_str, from_str, cc_str, bcc_str, subject_str, NULL, NULL, body, NULL, NULL, NULL);