summaryrefslogtreecommitdiff
path: root/pith/detach.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2015-05-17 14:51:57 -0600
committerEduardo Chappa <chappa@washington.edu>2015-05-17 14:51:57 -0600
commit2c5b8f86507ffae788e49a161175faea21066a24 (patch)
tree28002a40435e8981b3b316880311dd59c3c7b7e2 /pith/detach.c
parentc321daf6cf4a68fbe5166584fbf7d3b738d4c291 (diff)
downloadalpine-2c5b8f86507ffae788e49a161175faea21066a24.tar.xz
* Add the Control-R subcommand to the save command for attachments.
This subcommand toggles if the saving will be done in binary mode for text attachments. When a user saves an attachment using binary mode it will be saved as it was sent, otherwise the attachment will be transformed to UTF-8 for further transformation through internal and user defined filters for saving.
Diffstat (limited to 'pith/detach.c')
-rw-r--r--pith/detach.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/pith/detach.c b/pith/detach.c
index 0e0a07be..9befeb72 100644
--- a/pith/detach.c
+++ b/pith/detach.c
@@ -202,7 +202,7 @@ detach(MAILSTREAM *stream, /* c-client stream to use */
}
/* convert all text to UTF-8 */
- if(is_text){
+ if(is_text & !(flags & DT_BINARY)){
charset = parameter_val(body->parameter, "charset");
/*
@@ -261,7 +261,9 @@ detach(MAILSTREAM *stream, /* c-client stream to use */
* a multipart segment since an external handler's going to have to
* make sense of it...
*/
- if(is_text || body->type == TYPEMESSAGE || body->type == TYPEMULTIPART)
+ if((is_text & !(flags & DT_BINARY))
+ || body->type == TYPEMESSAGE
+ || body->type == TYPEMULTIPART)
gf_link_filter(gf_nvtnl_local, NULL);
/*
@@ -296,7 +298,7 @@ detach(MAILSTREAM *stream, /* c-client stream to use */
FILTLIST_S *p, *aux = NULL;
size_t count;
- if(aux_filters){
+ if(aux_filters && !(flags & DT_BINARY)){
/* insert NL conversion filters around remaining aux_filters
* so they're not tripped up by local NL convention
*/
@@ -336,7 +338,8 @@ detach(MAILSTREAM *stream, /* c-client stream to use */
for( ; aux_filters->filter ; aux_filters++)
gf_link_filter(aux_filters->filter, aux_filters->data);
- gf_link_filter(gf_nvtnl_local, NULL);
+ if(!(flags & DT_BINARY))
+ gf_link_filter(gf_nvtnl_local, NULL);
}
if((status = gf_pipe(gc, pc)) != NULL){ /* Second pass, sheesh */