[Commits] [SCM] claws branch, master, updated. 4.3.0-41-g302c2dfca

paul at claws-mail.org paul at claws-mail.org
Sat Sep 28 06:03:04 UTC 2024


The branch, master has been updated
       via  302c2dfcae9028ae38b34e6f6b299ff8bba57096 (commit)
      from  d5b6496a51fc272242bd52a4d6d47e0aa5ebe9a4 (commit)

Summary of changes:
 src/compose.c |  4 ++--
 src/procmsg.c | 60 +++++++++++++++++++++++------------------------------------
 src/procmsg.h |  3 +--
 3 files changed, 26 insertions(+), 41 deletions(-)


- Log -----------------------------------------------------------------
commit 302c2dfcae9028ae38b34e6f6b299ff8bba57096
Author: Paul <paul at claws-mail.org>
Date:   Sat Sep 28 07:03:00 2024 +0100

    clean up procmsg_save_to_outbox()
    
    is_queded is always TRUE, we don't need it; add an alertpanel_warning which is, nevertheless, unlikely to ever be reached; improve the English used

diff --git a/src/compose.c b/src/compose.c
index 2318263f6..e6e90541e 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -5991,7 +5991,7 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
 						if (!outbox)
 							outbox = folder_get_default_outbox();
 
-						procmsg_save_to_outbox(outbox, tmp_enc_file, TRUE);
+						procmsg_save_to_outbox(outbox, tmp_enc_file);
 						claws_unlink(tmp_enc_file);
 					} else {
 						g_warning("can't open file '%s'", tmp_enc_file);
@@ -7611,7 +7611,7 @@ static void compose_savemsg_select_cb(GtkWidget *widget, Compose *compose)
 	gchar * path;
 
 	dest = foldersel_folder_sel(NULL, FOLDER_SEL_COPY, NULL, FALSE,
-			_("Select folder to save message to"));
+			_("Select the folder where you want to save the sent message"));
 	if (!dest) return;
 
 	path = folder_item_get_identifier(dest);
diff --git a/src/procmsg.c b/src/procmsg.c
index e2373cb42..36f5b2514 100644
--- a/src/procmsg.c
+++ b/src/procmsg.c
@@ -1153,8 +1153,7 @@ gint procmsg_remove_special_headers(const gchar *in, const gchar *out)
 	return 0;
 }
 
-gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file,
-			    gboolean is_queued)
+gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file)
 {
 	gint num;
 	MsgInfo *msginfo, *tmp_msginfo;
@@ -1169,48 +1168,35 @@ gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file,
 	cm_return_val_if_fail(outbox != NULL, -1);
 
 	outbox_path = folder_item_get_path(outbox);
-	debug_print("saving sent message to %s...\n", outbox_path);
+	debug_print("attempting to save sent message to %s...\n", outbox_path);
 	g_free(outbox_path);
 
-	/* remove queueing headers */
-	if (is_queued) {
-		gchar tmp[MAXPATHLEN + 1];
+	gchar tmp[MAXPATHLEN + 1];
 
-		g_snprintf(tmp, sizeof(tmp), "%s%ctmpmsg.out.%08x",
-			   get_rc_dir(), G_DIR_SEPARATOR, (guint) rand());
-		
-		if (procmsg_remove_special_headers(file, tmp) !=0)
-			return -1;
+	g_snprintf(tmp, sizeof(tmp), "%s%ctmpmsg.out.%08x",
+		   get_rc_dir(), G_DIR_SEPARATOR, (guint) rand());
+	
+	if (procmsg_remove_special_headers(file, tmp) !=0)
+		return -1;
 
-		while (folder_item_scan(outbox) < 0) {
-			outbox = foldersel_folder_sel(NULL, FOLDER_SEL_SAVE, NULL, FALSE,
-						      _("Select folder to save message to"));
-			if (outbox == NULL) {
-				g_warning("not saving message");
-				claws_unlink(tmp);
-				return -1;
-			}
-		}
-		if ((num = folder_item_add_msg(outbox, tmp, &flag, TRUE)) < 0) {
-			g_warning("not saving message");
+	while (folder_item_scan(outbox) < 0) {
+		outbox = foldersel_folder_sel(NULL, FOLDER_SEL_SAVE, NULL, FALSE,
+				_("Select the folder where you want to save the sent message"));
+		if (outbox == NULL) {
+			g_warning("not saving sent message");
 			claws_unlink(tmp);
 			return -1;
 		}
-	} else {
-		while (folder_item_scan(outbox) < 0) {
-			outbox = foldersel_folder_sel(NULL, FOLDER_SEL_SAVE, NULL, FALSE,
-						      _("Select folder to save message to"));
-			if (outbox == NULL) {
-				g_warning("not saving message");
-				return -1;
-			}
-		}
-		if ((num = folder_item_add_msg
-			(outbox, file, &flag, FALSE)) < 0) {
-			g_warning("not saving message");
-			return -1;
-		}
 	}
+	if ((num = folder_item_add_msg(outbox, tmp, &flag, TRUE)) < 0) {
+		g_warning("not saving sent message");
+		outbox_path = folder_item_get_path(outbox);
+		alertpanel_warning(_("Could not save sent message to %s."), outbox_path);
+		claws_unlink(tmp);
+		g_free(outbox_path);
+		return -1;
+	}
+
 	msginfo = folder_item_get_msginfo(outbox, num);		/* refcnt++ */
 	tmp_msginfo = procmsg_msginfo_get_full_info(msginfo);	/* refcnt++ */ 
 	if (msginfo != NULL) {
@@ -1820,7 +1806,7 @@ send_mail:
 			}
 			if (!saved) {
 				debug_print("resaving queued mail to sent folder\n");
-				procmsg_save_to_outbox(outbox, file, TRUE);
+				procmsg_save_to_outbox(outbox, file);
 			}
 		}
 	}
diff --git a/src/procmsg.h b/src/procmsg.h
index 029ca0b2c..efff0e8fc 100644
--- a/src/procmsg.h
+++ b/src/procmsg.h
@@ -370,8 +370,7 @@ void procmsg_msginfo_change_flags	(MsgInfo *msginfo,
 gint procmsg_remove_special_headers	(const gchar 	*in, 
 					 const gchar 	*out);
 
-gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file,
-			    gboolean is_queued);
+gint procmsg_save_to_outbox(FolderItem *outbox, const gchar *file);
 gboolean procmsg_msg_has_flagged_parent	(MsgInfo 	*info,
 					 MsgPermFlags    perm_flags);
 gboolean procmsg_msg_has_marked_parent	(MsgInfo	*info);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list