From 398178c265ff68ceeafa6a84089bc01ae949e314 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Thu, 12 May 2016 21:50:48 -0600 Subject: * When a filename is attached and its name is encoded, the save attachment command will offer to save the file in the encoded form. This might work for some users, but the save command will have a subcommand ^N to decode the file name and save the file with the decoded name. --- alpine/mailcmd.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'alpine/mailcmd.c') diff --git a/alpine/mailcmd.c b/alpine/mailcmd.c index 4d519897..5e95d334 100644 --- a/alpine/mailcmd.c +++ b/alpine/mailcmd.c @@ -4233,9 +4233,6 @@ get_export_filename(struct pine *ps, char *filename, char *deefault, pos = hist_len + items_in_hist(dir_hist); - if(dir_hist == NULL) - init_hist(&dir_hist, HISTSIZE); - if(flags & GE_ALLPARTS || history || dir_hist){ /* * Copy the opts and add one to the end of the list. @@ -4282,6 +4279,15 @@ get_export_filename(struct pine *ps, char *filename, char *deefault, opts[i++].label = N_("Binary"); } + rfc1522_decode_to_utf8((unsigned char *)tmp_20k_buf, + SIZEOF_20KBUF, filename); + if(strcmp(tmp_20k_buf, filename)){ + opts[i].ch = ctrl('N'); + opts[i].rval = 40; + opts[i].name = "^N"; + opts[i++].label = "Name UTF8"; + } + if(dir_hist || hist_len > 0){ opts[i].ch = ctrl('Y'); opts[i].rval = 32; @@ -4827,6 +4833,13 @@ get_export_filename(struct pine *ps, char *filename, char *deefault, Writechar(BELL, 0); continue; } + else if(r == 40){ + rfc1522_decode_to_utf8((unsigned char *)tmp_20k_buf, + SIZEOF_20KBUF, filename); + strncpy(filename, tmp_20k_buf, len); + filename[len-1] = '\0'; + continue; + } else if(r != 0){ Writechar(BELL, 0); continue; -- cgit v1.2.3-54-g00ecf