summaryrefslogtreecommitdiff
path: root/alpine/mailcmd.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2016-05-12 21:50:48 -0600
committerEduardo Chappa <chappa@washington.edu>2016-05-12 21:50:48 -0600
commit398178c265ff68ceeafa6a84089bc01ae949e314 (patch)
treee27e7539f44d0802a5d1379f317a2283032ddd1a /alpine/mailcmd.c
parentb74b7a0d9eb48dbe3ea773885135ecb924d8a902 (diff)
downloadalpine-398178c265ff68ceeafa6a84089bc01ae949e314.tar.xz
* 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.
Diffstat (limited to 'alpine/mailcmd.c')
-rw-r--r--alpine/mailcmd.c19
1 files changed, 16 insertions, 3 deletions
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;