diff options
-rw-r--r-- | attach.c | 12 | ||||
-rw-r--r-- | attach.h | 10 | ||||
-rw-r--r-- | browser.c | 2 | ||||
-rw-r--r-- | compose.c | 24 | ||||
-rw-r--r-- | pager.c | 23 | ||||
-rw-r--r-- | pager.h | 3 | ||||
-rw-r--r-- | recvattach.c | 14 | ||||
-rw-r--r-- | recvcmd.c | 206 |
8 files changed, 138 insertions, 156 deletions
@@ -330,7 +330,7 @@ void mutt_check_lookup_list (BODY *b, char *type, int len) /* returns -1 on error, 0 or the return code from mutt_do_pager() on success */ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, - ATTACHPTR **idx, short idxlen) + ATTACH_CONTEXT *actx) { char tempfile[_POSIX_PATH_MAX] = ""; char pagerfile[_POSIX_PATH_MAX] = ""; @@ -571,8 +571,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, info.fp = fp; info.bdy = a; info.ctx = Context; - info.idx = idx; - info.idxlen = idxlen; + info.actx = actx; info.hdr = hdr; rc = mutt_do_pager (descrip, pagerfile, @@ -1046,7 +1045,12 @@ int mutt_print_attachment (FILE *fp, BODY *a) void mutt_free_attach_context (ATTACH_CONTEXT **pactx) { int i; - ATTACH_CONTEXT *actx = *pactx; + ATTACH_CONTEXT *actx; + + if (!pactx || !*pactx) + return; + + actx = *pactx; for (i = 0; i < actx->idxlen; i++) { @@ -42,7 +42,7 @@ typedef struct attach_ctx void mutt_gen_attach_list (ATTACH_CONTEXT *, BODY *, int, int, int); void mutt_update_tree (ATTACH_CONTEXT *); -int mutt_view_attachment (FILE*, BODY *, int, HEADER *, ATTACHPTR **, short); +int mutt_view_attachment (FILE*, BODY *, int, HEADER *, ATTACH_CONTEXT *); int mutt_tag_attach (MUTTMENU *menu, int n, int m); int mutt_attach_display_loop (MUTTMENU *menu, int op, FILE *fp, HEADER *hdr, @@ -54,10 +54,10 @@ void mutt_save_attachment_list (FILE *fp, int tag, BODY *top, HEADER *hdr, MUTTM void mutt_pipe_attachment_list (FILE *fp, int tag, BODY *top, int filter); void mutt_print_attachment_list (FILE *fp, int tag, BODY *top); -void mutt_attach_bounce (FILE *, HEADER *, ATTACHPTR **, short, BODY *); -void mutt_attach_resend (FILE *, HEADER *, ATTACHPTR **, short, BODY *); -void mutt_attach_forward (FILE *, HEADER *, ATTACHPTR **, short, BODY *); -void mutt_attach_reply (FILE *, HEADER *, ATTACHPTR **, short, BODY *, int); +void mutt_attach_bounce (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *); +void mutt_attach_resend (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *); +void mutt_attach_forward (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *); +void mutt_attach_reply (FILE *, HEADER *, ATTACH_CONTEXT *, BODY *, int); void mutt_free_attach_context (ATTACH_CONTEXT **pactx); @@ -1275,7 +1275,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num b = mutt_make_file_attach (buf); if (b != NULL) { - mutt_view_attachment (NULL, b, MUTT_REGULAR, NULL, NULL, 0); + mutt_view_attachment (NULL, b, MUTT_REGULAR, NULL, NULL); mutt_free_body (&b); menu->redraw = REDRAW_FULL; } @@ -1340,18 +1340,13 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ if (!(flags & MUTT_COMPOSE_NOFREEHEADER)) { - while (actx->idxlen-- > 0) + for (i = 0; i < actx->idxlen; i++) { /* avoid freeing other attachments */ - actx->idx[actx->idxlen]->content->next = NULL; - actx->idx[actx->idxlen]->content->parts = NULL; - mutt_free_body (&actx->idx[actx->idxlen]->content); - FREE (&actx->idx[actx->idxlen]->tree); - FREE (&actx->idx[actx->idxlen]); + actx->idx[i]->content->next = NULL; + actx->idx[i]->content->parts = NULL; + mutt_free_body (&actx->idx[i]->content); } - FREE (&actx->idx); - actx->idxlen = 0; - actx->idxmax = 0; } r = -1; loop = 0; @@ -1489,20 +1484,11 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ mutt_menuDestroy (&menu); if (actx->idxlen) - { msg->content = actx->idx[0]->content; - for (i = 0; i < actx->idxlen; i++) - { - actx->idx[i]->content->aptr = NULL; - FREE (&actx->idx[i]->tree); - FREE (&actx->idx[i]); - } - } else msg->content = NULL; - FREE (&actx->idx); - FREE (&actx); + mutt_free_attach_context (&actx); return (r); } @@ -2462,8 +2462,7 @@ search_next: CHECK_ATTACH; if (IsMsgAttach (extra)) mutt_attach_bounce (extra->fp, extra->hdr, - extra->idx, extra->idxlen, - extra->bdy); + extra->actx, extra->bdy); else ci_bounce_message (extra->hdr); break; @@ -2473,8 +2472,7 @@ search_next: CHECK_ATTACH; if (IsMsgAttach (extra)) mutt_attach_resend (extra->fp, extra->hdr, - extra->idx, extra->idxlen, - extra->bdy); + extra->actx, extra->bdy); else mutt_resend_message (NULL, extra->ctx, extra->hdr); pager_menu->redraw = REDRAW_FULL; @@ -2640,9 +2638,8 @@ search_next: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; if (IsMsgAttach (extra)) - mutt_attach_reply (extra->fp, extra->hdr, extra->idx, - extra->idxlen, extra->bdy, - SENDREPLY); + mutt_attach_reply (extra->fp, extra->hdr, extra->actx, + extra->bdy, SENDREPLY); else ci_send_message (SENDREPLY, NULL, NULL, extra->ctx, extra->hdr); pager_menu->redraw = REDRAW_FULL; @@ -2659,8 +2656,8 @@ search_next: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; if (IsMsgAttach (extra)) - mutt_attach_reply (extra->fp, extra->hdr, extra->idx, - extra->idxlen, extra->bdy, SENDREPLY|SENDGROUPREPLY); + mutt_attach_reply (extra->fp, extra->hdr, extra->actx, + extra->bdy, SENDREPLY|SENDGROUPREPLY); else ci_send_message (SENDREPLY | SENDGROUPREPLY, NULL, NULL, extra->ctx, extra->hdr); pager_menu->redraw = REDRAW_FULL; @@ -2670,8 +2667,8 @@ search_next: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; if (IsMsgAttach (extra)) - mutt_attach_reply (extra->fp, extra->hdr, extra->idx, - extra->idxlen, extra->bdy, SENDREPLY|SENDLISTREPLY); + mutt_attach_reply (extra->fp, extra->hdr, extra->actx, + extra->bdy, SENDREPLY|SENDLISTREPLY); else ci_send_message (SENDREPLY | SENDLISTREPLY, NULL, NULL, extra->ctx, extra->hdr); pager_menu->redraw = REDRAW_FULL; @@ -2681,8 +2678,8 @@ search_next: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); CHECK_ATTACH; if (IsMsgAttach (extra)) - mutt_attach_forward (extra->fp, extra->hdr, extra->idx, - extra->idxlen, extra->bdy); + mutt_attach_forward (extra->fp, extra->hdr, extra->actx, + extra->bdy); else ci_send_message (SENDFORWARD, NULL, NULL, extra->ctx, extra->hdr); pager_menu->redraw = REDRAW_FULL; @@ -42,8 +42,7 @@ typedef struct HEADER *hdr; /* current message */ BODY *bdy; /* current attachment */ FILE *fp; /* source stream */ - ATTACHPTR **idx; /* attachment information */ - short idxlen; + ATTACH_CONTEXT *actx; /* attachment information */ } pager_t; int mutt_do_pager (const char *, const char *, int, pager_t *); diff --git a/recvattach.c b/recvattach.c index 2e09d844..120f6bf4 100644 --- a/recvattach.c +++ b/recvattach.c @@ -839,7 +839,7 @@ mutt_attach_display_loop (MUTTMENU *menu, int op, FILE *fp, HEADER *hdr, case OP_VIEW_ATTACH: op = mutt_view_attachment (fp, actx->idx[menu->current]->content, MUTT_REGULAR, - hdr, actx->idx, actx->idxlen); + hdr, actx); break; case OP_NEXT_ENTRY: @@ -1037,13 +1037,13 @@ void mutt_view_attachments (HEADER *hdr) { case OP_ATTACH_VIEW_MAILCAP: mutt_view_attachment (fp, actx->idx[menu->current]->content, MUTT_MAILCAP, - hdr, actx->idx, actx->idxlen); + hdr, actx); menu->redraw = REDRAW_FULL; break; case OP_ATTACH_VIEW_TEXT: mutt_view_attachment (fp, actx->idx[menu->current]->content, MUTT_AS_TEXT, - hdr, actx->idx, actx->idxlen); + hdr, actx); menu->redraw = REDRAW_FULL; break; @@ -1201,21 +1201,21 @@ void mutt_view_attachments (HEADER *hdr) case OP_RESEND: CHECK_ATTACH; - mutt_attach_resend (fp, hdr, actx->idx, actx->idxlen, + mutt_attach_resend (fp, hdr, actx, menu->tagprefix ? NULL : actx->idx[menu->current]->content); menu->redraw = REDRAW_FULL; break; case OP_BOUNCE_MESSAGE: CHECK_ATTACH; - mutt_attach_bounce (fp, hdr, actx->idx, actx->idxlen, + mutt_attach_bounce (fp, hdr, actx, menu->tagprefix ? NULL : actx->idx[menu->current]->content); menu->redraw = REDRAW_FULL; break; case OP_FORWARD_MESSAGE: CHECK_ATTACH; - mutt_attach_forward (fp, hdr, actx->idx, actx->idxlen, + mutt_attach_forward (fp, hdr, actx, menu->tagprefix ? NULL : actx->idx[menu->current]->content); menu->redraw = REDRAW_FULL; break; @@ -1229,7 +1229,7 @@ void mutt_view_attachments (HEADER *hdr) flags = SENDREPLY | (op == OP_GROUP_REPLY ? SENDGROUPREPLY : 0) | (op == OP_LIST_REPLY ? SENDLISTREPLY : 0); - mutt_attach_reply (fp, hdr, actx->idx, actx->idxlen, + mutt_attach_reply (fp, hdr, actx, menu->tagprefix ? NULL : actx->idx[menu->current]->content, flags); menu->redraw = REDRAW_FULL; break; @@ -46,7 +46,7 @@ static short check_msg (BODY * b, short err) return 0; } -static short check_all_msg (ATTACHPTR ** idx, short idxlen, +static short check_all_msg (ATTACH_CONTEXT *actx, BODY * cur, short err) { short i; @@ -55,11 +55,11 @@ static short check_all_msg (ATTACHPTR ** idx, short idxlen, return -1; else if (!cur) { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged) + if (actx->idx[i]->content->tagged) { - if (check_msg (idx[i]->content, err) == -1) + if (check_msg (actx->idx[i]->content, err) == -1) return -1; } } @@ -70,28 +70,27 @@ static short check_all_msg (ATTACHPTR ** idx, short idxlen, /* can we decode all tagged attachments? */ -static short check_can_decode (ATTACHPTR ** idx, short idxlen, - BODY * cur) +static short check_can_decode (ATTACH_CONTEXT *actx, BODY * cur) { short i; if (cur) return mutt_can_decode (cur); - for (i = 0; i < idxlen; i++) - if (idx[i]->content->tagged && !mutt_can_decode (idx[i]->content)) + for (i = 0; i < actx->idxlen; i++) + if (actx->idx[i]->content->tagged && !mutt_can_decode (actx->idx[i]->content)) return 0; return 1; } -static short count_tagged (ATTACHPTR **idx, short idxlen) +static short count_tagged (ATTACH_CONTEXT *actx) { short count = 0; short i; - for (i = 0; i < idxlen; i++) - if (idx[i]->content->tagged) + for (i = 0; i < actx->idxlen; i++) + if (actx->idx[i]->content->tagged) count++; return count; @@ -101,14 +100,13 @@ static short count_tagged (ATTACHPTR **idx, short idxlen) * attachment. */ -static short count_tagged_children (ATTACHPTR ** idx, - short idxlen, short i) +static short count_tagged_children (ATTACH_CONTEXT *actx, short i) { - short level = idx[i]->level; + short level = actx->idx[i]->level; short count = 0; - while ((++i < idxlen) && (level < idx[i]->level)) - if (idx[i]->content->tagged) + while ((++i < actx->idxlen) && (level < actx->idx[i]->level)) + if (actx->idx[i]->content->tagged) count++; return count; @@ -122,8 +120,8 @@ static short count_tagged_children (ATTACHPTR ** idx, ** **/ -void mutt_attach_bounce (FILE * fp, HEADER * hdr, - ATTACHPTR ** idx, short idxlen, BODY * cur) +void mutt_attach_bounce (FILE * fp, HEADER * hdr, + ATTACH_CONTEXT *actx, BODY * cur) { short i; char prompt[STRING]; @@ -133,11 +131,11 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, int ret = 0; int p = 0; - if (check_all_msg (idx, idxlen, cur, 1) == -1) + if (check_all_msg (actx, cur, 1) == -1) return; /* one or more messages? */ - p = (cur || count_tagged (idx, idxlen) == 1); + p = (cur || count_tagged (actx) == 1); /* RfC 5322 mandates a From: header, so warn before bouncing * messages without one */ @@ -152,11 +150,11 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, } else { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged) + if (actx->idx[i]->content->tagged) { - if (!idx[i]->content->hdr->env->from) + if (!actx->idx[i]->content->hdr->env->from) { mutt_error _("Warning: message contains no From: header"); mutt_sleep (2); @@ -227,10 +225,10 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, ret = mutt_bounce_message (fp, cur->hdr, adr); else { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged) - if (mutt_bounce_message (fp, idx[i]->content->hdr, adr)) + if (actx->idx[i]->content->tagged) + if (mutt_bounce_message (fp, actx->idx[i]->content->hdr, adr)) ret = 1; } } @@ -250,21 +248,21 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, ** **/ -void mutt_attach_resend (FILE * fp, HEADER * hdr, ATTACHPTR ** idx, - short idxlen, BODY * cur) +void mutt_attach_resend (FILE * fp, HEADER * hdr, ATTACH_CONTEXT *actx, + BODY * cur) { short i; - if (check_all_msg (idx, idxlen, cur, 1) == -1) + if (check_all_msg (actx, cur, 1) == -1) return; if (cur) mutt_resend_message (fp, Context, cur->hdr); else { - for (i = 0; i < idxlen; i++) - if (idx[i]->content->tagged) - mutt_resend_message (fp, Context, idx[i]->content->hdr); + for (i = 0; i < actx->idxlen; i++) + if (actx->idx[i]->content->tagged) + mutt_resend_message (fp, Context, actx->idx[i]->content->hdr); } } @@ -277,23 +275,22 @@ void mutt_attach_resend (FILE * fp, HEADER * hdr, ATTACHPTR ** idx, /* try to find a common parent message for the tagged attachments. */ -static HEADER *find_common_parent (ATTACHPTR ** idx, short idxlen, - short nattach) +static HEADER *find_common_parent (ATTACH_CONTEXT *actx, short nattach) { short i; short nchildren; - for (i = 0; i < idxlen; i++) - if (idx[i]->content->tagged) + for (i = 0; i < actx->idxlen; i++) + if (actx->idx[i]->content->tagged) break; while (--i >= 0) { - if (mutt_is_message_type (idx[i]->content->type, idx[i]->content->subtype)) + if (mutt_is_message_type (actx->idx[i]->content->type, actx->idx[i]->content->subtype)) { - nchildren = count_tagged_children (idx, idxlen, i); + nchildren = count_tagged_children (actx, i); if (nchildren == nattach) - return idx[i]->content->hdr; + return actx->idx[i]->content->hdr; } } @@ -308,37 +305,37 @@ static HEADER *find_common_parent (ATTACHPTR ** idx, short idxlen, * bit. For now, it's not worth the effort. */ -static int is_parent (short i, ATTACHPTR **idx, short idxlen, BODY *cur) +static int is_parent (short i, ATTACH_CONTEXT *actx, BODY *cur) { - short level = idx[i]->level; + short level = actx->idx[i]->level; - while ((++i < idxlen) && idx[i]->level > level) + while ((++i < actx->idxlen) && actx->idx[i]->level > level) { - if (idx[i]->content == cur) + if (actx->idx[i]->content == cur) return 1; } return 0; } -static HEADER *find_parent (ATTACHPTR **idx, short idxlen, BODY *cur, short nattach) +static HEADER *find_parent (ATTACH_CONTEXT *actx, BODY *cur, short nattach) { short i; HEADER *parent = NULL; if (cur) { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (mutt_is_message_type (idx[i]->content->type, idx[i]->content->subtype) - && is_parent (i, idx, idxlen, cur)) - parent = idx[i]->content->hdr; - if (idx[i]->content == cur) + if (mutt_is_message_type (actx->idx[i]->content->type, actx->idx[i]->content->subtype) + && is_parent (i, actx, cur)) + parent = actx->idx[i]->content->hdr; + if (actx->idx[i]->content == cur) break; } } else if (nattach) - parent = find_common_parent (idx, idxlen, nattach); + parent = find_common_parent (actx, nattach); return parent; } @@ -374,18 +371,17 @@ static void include_header (int quote, FILE * ifp, static BODY ** copy_problematic_attachments (FILE *fp, BODY **last, - ATTACHPTR **idx, - short idxlen, + ATTACH_CONTEXT *actx, short force) { short i; - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged && - (force || !mutt_can_decode (idx[i]->content))) + if (actx->idx[i]->content->tagged && + (force || !mutt_can_decode (actx->idx[i]->content))) { - if (mutt_copy_body (fp, last, idx[i]->content) == -1) + if (mutt_copy_body (fp, last, actx->idx[i]->content) == -1) return NULL; /* XXXXX - may lead to crashes */ last = &((*last)->next); } @@ -399,7 +395,7 @@ static BODY ** copy_problematic_attachments (FILE *fp, */ static void attach_forward_bodies (FILE * fp, HEADER * hdr, - ATTACHPTR ** idx, short idxlen, + ATTACH_CONTEXT *actx, BODY * cur, short nattach) { @@ -425,7 +421,7 @@ static void attach_forward_bodies (FILE * fp, HEADER * hdr, */ - parent = find_parent (idx, idxlen, cur, nattach); + parent = find_parent (actx, cur, nattach); if (parent == NULL) parent = hdr; @@ -480,7 +476,7 @@ static void attach_forward_bodies (FILE * fp, HEADER * hdr, */ if (!mime_fwd_all && !cur && (nattach > 1) - && !check_can_decode (idx, idxlen, cur)) + && !check_can_decode (actx, cur)) { if ((rc = query_quadoption (OPT_MIMEFWDREST, _("Can't decode all tagged attachments. MIME-forward the others?"))) == -1) @@ -526,18 +522,18 @@ _("Can't decode all tagged attachments. MIME-forward the others?"))) == -1) if (!mime_fwd_all) { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged && mutt_can_decode (idx[i]->content)) + if (actx->idx[i]->content->tagged && mutt_can_decode (actx->idx[i]->content)) { - mutt_body_handler (idx[i]->content, &st); + mutt_body_handler (actx->idx[i]->content, &st); state_putc ('\n', &st); } } } if (mime_fwd_any && - copy_problematic_attachments (fp, last, idx, idxlen, mime_fwd_all) == NULL) + copy_problematic_attachments (fp, last, actx, mime_fwd_all) == NULL) goto bail; } @@ -574,7 +570,7 @@ _("Can't decode all tagged attachments. MIME-forward the others?"))) == -1) */ static void attach_forward_msgs (FILE * fp, HEADER * hdr, - ATTACHPTR ** idx, short idxlen, BODY * cur) + ATTACH_CONTEXT *actx, BODY * cur) { HEADER *curhdr = NULL; HEADER *tmphdr; @@ -592,10 +588,10 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, curhdr = cur->hdr; else { - for (i = 0; i < idxlen; i++) - if (idx[i]->content->tagged) + for (i = 0; i < actx->idxlen; i++) + if (actx->idx[i]->content->tagged) { - curhdr = idx[i]->content->hdr; + curhdr = actx->idx[i]->content->hdr; break; } } @@ -647,15 +643,15 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, } else { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged) + if (actx->idx[i]->content->tagged) { /* mutt_message_hook (idx[i]->content->hdr, MUTT_MESSAGEHOOK); */ - mutt_forward_intro (Context, idx[i]->content->hdr, tmpfp); - _mutt_copy_message (tmpfp, fp, idx[i]->content->hdr, - idx[i]->content->hdr->content, cmflags, chflags); - mutt_forward_trailer (Context, idx[i]->content->hdr, tmpfp); + mutt_forward_intro (Context, actx->idx[i]->content->hdr, tmpfp); + _mutt_copy_message (tmpfp, fp, actx->idx[i]->content->hdr, + actx->idx[i]->content->hdr->content, cmflags, chflags); + mutt_forward_trailer (Context, actx->idx[i]->content->hdr, tmpfp); } } } @@ -668,10 +664,10 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, mutt_copy_body (fp, last, cur); else { - for (i = 0; i < idxlen; i++) - if (idx[i]->content->tagged) + for (i = 0; i < actx->idxlen; i++) + if (actx->idx[i]->content->tagged) { - mutt_copy_body (fp, last, idx[i]->content); + mutt_copy_body (fp, last, actx->idx[i]->content); last = &((*last)->next); } } @@ -685,17 +681,17 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, } void mutt_attach_forward (FILE * fp, HEADER * hdr, - ATTACHPTR ** idx, short idxlen, BODY * cur) + ATTACH_CONTEXT *actx, BODY * cur) { short nattach; - if (check_all_msg (idx, idxlen, cur, 0) == 0) - attach_forward_msgs (fp, hdr, idx, idxlen, cur); + if (check_all_msg (actx, cur, 0) == 0) + attach_forward_msgs (fp, hdr, actx, cur); else { - nattach = count_tagged (idx, idxlen); - attach_forward_bodies (fp, hdr, idx, idxlen, cur, nattach); + nattach = count_tagged (actx); + attach_forward_bodies (fp, hdr, actx, cur, nattach); } } @@ -722,7 +718,7 @@ void mutt_attach_forward (FILE * fp, HEADER * hdr, */ static int -attach_reply_envelope_defaults (ENVELOPE *env, ATTACHPTR **idx, short idxlen, +attach_reply_envelope_defaults (ENVELOPE *env, ATTACH_CONTEXT *actx, HEADER *parent, int flags) { ENVELOPE *curenv = NULL; @@ -731,11 +727,11 @@ attach_reply_envelope_defaults (ENVELOPE *env, ATTACHPTR **idx, short idxlen, if (!parent) { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged) + if (actx->idx[i]->content->tagged) { - curhdr = idx[i]->content->hdr; + curhdr = actx->idx[i]->content->hdr; curenv = curhdr->env; break; } @@ -760,10 +756,10 @@ attach_reply_envelope_defaults (ENVELOPE *env, ATTACHPTR **idx, short idxlen, } else { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged - && mutt_fetch_recips (env, idx[i]->content->hdr->env, flags) == -1) + if (actx->idx[i]->content->tagged + && mutt_fetch_recips (env, actx->idx[i]->content->hdr->env, flags) == -1) return -1; } } @@ -783,10 +779,10 @@ attach_reply_envelope_defaults (ENVELOPE *env, ATTACHPTR **idx, short idxlen, { LIST **p = NULL, **q = NULL; - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged) - mutt_add_to_reference_headers (env, idx[i]->content->hdr->env, &p, &q); + if (actx->idx[i]->content->tagged) + mutt_add_to_reference_headers (env, actx->idx[i]->content->hdr->env, &p, &q); } } @@ -817,8 +813,8 @@ static void attach_include_reply (FILE *fp, FILE *tmpfp, HEADER *cur, int flags) mutt_make_post_indent (Context, cur, tmpfp); } -void mutt_attach_reply (FILE * fp, HEADER * hdr, - ATTACHPTR ** idx, short idxlen, BODY * cur, +void mutt_attach_reply (FILE * fp, HEADER * hdr, + ATTACH_CONTEXT *actx, BODY * cur, int flags) { short mime_reply_any = 0; @@ -835,14 +831,14 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, char prefix[SHORT_STRING]; int rc; - if (check_all_msg (idx, idxlen, cur, 0) == -1) + if (check_all_msg (actx, cur, 0) == -1) { - nattach = count_tagged (idx, idxlen); - if ((parent = find_parent (idx, idxlen, cur, nattach)) == NULL) + nattach = count_tagged (actx); + if ((parent = find_parent (actx, cur, nattach)) == NULL) parent = hdr; } - if (nattach > 1 && !check_can_decode (idx, idxlen, cur)) + if (nattach > 1 && !check_can_decode (actx, cur)) { if ((rc = query_quadoption (OPT_MIMEFWDREST, _("Can't decode all tagged attachments. MIME-encapsulate the others?"))) == -1) @@ -856,7 +852,7 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, tmphdr = mutt_new_header (); tmphdr->env = mutt_new_envelope (); - if (attach_reply_envelope_defaults (tmphdr->env, idx, idxlen, + if (attach_reply_envelope_defaults (tmphdr->env, actx, parent ? parent : (cur ? cur->hdr : NULL), flags) == -1) { mutt_free_header (&tmphdr); @@ -877,10 +873,10 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, attach_include_reply (fp, tmpfp, cur->hdr, flags); else { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged) - attach_include_reply (fp, tmpfp, idx[i]->content->hdr, flags); + if (actx->idx[i]->content->tagged) + attach_include_reply (fp, tmpfp, actx->idx[i]->content->hdr, flags); } } } @@ -919,11 +915,11 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, } else { - for (i = 0; i < idxlen; i++) + for (i = 0; i < actx->idxlen; i++) { - if (idx[i]->content->tagged && mutt_can_decode (idx[i]->content)) + if (actx->idx[i]->content->tagged && mutt_can_decode (actx->idx[i]->content)) { - mutt_body_handler (idx[i]->content, &st); + mutt_body_handler (actx->idx[i]->content, &st); state_putc ('\n', &st); } } @@ -932,7 +928,7 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, mutt_make_post_indent (Context, parent, tmpfp); if (mime_reply_any && !cur && - copy_problematic_attachments (fp, &tmphdr->content, idx, idxlen, 0) == NULL) + copy_problematic_attachments (fp, &tmphdr->content, actx, 0) == NULL) { mutt_free_header (&tmphdr); safe_fclose (&tmpfp); |