aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorGravatar Eduardo Chappa 2022-07-04 11:28:16 -0600
committerGravatar Eduardo Chappa 2022-07-04 11:28:16 -0600
commit8444b4270da7e23bfa17fb29fa86da946ad9cff6 (patch)
treebbf2381e0d08d1eaea4851693a1f3f62c53f5714
parent54a7d55ac6a4cd85fcdeb4dbb0030f69a1957523 (diff)
downloadalpine-8444b4270da7e23bfa17fb29fa86da946ad9cff6.tar.gz
alpine-8444b4270da7e23bfa17fb29fa86da946ad9cff6.tar.xz
alpine-8444b4270da7e23bfa17fb29fa86da946ad9cff6.zip
* Improvements to error detection for the eXternal command.
-rw-r--r--alpine/mailpart.c32
-rw-r--r--pith/pine.hlp2
2 files changed, 22 insertions, 12 deletions
diff --git a/alpine/mailpart.c b/alpine/mailpart.c
index 0e86d5a..1c69391 100644
--- a/alpine/mailpart.c
+++ b/alpine/mailpart.c
@@ -1449,7 +1449,7 @@ write_attachment(int qline, long int msgno, ATTACH_S *a, char *method)
int
write_attachment_to_file(MAILSTREAM *stream, long int msgno, ATTACH_S *a, int flags, char *file)
{
- char *l_string, sbuf[256], *err;
+ char *l_string, sbuf[256], *err, *err2 = NULL;
int is_text, we_cancel = 0, dt_flags = 0, so_flags;
long len, orig_size;
gf_io_t pc;
@@ -1491,9 +1491,9 @@ write_attachment_to_file(MAILSTREAM *stream, long int msgno, ATTACH_S *a, int fl
cancel_busy_cue(0);
if(so_give(&store)) /* close file */
- err = error_description(errno);
+ err2 = error_description(errno);
- if(err){
+ if(err || err2){
if(!(flags & (GER_APPEND | GER_OVER)))
our_unlink(file);
else
@@ -1502,7 +1502,7 @@ write_attachment_to_file(MAILSTREAM *stream, long int msgno, ATTACH_S *a, int fl
q_status_message2(SM_ORDER | SM_DING, 3, 5,
/* TRANSLATORS: <error text>: Error writing attachment to <filename> */
_("%s: Error writing attachment to \"%s\""),
- err, file);
+ err ? err : err2, file);
return -1;
}
else{
@@ -2003,7 +2003,7 @@ display_html_external_attachment(long int msgno, ATTACH_S *a, int flags)
STORE_S *store;
gf_io_t pc;
char *err;
- int we_cancel = 0, saved, errs;
+ int we_cancel = 0, errs;
char *tool;
ATTACH_S *att;
unsigned long rawno;
@@ -2095,15 +2095,14 @@ display_html_external_attachment(long int msgno, ATTACH_S *a, int flags)
so_give(&store);
/*----- Download all needed inline attachments ------*/
- saved = errs = 0;
+ errs = 0;
rawno = mn_m2raw(ps_global->msgmap, msgno);
for (att = ps_global->atmts; rawno > 0 && att->description != NULL; att++){
if(att->cid_tmpfile){
if(write_attachment_to_file(ps_global->mail_stream, rawno,
- att, GER_NONE, att->cid_tmpfile) == 1)
- saved++;
- else
- errs++;
+ att, GER_NONE, att->cid_tmpfile) != 1
+ || name_file_size(att->cid_tmpfile) == 0L)
+ errs++;
fs_give((void **) &att->cid_tmpfile);
}
if(att->tmpdir)
@@ -2112,7 +2111,7 @@ display_html_external_attachment(long int msgno, ATTACH_S *a, int flags)
if(err){
q_status_message2(SM_ORDER | SM_DING, 3, 5,
- "%s: Error saving image to temp file %s",
+ "%s: Error saving message to temp file %s",
err, filename);
if(filename){
our_unlink(filename);
@@ -2121,6 +2120,17 @@ display_html_external_attachment(long int msgno, ATTACH_S *a, int flags)
return(1);
}
+ switch(errs){
+ case 0 : break;
+ case 1 : q_status_message(SM_ORDER | SM_DING, 3, 5,
+ "Failed to download one image. Continuing...");
+ break;
+ default: q_status_message1(SM_ORDER | SM_DING, 3, 5,
+ "Failed to download %s images. Continuing...",
+ int2string(errs));
+ break;
+ }
+
tool = get_url_external_handler("http://", 1);
if(tool == NULL) tool = get_url_external_handler("http://", 0);
if(tool == NULL) tool = get_url_external_handler("https://", 1);
diff --git a/pith/pine.hlp b/pith/pine.hlp
index ae908ff..e89383c 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -147,7 +147,7 @@ with help text for the config screen and the composer that didn't have any
reasonable place to be called from.
Dummy change to get revision in pine.hlp
============= h_revision =================
-Alpine Commit 656 2022-06-19 09:27:58
+Alpine Commit 657 2022-07-04 11:28:11
============= h_news =================
<HTML>
<HEAD>