From: Sergio Villar Senin Date: Fri, 5 Jun 2009 10:49:06 +0000 (+0200) Subject: Use always the #define to refer to the signature separator X-Git-Tag: 3.0.17-rc11~2 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=3a65c0163dc7290de04ecf59d6863eca4991ec3b;hp=b370fe7b0360f7c9381fca8e04bef9b117ceef80 Use always the #define to refer to the signature separator --- diff --git a/src/modest-text-utils.c b/src/modest-text-utils.c index 5426b0b..a644625 100644 --- a/src/modest-text-utils.c +++ b/src/modest-text-utils.c @@ -63,8 +63,6 @@ * will hang modest */ #define HYPERLINKIFY_MAX_LENGTH (1024*50) -#define SIGNATURE_MARKER "--" - /* * we need these regexps to find URLs in plain text e-mails @@ -216,7 +214,7 @@ modest_text_utils_cite (const gchar *text, 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) { @@ -768,7 +766,7 @@ get_indent_level (const char *l) /* 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; @@ -966,7 +964,7 @@ modest_text_utils_quote_plain_text (const gchar *text, 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); } @@ -1013,7 +1011,7 @@ modest_text_utils_quote_html (const gchar *text, GString *quoted_text; g_string_append (result_string, "
\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);
diff --git a/src/modest-text-utils.h b/src/modest-text-utils.h
index f2c59c9..d881f00 100644
--- a/src/modest-text-utils.h
+++ b/src/modest-text-utils.h
@@ -54,6 +54,10 @@ extern const guint ACCOUNT_TITLE_FORBIDDEN_CHARS_LENGTH;
 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
diff --git a/src/modest-tny-msg.c b/src/modest-tny-msg.c
index f27c5ea..d0ee511 100644
--- a/src/modest-tny-msg.c
+++ b/src/modest-tny-msg.c
@@ -61,7 +61,7 @@ static gboolean is_ascii(const gchar *s);
 
 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)
@@ -70,11 +70,11 @@ modest_tny_msg_new (const gchar* mailto, const gchar* from, const gchar *cc,
 	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);
@@ -84,12 +84,12 @@ modest_tny_msg_new (const gchar* mailto, const gchar* from, const gchar *cc,
 		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);
@@ -106,12 +106,12 @@ modest_tny_msg_new (const gchar* mailto, const gchar* from, const gchar *cc,
 
 	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);
diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c
index df873dd..dd3275c 100644
--- a/src/modest-ui-actions.c
+++ b/src/modest-ui-actions.c
@@ -905,9 +905,12 @@ modest_ui_actions_compose_msg(ModestWindow *win,
 	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);