summaryrefslogtreecommitdiffstats
path: root/compose.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2017-08-10 18:18:21 -0700
committerKevin McCarthy <kevin@8t8.us>2017-08-10 18:18:21 -0700
commit2fd6f99bea1337e1b490a9056033fe0151f22ddc (patch)
tree58ed4ac34b12270b6c495d8f20ef805b9d376481 /compose.c
parent7a002ec117886669ba9e1f19bed506847b730c9d (diff)
Change recvattach to allow nested encryption. (see #3728)
* Add a FP and BODY array to the actx. These are used to allow proper cleanup. * Add HEADER and root_fp entries, to allow for index regeneration. * Separate out the compose and recvattach index generation functions. * Change the recvattach index generator to decrypt as encrypted parts are found.
Diffstat (limited to 'compose.c')
-rw-r--r--compose.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/compose.c b/compose.c
index 4da1e5ff..87bcb47a 100644
--- a/compose.c
+++ b/compose.c
@@ -450,6 +450,38 @@ static int delete_attachment (MUTTMENU *menu, short *idxlen, int x)
return (0);
}
+static void mutt_gen_compose_attach_list (ATTACH_CONTEXT *actx,
+ BODY *m,
+ int parent_type,
+ int level)
+{
+ ATTACHPTR *new;
+
+ for (; m; m = m->next)
+ {
+ if (m->type == TYPEMULTIPART && m->parts
+ && (!(WithCrypto & APPLICATION_PGP) || !mutt_is_multipart_encrypted(m))
+ )
+ {
+ mutt_gen_compose_attach_list (actx, m->parts, m->type, level);
+ }
+ else
+ {
+ new = (ATTACHPTR *) safe_calloc (1, sizeof (ATTACHPTR));
+ mutt_actx_add_attach (actx, new, NULL);
+ new->content = m;
+ m->aptr = new;
+ new->parent_type = parent_type;
+ new->level = level;
+
+ /* We don't support multipart messages in the compose menu yet */
+ }
+ }
+
+ if (level == 0)
+ mutt_update_tree (actx);
+}
+
static void update_idx (MUTTMENU *menu, ATTACH_CONTEXT *actx, ATTACHPTR *new)
{
new->level = (actx->idxlen > 0) ? actx->idx[actx->idxlen-1]->level : 0;
@@ -665,8 +697,8 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
rd.fcc = fcc;
actx = safe_calloc (sizeof(ATTACH_CONTEXT), 1);
- mutt_attach_init (msg->content);
- mutt_gen_attach_list (actx, msg->content, -1, 0, 1);
+ mutt_gen_compose_attach_list (actx, msg->content, -1, 0);
+ mutt_attach_init (actx);
menu = mutt_new_menu (MENU_COMPOSE);
menu->offset = HDR_ATTACH;
@@ -787,7 +819,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */
if (actx->idxlen && actx->idx[actx->idxlen - 1]->content->next)
{
mutt_actx_free_entries (actx);
- mutt_gen_attach_list (actx, msg->content, -1, 0, 1);
+ mutt_gen_compose_attach_list (actx, msg->content, -1, 0);
menu->data = actx->idx;
menu->max = actx->idxlen;
}