summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--OPS1
-rw-r--r--compose.c6
-rw-r--r--functions.h3
-rw-r--r--init.h3
-rw-r--r--mutt.h2
-rw-r--r--parse.c20
-rw-r--r--pgp.c10
-rw-r--r--recvattach.c8
-rw-r--r--send.c1
-rw-r--r--sendlib.c12
10 files changed, 48 insertions, 18 deletions
diff --git a/OPS b/OPS
index 2c3898fa..b6150354 100644
--- a/OPS
+++ b/OPS
@@ -36,6 +36,7 @@ OP_COMPOSE_RECODE "recode this attachment to/from the local charset"
OP_COMPOSE_POSTPONE_MESSAGE "save this message to send later"
OP_COMPOSE_RENAME_FILE "rename/move an attached file"
OP_COMPOSE_SEND_MESSAGE "send the message"
+OP_COMPOSE_TOGGLE_DISPOSITION "toggle disposition between inline/attachment"
OP_COMPOSE_TOGGLE_UNLINK "toggle whether to delete file after sending it"
OP_COMPOSE_UPDATE_ENCODING "update an attachment's encoding info"
OP_COMPOSE_WRITE_MESSAGE "write the message to a folder"
diff --git a/compose.c b/compose.c
index dcbc8e8a..73fe6338 100644
--- a/compose.c
+++ b/compose.c
@@ -845,6 +845,12 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
}
break;
+ case OP_COMPOSE_TOGGLE_DISPOSITION:
+ /* toggle the content-disposition between inline/attachment */
+ idx[menu->current]->content->disposition = (idx[menu->current]->content->disposition == DISPINLINE) ? DISPATTACH : DISPINLINE;
+ menu->redraw = REDRAW_CURRENT;
+ break;
+
case OP_EDIT_TYPE:
CHECK_COUNT;
{
diff --git a/functions.h b/functions.h
index e5f6ad0c..df62df78 100644
--- a/functions.h
+++ b/functions.h
@@ -270,7 +270,7 @@ struct binding_t OpCompose[] = {
{ "edit-cc", OP_COMPOSE_EDIT_CC, "c" },
{ "copy-file", OP_SAVE, "C" },
{ "detach-file", OP_DELETE, "D" },
- { "display-toggle-weed", OP_DISPLAY_HEADERS, "h" },
+ { "toggle-disposition",OP_COMPOSE_TOGGLE_DISPOSITION, "\004" },
{ "edit-description", OP_COMPOSE_EDIT_DESCRIPTION, "d" },
{ "edit-message", OP_COMPOSE_EDIT_MESSAGE, "e" },
{ "edit-headers", OP_COMPOSE_EDIT_HEADERS, "E" },
@@ -280,6 +280,7 @@ struct binding_t OpCompose[] = {
{ "edit-fcc", OP_COMPOSE_EDIT_FCC, "f" },
{ "filter-entry", OP_FILTER, "F" },
{ "get-attachment", OP_COMPOSE_GET_ATTACHMENT, "G" },
+ { "display-toggle-weed", OP_DISPLAY_HEADERS, "h" },
{ "ispell", OP_COMPOSE_ISPELL, "i" },
{ "print-entry", OP_PRINT, "l" },
{ "edit-mime", OP_COMPOSE_EDIT_MIME, "m" },
diff --git a/init.h b/init.h
index 438dd8c5..9e866fbc 100644
--- a/init.h
+++ b/init.h
@@ -177,7 +177,7 @@ struct option_t MuttVars[] = {
** If set, Mutt will prompt you for carbon-copy (Cc) recipients before
** editing the body of an outgoing message.
*/
- { "attach_format", DT_STR, R_NONE, UL &AttachFormat, UL "%u%D%t%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] " },
+ { "attach_format", DT_STR, R_NONE, UL &AttachFormat, UL "%u%D%t%I%4n %T%.40d%> [%.7m/%.10M, %.6e%?C?, %C?, %s] " },
/*
** .pp
** This variable describes the format of the `attachment' menu. The
@@ -188,6 +188,7 @@ struct option_t MuttVars[] = {
** %d description
** %e MIME content-transfer-encoding
** %f filename
+ ** %I disposition (I=inline, A=attachment)
** %m major MIME type
** %M MIME subtype
** %n attachment number
diff --git a/mutt.h b/mutt.h
index 5b0d6854..abf1ccf4 100644
--- a/mutt.h
+++ b/mutt.h
@@ -519,7 +519,7 @@ typedef struct body
unsigned int type : 4; /* content-type primary type */
unsigned int encoding : 3; /* content-transfer-encoding */
unsigned int disposition : 2; /* content-disposition */
- unsigned int use_disp : 1; /* Content-Disposition field printed? */
+ unsigned int use_disp : 1; /* Content-Disposition uses filename= ? */
unsigned int unlink : 1; /* flag to indicate the the file named by
* "filename" should be unlink()ed before
* free()ing this structure
diff --git a/parse.c b/parse.c
index 0f6a82c8..cdaa577d 100644
--- a/parse.c
+++ b/parse.c
@@ -370,11 +370,12 @@ BODY *mutt_read_mime_header (FILE *fp, int digest)
char *line = safe_malloc (LONG_STRING);
size_t linelen = LONG_STRING;
- p->hdr_offset = ftell(fp);
-
- p->encoding = ENC7BIT; /* default from RFC1521 */
- p->type = digest ? TYPEMESSAGE : TYPETEXT;
+ p->hdr_offset = ftell(fp);
+ p->encoding = ENC7BIT; /* default from RFC1521 */
+ p->type = digest ? TYPEMESSAGE : TYPETEXT;
+ p->disposition = DISPINLINE;
+
while (*(line = read_rfc822_line (fp, line, &linelen)) != 0)
{
/* Find the value of the current header */
@@ -887,10 +888,13 @@ ENVELOPE *mutt_read_rfc822_header (FILE *f, HEADER *hdr, short user_hdrs,
hdr->content = mutt_new_body ();
/* set the defaults from RFC1521 */
- hdr->content->type = TYPETEXT;
- hdr->content->subtype = safe_strdup ("plain");
- hdr->content->encoding = ENC7BIT;
- hdr->content->length = -1;
+ hdr->content->type = TYPETEXT;
+ hdr->content->subtype = safe_strdup ("plain");
+ hdr->content->encoding = ENC7BIT;
+ hdr->content->length = -1;
+
+ /* RFC 2183 says this is arbitrary */
+ hdr->content->disposition = DISPINLINE;
}
}
diff --git a/pgp.c b/pgp.c
index 2f7c0acd..5902d677 100644
--- a/pgp.c
+++ b/pgp.c
@@ -1122,8 +1122,9 @@ static BODY *pgp_sign_message (BODY *a)
t = mutt_new_body ();
t->type = TYPEMULTIPART;
t->subtype = safe_strdup ("signed");
- t->use_disp = 0;
t->encoding = ENC7BIT;
+ t->use_disp = 0;
+ t->disposition = DISPINLINE;
mutt_generate_boundary (&t->parameter);
mutt_set_parameter ("protocol", "application/pgp-signature", &t->parameter);
@@ -1138,6 +1139,7 @@ static BODY *pgp_sign_message (BODY *a)
t->subtype = safe_strdup ("pgp-signature");
t->filename = safe_strdup (sigfile);
t->use_disp = 0;
+ t->disposition = DISPINLINE;
t->encoding = ENC7BIT;
t->unlink = 1; /* ok to remove this file after sending. */
@@ -1345,6 +1347,7 @@ static BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign)
t->subtype = safe_strdup ("encrypted");
t->encoding = ENC7BIT;
t->use_disp = 0;
+ t->disposition = DISPINLINE;
mutt_generate_boundary(&t->parameter);
mutt_set_parameter("protocol", "application/pgp-encrypted", &t->parameter);
@@ -1353,7 +1356,9 @@ static BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign)
t->parts->type = TYPEAPPLICATION;
t->parts->subtype = safe_strdup ("pgp-encrypted");
t->parts->encoding = ENC7BIT;
- t->parts->use_disp = 0;
+ t->parts->use_disp = 1;
+ t->parts->disposition = DISPINLINE;
+ t->parts->d_filename = safe_strdup ("msg.asc"); /* non pgp/mime can save */
t->parts->next = mutt_new_body ();
t->parts->next->type = TYPEAPPLICATION;
@@ -1361,6 +1366,7 @@ static BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign)
t->parts->next->encoding = ENC7BIT;
t->parts->next->filename = safe_strdup (tempfile);
t->parts->next->use_disp = 0;
+ t->parts->next->disposition = DISPINLINE;
t->parts->next->unlink = 1; /* delete after sending the message */
return (t);
diff --git a/recvattach.c b/recvattach.c
index 17dbe1d3..01f82970 100644
--- a/recvattach.c
+++ b/recvattach.c
@@ -161,6 +161,7 @@ ATTACHPTR **mutt_gen_attach_list (BODY *m,
* %d = description
* %e = MIME content-transfer-encoding
* %f = filename
+ * %I = content-disposition, either I (inline) or A (attachment)
* %t = tagged flag
* %m = major MIME type
* %M = MIME subtype
@@ -275,6 +276,13 @@ const char *mutt_attach_fmt (char *dest,
snprintf (dest, destlen, fmt, ENCODING (aptr->content->encoding));
}
break;
+ case 'I':
+ if (!optional)
+ {
+ snprintf (dest, destlen, "%c",
+ (aptr->content->disposition == DISPINLINE) ? 'I' : 'A');
+ }
+ break;
case 'm':
if(!optional)
{
diff --git a/send.c b/send.c
index 6eb5b133..4196fec8 100644
--- a/send.c
+++ b/send.c
@@ -1038,6 +1038,7 @@ ci_send_message (int flags, /* send mode */
msg->content->subtype = safe_strdup ("plain");
msg->content->unlink = 1;
msg->content->use_disp = 0;
+ msg->content->disposition = DISPINLINE;
if (!tempfile)
{
diff --git a/sendlib.c b/sendlib.c
index 4ce2d873..e61b9396 100644
--- a/sendlib.c
+++ b/sendlib.c
@@ -407,10 +407,10 @@ int mutt_write_mime_header (BODY *a, FILE *f)
if (a->description)
fprintf(f, "Content-Description: %s\n", a->description);
- if (a->use_disp && (a->disposition == DISPATTACH || a->filename || a->d_filename))
- {
- fprintf (f, "Content-Disposition: %s", DISPOSITION (a->disposition));
+ fprintf (f, "Content-Disposition: %s", DISPOSITION (a->disposition));
+ if (a->use_disp)
+ {
if(!(fn = a->d_filename))
fn = a->filename;
@@ -427,10 +427,10 @@ int mutt_write_mime_header (BODY *a, FILE *f)
rfc822_cat (buffer, sizeof (buffer), tmp, MimeSpecials);
fprintf (f, "; filename%s=%s", encode ? "*" : "", buffer);
}
-
- fputc ('\n', f);
}
+ fputc ('\n', f);
+
if (a->encoding != ENC7BIT)
fprintf(f, "Content-Transfer-Encoding: %s\n", ENCODING (a->encoding));
@@ -999,6 +999,7 @@ BODY *mutt_make_message_attach (CONTEXT *ctx, HEADER *hdr, int attach_msg)
body->filename = safe_strdup (buffer);
body->unlink = 1;
body->use_disp = 0;
+ body->disposition = DISPINLINE;
mutt_parse_mime_message (ctx, hdr);
@@ -1143,6 +1144,7 @@ BODY *mutt_make_multipart (BODY *b)
new->encoding = get_toplevel_encoding (b);
mutt_generate_boundary (&new->parameter);
new->use_disp = 0;
+ new->disposition = DISPINLINE;
new->parts = b;
return new;