for (i = 0; i < actx->idxlen; i++)
{
actx->idx[i]->content->tagged = 0;
- actx->idx[i]->content->collapsed = 0;
+ if (option (OPTDIGESTCOLLAPSE) &&
+ actx->idx[i]->content->type == TYPEMULTIPART &&
+ !ascii_strcasecmp (actx->idx[i]->content->subtype, "digest"))
+ actx->idx[i]->content->collapsed = 1;
+ else
+ actx->idx[i]->content->collapsed = 0;
}
}
menu->redraw |= REDRAW_INDEX;
}
-/* TODO: fix this to use the index */
-static void attach_collapse (BODY *b, short collapse, short init, short just_one)
+static void attach_collapse (ATTACH_CONTEXT *actx, MUTTMENU *menu)
{
- short i;
- for (; b; b = b->next)
+ int rindex, curlevel;
+
+ CURATTACH->content->collapsed = !CURATTACH->content->collapsed;
+ /* When expanding, expand all the children too */
+ if (CURATTACH->content->collapsed)
+ return;
+
+ curlevel = CURATTACH->level;
+ rindex = actx->v2r[menu->current] + 1;
+
+ while ((rindex < actx->idxlen) &&
+ (actx->idx[rindex]->level > curlevel))
{
- i = init || b->collapsed;
- if (i && option (OPTDIGESTCOLLAPSE) && b->type == TYPEMULTIPART
- && !ascii_strcasecmp (b->subtype, "digest"))
- attach_collapse (b->parts, 1, 1, 0);
- else if (b->type == TYPEMULTIPART || mutt_is_message_type (b->type, b->subtype))
- attach_collapse (b->parts, collapse, i, 0);
- b->collapsed = collapse;
- if (just_one)
- return;
+ if (option (OPTDIGESTCOLLAPSE) &&
+ actx->idx[rindex]->content->type == TYPEMULTIPART &&
+ !ascii_strcasecmp (actx->idx[rindex]->content->subtype, "digest"))
+ actx->idx[rindex]->content->collapsed = 1;
+ else
+ actx->idx[rindex]->content->collapsed = 0;
+ rindex++;
}
}
mutt_error _("There are no subparts to show!");
break;
}
- if (!CURATTACH->content->collapsed)
- attach_collapse (CURATTACH->content, 1, 0, 1);
- else
- attach_collapse (CURATTACH->content, 0, 1, 1);
+ attach_collapse (actx, menu);
mutt_update_recvattach_menu (actx, menu, 0);
break;
-
+
case OP_FORGET_PASSPHRASE:
crypt_forget_passphrase ();
break;
case OP_EXTRACT_KEYS:
if ((WithCrypto & APPLICATION_PGP))
{
- crypt_pgp_extract_keys_from_attachment_list (fp, menu->tagprefix,
+ crypt_pgp_extract_keys_from_attachment_list (fp, menu->tagprefix,
menu->tagprefix ? cur : CURATTACH->content);
menu->redraw = REDRAW_FULL;
}
break;
-
+
case OP_CHECK_TRADITIONAL:
if ((WithCrypto & APPLICATION_PGP)
&& crypt_pgp_check_traditional (fp, menu->tagprefix ? cur