talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 3002607bf3f9836127098ad738e3423fedaa5a36
parent be33af15e1dddb9c531617218bd9e31926a04ad2
Author: Colin Leroy <colin@colino.net>
Date:   Fri, 24 Apr 2009 10:30:14 +0000

2009-04-24 [colin]	3.7.1cvs45

	* src/compose.c
		Ask before sending if an attached file has
		disappeared.

Diffstat:
MChangeLog | 6++++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/compose.c | 23++++++++++++++++++-----
4 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,9 @@ +2009-04-24 [colin] 3.7.1cvs45 + + * src/compose.c + Ask before sending if an attached file has + disappeared. + 2009-04-19 [paul] 3.7.1cvs44 * src/prefs_common.c diff --git a/PATCHSETS b/PATCHSETS @@ -3784,3 +3784,4 @@ ( cvs diff -u -r 1.49.2.129 -r 1.49.2.130 src/procmime.c; ) > 3.7.1cvs42.patchset ( cvs diff -u -r 1.1.2.4 -r 1.1.2.5 tools/csv2addressbook.pl; ) > 3.7.1cvs43.patchset ( cvs diff -u -r 1.204.2.189 -r 1.204.2.190 src/prefs_common.c; cvs diff -u -r 1.103.2.123 -r 1.103.2.124 src/prefs_common.h; cvs diff -u -r 1.4.2.74 -r 1.4.2.75 src/gtk/about.c; ) > 3.7.1cvs44.patchset +( cvs diff -u -r 1.382.2.506 -r 1.382.2.507 src/compose.c; ) > 3.7.1cvs45.patchset diff --git a/configure.ac b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=7 MICRO_VERSION=1 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=44 +EXTRA_VERSION=45 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/compose.c b/src/compose.c @@ -282,7 +282,7 @@ static gint compose_queue_sub (Compose *compose, gchar **msgpath, gboolean check_subject, gboolean remove_reedit_target); -static void compose_add_attachments (Compose *compose, +static int compose_add_attachments (Compose *compose, MimeInfo *parent); static gchar *compose_get_header (Compose *compose); @@ -5358,7 +5358,8 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool g_node_append(mimempart->node, mimetext->node); g_node_append(mimemsg->node, mimempart->node); - compose_add_attachments(compose, mimempart); + if (compose_add_attachments(compose, mimempart) < 0) + return -1; } else g_node_append(mimemsg->node, mimetext->node); @@ -5783,7 +5784,7 @@ static gint compose_queue_sub(Compose *compose, gint *msgnum, FolderItem **item, return 0; } -static void compose_add_attachments(Compose *compose, MimeInfo *parent) +static int compose_add_attachments(Compose *compose, MimeInfo *parent) { AttachInfo *ainfo; GtkTreeView *tree_view = GTK_TREE_VIEW(compose->attach_clist); @@ -5796,12 +5797,22 @@ static void compose_add_attachments(Compose *compose, MimeInfo *parent) model = gtk_tree_view_get_model(tree_view); if (!gtk_tree_model_get_iter_first(model, &iter)) - return; + return 0; do { gtk_tree_model_get(model, &iter, COL_DATA, &ainfo, -1); - + + if (!is_file_exist(ainfo->file)) { + gchar *msg = g_strdup_printf(_("Attachment %s doesn't exist anymore. Ignore?"), ainfo->file); + AlertValue val = alertpanel_full(_("Warning"), msg, _("Cancel sending"), _("Ignore attachment"), + NULL, FALSE, NULL, ALERT_WARNING, G_ALERTDEFAULT); + g_free(msg); + if (val == G_ALERTDEFAULT) { + return -1; + } + continue; + } mimepart = procmime_mimeinfo_new(); mimepart->content = MIMECONTENT_FILE; mimepart->data.filename = g_strdup(ainfo->file); @@ -5850,6 +5861,8 @@ static void compose_add_attachments(Compose *compose, MimeInfo *parent) g_node_append(parent->node, mimepart->node); } while (gtk_tree_model_iter_next(model, &iter)); + + return 0; } #define IS_IN_CUSTOM_HEADER(header) \