[Commits] [SCM] claws branch, master, updated. 3.14.0-104-ge22cbed

ticho at claws-mail.org ticho at claws-mail.org
Sat Oct 1 23:44:03 CEST 2016


The branch, master has been updated
       via  e22cbed1fc5166845341d2caedd8a9fd4eb054c6 (commit)
      from  3835a3a6271979e2f634212bb89131dd8f5ff1b7 (commit)

Summary of changes:
 src/compose.c |   69 +++++++++++++++++++++++++++++++++++----------------------
 1 file changed, 43 insertions(+), 26 deletions(-)


- Log -----------------------------------------------------------------
commit e22cbed1fc5166845341d2caedd8a9fd4eb054c6
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Sat Oct 1 23:41:19 2016 +0200

    Do not add Message-ID for draft, unless it already has one.
    
    We now add a Message-ID header only when queuing a message,
    and we honor existing Message-ID and References headers in
    drafts, if there are any.

diff --git a/src/compose.c b/src/compose.c
index c9cd93c..5554b66 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -2971,27 +2971,39 @@ static gint compose_parse_header(Compose *compose, MsgInfo *msginfo)
 	if (compose->mode == COMPOSE_REEDIT) {
 		if (msginfo->inreplyto && *msginfo->inreplyto)
 			compose->inreplyto = g_strdup(msginfo->inreplyto);
-		return 0;
-	}
 
-	if (msginfo->msgid && *msginfo->msgid)
-		compose->inreplyto = g_strdup(msginfo->msgid);
+		if (msginfo->msgid && *msginfo->msgid)
+			compose->msgid = g_strdup(msginfo->msgid);
 
-	if (!compose->references) {
-		if (msginfo->msgid && *msginfo->msgid) {
-			if (msginfo->inreplyto && *msginfo->inreplyto)
-				compose->references =
-					g_strdup_printf("<%s>\n\t<%s>",
-							msginfo->inreplyto,
-							msginfo->msgid);
-			else
+		if (msginfo->references != NULL) {
+			GString *refs = g_string_new(NULL);
+			GSList *r = msginfo->references;
+			while (r != NULL) {
+				g_string_append_printf(refs, "<%s>%s", (gchar *)r->data,
+						(g_slist_next(r) ? "\n\t" : ""));
+				r = g_slist_next(r);
+			}
+		}
+	} else {
+		if (msginfo->msgid && *msginfo->msgid)
+			compose->inreplyto = g_strdup(msginfo->msgid);
+
+		if (!compose->references) {
+			if (msginfo->msgid && *msginfo->msgid) {
+				if (msginfo->inreplyto && *msginfo->inreplyto)
+					compose->references =
+						g_strdup_printf("<%s>\n\t<%s>",
+								msginfo->inreplyto,
+								msginfo->msgid);
+				else
+					compose->references =
+						g_strconcat("<", msginfo->msgid, ">",
+							    NULL);
+			} else if (msginfo->inreplyto && *msginfo->inreplyto) {
 				compose->references =
-					g_strconcat("<", msginfo->msgid, ">",
+					g_strconcat("<", msginfo->inreplyto, ">",
 						    NULL);
-		} else if (msginfo->inreplyto && *msginfo->inreplyto) {
-			compose->references =
-				g_strconcat("<", msginfo->inreplyto, ">",
-					    NULL);
+			}
 		}
 	}
 
@@ -5534,9 +5546,17 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
 	gchar *from_name = NULL;
 	FolderItem *outbox;
 
-	if (action == COMPOSE_WRITE_FOR_SEND)
+	if (action == COMPOSE_WRITE_FOR_SEND) {
 		attach_parts = TRUE;
 
+		/* We're sending the message, generate a Message-ID
+		 * if necessary. */
+		if (compose->msgid == NULL &&
+				compose->account->gen_msgid) {
+			compose->msgid = prefs_account_generate_msgid(compose->account);
+		}
+	}
+
 	/* create message MimeInfo */
 	mimemsg = procmime_mimeinfo_new();
         mimemsg->type = MIMETYPE_MESSAGE;
@@ -5545,6 +5565,8 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
 	mimemsg->tmp = TRUE; /* must free content later */
 	mimemsg->data.mem = compose_get_header(compose);
 
+	debug_print(mimemsg->data.mem);
+
 	/* Create text part MimeInfo */
 	/* get all composed text */
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(compose->text));
@@ -6546,14 +6568,9 @@ static gchar *compose_get_header(Compose *compose)
 	g_free(str);
 
 	/* Message-ID */
-	if (compose->account->gen_msgid) {
-		gchar *addr = prefs_account_generate_msgid(compose->account);
-		g_string_append_printf(header, "Message-ID: <%s>\n", addr);
-		if (compose->msgid)
-			g_free(compose->msgid);
-		compose->msgid = addr;
-	} else {
-		compose->msgid = NULL;
+	if (compose->msgid != NULL && strlen(compose->msgid) > 0) {
+		g_string_append_printf(header, "Message-ID: <%s>\n",
+				compose->msgid);
 	}
 
 	if (compose->remove_references == FALSE) {

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list