{
for (rc = 0; rc < Context->msgcount; rc++)
{
- if (Context->hdrs[rc]->tagged && !Context->hdrs[rc]->env->from)
+ if (message_is_tagged(Context, rc) && !Context->hdrs[rc]->env->from)
{
mutt_error(_("Warning: message contains no From: header"));
mutt_sleep(2);
unset_option(OPT_KEEP_QUIET);
}
else
- { /* handle tagged messages */
-
+ {
+ /* handle tagged messages */
if (WithCrypto && decode)
{
- for (int i = 0; i < Context->vcount; i++)
- if (Context->hdrs[Context->v2r[i]]->tagged)
+ for (int i = 0; i < Context->msgcount; i++)
+ {
+ if (!message_is_tagged(Context, i))
+ continue;
+
+ mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGEHOOK);
+ mutt_parse_mime_message(Context, Context->hdrs[i]);
+ if (Context->hdrs[i]->security & ENCRYPT &&
+ !crypt_valid_passphrase(Context->hdrs[i]->security))
{
- mutt_message_hook(Context, Context->hdrs[Context->v2r[i]], MUTT_MESSAGEHOOK);
- mutt_parse_mime_message(Context, Context->hdrs[Context->v2r[i]]);
- if (Context->hdrs[Context->v2r[i]]->security & ENCRYPT &&
- !crypt_valid_passphrase(Context->hdrs[Context->v2r[i]]->security))
- return 1;
+ return 1;
}
+ }
}
if (split)
{
- for (int i = 0; i < Context->vcount; i++)
+ for (int i = 0; i < Context->msgcount; i++)
{
- if (Context->hdrs[Context->v2r[i]]->tagged)
+ if (!message_is_tagged(Context, i))
+ continue;
+
+ mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGEHOOK);
+ mutt_endwin(NULL);
+ thepid = mutt_create_filter(cmd, &fpout, NULL, NULL);
+ if (thepid < 0)
{
- mutt_message_hook(Context, Context->hdrs[Context->v2r[i]], MUTT_MESSAGEHOOK);
- mutt_endwin(NULL);
- thepid = mutt_create_filter(cmd, &fpout, NULL, NULL);
- if (thepid < 0)
- {
- mutt_perror(_("Can't create filter process"));
- return 1;
- }
- set_option(OPT_KEEP_QUIET);
- pipe_msg(Context->hdrs[Context->v2r[i]], fpout, decode, print);
- /* add the message separator */
- if (sep)
- fputs(sep, fpout);
- safe_fclose(&fpout);
- if (mutt_wait_filter(thepid) != 0)
- rc = 1;
- unset_option(OPT_KEEP_QUIET);
+ mutt_perror(_("Can't create filter process"));
+ return 1;
}
+ set_option(OPT_KEEP_QUIET);
+ pipe_msg(Context->hdrs[i], fpout, decode, print);
+ /* add the message separator */
+ if (sep)
+ fputs(sep, fpout);
+ safe_fclose(&fpout);
+ if (mutt_wait_filter(thepid) != 0)
+ rc = 1;
+ unset_option(OPT_KEEP_QUIET);
}
}
else
return 1;
}
set_option(OPT_KEEP_QUIET);
- for (int i = 0; i < Context->vcount; i++)
+ for (int i = 0; i < Context->msgcount; i++)
{
- if (Context->hdrs[Context->v2r[i]]->tagged)
- {
- mutt_message_hook(Context, Context->hdrs[Context->v2r[i]], MUTT_MESSAGEHOOK);
- pipe_msg(Context->hdrs[Context->v2r[i]], fpout, decode, print);
- /* add the message separator */
- if (sep)
- fputs(sep, fpout);
- }
+ if (!message_is_tagged(Context, i))
+ continue;
+
+ mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGEHOOK);
+ pipe_msg(Context->hdrs[i], fpout, decode, print);
+ /* add the message separator */
+ if (sep)
+ fputs(sep, fpout);
}
safe_fclose(&fpout);
if (mutt_wait_filter(thepid) != 0)
else
{
/* look for the first tagged message */
-
- for (int i = 0; i < Context->vcount; i++)
+ for (int i = 0; i < Context->msgcount; i++)
{
- if (Context->hdrs[Context->v2r[i]]->tagged)
+ if (message_is_tagged(Context, i))
{
- h = Context->hdrs[Context->v2r[i]];
+ h = Context->hdrs[i];
break;
}
}
if (Context->magic == MUTT_NOTMUCH)
nm_longrun_init(Context, true);
#endif
- for (int i = 0; i < Context->vcount; i++)
+ for (int i = 0; i < Context->msgcount; i++)
{
- if (Context->hdrs[Context->v2r[i]]->tagged)
- {
- mutt_message_hook(Context, Context->hdrs[Context->v2r[i]], MUTT_MESSAGEHOOK);
- if ((rc = _mutt_save_message(Context->hdrs[Context->v2r[i]], &ctx,
- delete, decode, decrypt) != 0))
- break;
+ if (!message_is_tagged(Context, i))
+ continue;
+
+ mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGEHOOK);
+ if ((rc = _mutt_save_message(Context->hdrs[i], &ctx, delete, decode, decrypt) != 0))
+ break;
#ifdef USE_COMPRESSED
- if (cm)
- {
- struct Header *h2 = Context->hdrs[Context->v2r[i]];
- cm->msg_count++;
- if (!h2->read)
- cm->msg_unread++;
- if (h2->flagged)
- cm->msg_flagged++;
- }
-#endif
+ if (cm)
+ {
+ struct Header *h2 = Context->hdrs[i];
+ cm->msg_count++;
+ if (!h2->read)
+ cm->msg_unread++;
+ if (h2->flagged)
+ cm->msg_flagged++;
}
+#endif
}
#ifdef USE_NOTMUCH
if (Context->magic == MUTT_NOTMUCH)
rv = _mutt_check_traditional_pgp(h, redraw);
else
{
- for (int i = 0; i < Context->vcount; i++)
- if (Context->hdrs[Context->v2r[i]]->tagged &&
- !(Context->hdrs[Context->v2r[i]]->security & PGP_TRADITIONAL_CHECKED))
+ for (int i = 0; i < Context->msgcount; i++)
+ {
+ if (message_is_tagged(Context, i) && !(Context->hdrs[i]->security & PGP_TRADITIONAL_CHECKED))
{
- rv = _mutt_check_traditional_pgp(Context->hdrs[Context->v2r[i]], redraw) || rv;
+ rv = _mutt_check_traditional_pgp(Context->hdrs[i], redraw) || rv;
}
+ }
}
return rv;
}
#endif
{
char *prompt = NULL;
- struct Header *h = NULL;
fname[0] = 0;
prompt = _("Open mailbox to attach message from");
for (i = 0; i < Context->msgcount; i++)
{
- h = Context->hdrs[i];
- if (h->tagged)
+ if (!message_is_tagged(Context, i))
+ continue;
+
+ new = (struct AttachPtr *) safe_calloc(1, sizeof(struct AttachPtr));
+ new->content = mutt_make_message_attach(Context, Context->hdrs[i], 1);
+ if (new->content != NULL)
+ update_idx(menu, actx, new);
+ else
{
- new = (struct AttachPtr *) safe_calloc(1, sizeof(struct AttachPtr));
- new->content = mutt_make_message_attach(Context, h, 1);
- if (new->content)
- update_idx(menu, actx, new);
- else
- {
- mutt_error(_("Unable to attach!"));
- FREE(&new);
- }
+ mutt_error(_("Unable to attach!"));
+ FREE(&new);
}
}
menu->redraw |= REDRAW_FULL;
#include <wchar.h>
#include "lib/lib.h"
#include "mutt.h"
+#include "context.h"
#include "enter_state.h"
#include "globals.h"
+#include "header.h"
#include "mbyte.h"
#include "mutt_curses.h"
#include "mutt_menu.h"
}
return w;
}
+
+/**
+ * message_is_visible - Is a message in the index within limit
+ * @param ctx Open mailbox
+ * @param index Message ID (index into `ctx->hdrs[]`
+ * @retval bool True if the message is within limit
+ *
+ * If no limit is in effect, all the messages are visible.
+ */
+bool message_is_visible(struct Context *ctx, int index)
+{
+ if (!ctx || !ctx->hdrs || (index >= ctx->msgcount))
+ return false;
+
+ return !ctx->pattern || ctx->hdrs[index]->limited;
+}
+
+/**
+ * message_is_tagged - Is a message in the index tagged (and within limit)
+ * @param ctx Open mailbox
+ * @param index Message ID (index into `ctx->hdrs[]`
+ * @retval bool True if the message is both tagged and within limit
+ *
+ * If a limit is in effect, the message must be visible within it.
+ */
+bool message_is_tagged(struct Context *ctx, int index)
+{
+ return message_is_visible(ctx, index) && ctx->hdrs[index]->tagged;
+}
CHECK_VISIBLE;
if (tag && !option(OPT_AUTO_TAG))
{
- for (j = 0; j < Context->vcount; j++)
- mutt_set_flag(Context, Context->hdrs[Context->v2r[j]], MUTT_TAG, 0);
+ for (j = 0; j < Context->msgcount; j++)
+ if (message_is_visible(Context, j))
+ mutt_set_flag(Context, Context->hdrs[j], MUTT_TAG, 0);
menu->redraw |= REDRAW_STATUS | REDRAW_INDEX;
}
else
CHECK_VISIBLE;
if (tag)
{
- for (j = 0; j < Context->vcount; j++)
+ for (j = 0; j < Context->msgcount; j++)
{
- if (Context->hdrs[Context->v2r[j]]->tagged)
+ if (message_is_tagged(Context, j))
{
- Context->hdrs[Context->v2r[j]]->quasi_deleted = true;
+ Context->hdrs[j]->quasi_deleted = true;
Context->changed = true;
}
}
if (Context->magic == MUTT_NOTMUCH)
nm_longrun_init(Context, true);
#endif
- for (px = 0, j = 0; j < Context->vcount; j++)
+ for (px = 0, j = 0; j < Context->msgcount; j++)
{
- if (Context->hdrs[Context->v2r[j]]->tagged)
+ if (!message_is_tagged(Context, j))
+ continue;
+
+ if (!Context->quiet)
+ mutt_progress_update(&progress, ++px, -1);
+ mx_tags_commit(Context, Context->hdrs[j], buf);
+ if (op == OP_MAIN_MODIFY_TAGS_THEN_HIDE)
{
- if (!Context->quiet)
- mutt_progress_update(&progress, ++px, -1);
- mx_tags_commit(Context, Context->hdrs[Context->v2r[j]], buf);
- if (op == OP_MAIN_MODIFY_TAGS_THEN_HIDE)
- {
- bool still_queried = false;
+ bool still_queried = false;
#ifdef USE_NOTMUCH
- if (Context->magic == MUTT_NOTMUCH)
- still_queried = nm_message_is_still_queried(
- Context, Context->hdrs[Context->v2r[j]]);
+ if (Context->magic == MUTT_NOTMUCH)
+ still_queried = nm_message_is_still_queried(Context, Context->hdrs[j]);
#endif
- Context->hdrs[Context->v2r[j]]->quasi_deleted = !still_queried;
- Context->changed = true;
- }
+ Context->hdrs[j]->quasi_deleted = !still_queried;
+ Context->changed = true;
}
}
#ifdef USE_NOTMUCH
if (tag)
{
- for (j = 0; j < Context->vcount; j++)
+ for (j = 0; j < Context->msgcount; j++)
{
- if (Context->hdrs[Context->v2r[j]]->tagged)
- mutt_set_flag(Context, Context->hdrs[Context->v2r[j]], MUTT_FLAG,
- !Context->hdrs[Context->v2r[j]]->flagged);
+ if (message_is_tagged(Context, j))
+ mutt_set_flag(Context, Context->hdrs[j], MUTT_FLAG,
+ !Context->hdrs[j]->flagged);
}
menu->redraw |= REDRAW_INDEX;
if (tag)
{
- for (j = 0; j < Context->vcount; j++)
+ for (j = 0; j < Context->msgcount; j++)
{
- if (Context->hdrs[Context->v2r[j]]->tagged)
- {
- if (Context->hdrs[Context->v2r[j]]->read ||
- Context->hdrs[Context->v2r[j]]->old)
- mutt_set_flag(Context, Context->hdrs[Context->v2r[j]], MUTT_NEW, 1);
- else
- mutt_set_flag(Context, Context->hdrs[Context->v2r[j]], MUTT_READ, 1);
- }
+ if (!message_is_tagged(Context, j))
+ continue;
+
+ if (Context->hdrs[j]->read || Context->hdrs[j]->old)
+ mutt_set_flag(Context, Context->hdrs[j], MUTT_NEW, 1);
+ else
+ mutt_set_flag(Context, Context->hdrs[j], MUTT_READ, 1);
}
menu->redraw |= REDRAW_STATUS | REDRAW_INDEX;
}
if (tag)
{
- for (j = 0; j < Context->vcount; j++)
+ for (j = 0; j < Context->msgcount; j++)
{
- if (Context->hdrs[Context->v2r[j]]->tagged)
- mutt_resend_message(NULL, Context, Context->hdrs[Context->v2r[j]]);
+ if (message_is_tagged(Context, j))
+ mutt_resend_message(NULL, Context, Context->hdrs[j]);
}
}
else
if (hdr)
return edit_one_message(ctx, hdr);
- for (int i = 0; i < ctx->vcount; i++)
+ for (int i = 0; i < ctx->msgcount; i++)
{
- int j = ctx->v2r[i];
- if (ctx->hdrs[j]->tagged)
- {
- if (edit_one_message(ctx, ctx->hdrs[j]) == -1)
- return -1;
- }
+ if (!message_is_tagged(ctx, i))
+ continue;
+
+ if (edit_one_message(ctx, ctx->hdrs[i]) == -1)
+ return -1;
}
return 0;
*/
void mutt_tag_set_flag(int flag, int bf)
{
- for (int i = 0; i < Context->vcount; i++)
- if (Context->hdrs[Context->v2r[i]]->tagged)
- mutt_set_flag(Context, Context->hdrs[Context->v2r[i]], flag, bf);
+ for (int i = 0; i < Context->msgcount; i++)
+ if (message_is_tagged(Context, i))
+ mutt_set_flag(Context, Context->hdrs[i], flag, bf);
}
int mutt_thread_set_flag(struct Header *hdr, int flag, int bf, int subthread)
}
else
{
-#define HDR_OF(index) Context->hdrs[Context->v2r[(index)]]
- for (int i = 0; i < Context->vcount; ++i)
+ for (int i = 0; i < Context->msgcount; ++i)
{
- if (HDR_OF(i)->tagged)
- if (label_message(Context, HDR_OF(i), new))
- {
- changed++;
- mutt_set_flag(Context, HDR_OF(i), MUTT_TAG, 0);
- /* mutt_set_flag re-evals the header color */
- }
+ if (!message_is_tagged(Context, i))
+ continue;
+
+ struct Header *h = Context->hdrs[i];
+ if (label_message(Context, h, new))
+ {
+ changed++;
+ mutt_set_flag(Context, h, MUTT_TAG, 0);
+ /* mutt_set_flag re-evals the header color */
+ }
}
}
* remainder. */
for (int i = 0; i < ctx->msgcount; i++)
{
- if (ctx->hdrs[i]->tagged && ctx->hdrs[i]->attach_del)
+ if (!message_is_tagged(ctx, i))
+ continue;
+
+ if (ctx->hdrs[i]->attach_del)
{
mutt_debug(3, "imap_copy_messages: Message contains attachments to "
"be deleted\n");
return 1;
}
- if (ctx->hdrs[i]->tagged && ctx->hdrs[i]->active && ctx->hdrs[i]->changed)
+ if (ctx->hdrs[i]->active && ctx->hdrs[i]->changed)
{
rc = imap_sync_message_for_copy(idata, ctx->hdrs[i], &sync_cmd, &err_continue);
if (rc < 0)
{
for (int i = 0; i < ctx->msgcount; i++)
{
- if (ctx->hdrs[i]->tagged)
- {
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_DELETE, 1);
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_PURGE, 1);
- if (option(OPT_DELETE_UNTAG))
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_TAG, 0);
- }
+ if (!message_is_tagged(ctx, i))
+ continue;
+
+ mutt_set_flag(ctx, ctx->hdrs[i], MUTT_DELETE, 1);
+ mutt_set_flag(ctx, ctx->hdrs[i], MUTT_PURGE, 1);
+ if (option(OPT_DELETE_UNTAG))
+ mutt_set_flag(ctx, ctx->hdrs[i], MUTT_TAG, 0);
}
}
else
if (!h)
{
- for (int i = 0; i < Context->vcount; i++)
+ for (int i = 0; i < Context->msgcount; i++)
{
- if (Context->hdrs[Context->v2r[i]]->tagged)
+ if (!message_is_tagged(Context, i))
+ continue;
+
+ struct Header *h = Context->hdrs[i];
+
+ mutt_parse_mime_message(Context, h);
+ if (h->security & ENCRYPT && !crypt_valid_passphrase(h->security))
{
- mutt_parse_mime_message(Context, Context->hdrs[Context->v2r[i]]);
- if (Context->hdrs[Context->v2r[i]]->security & ENCRYPT &&
- !crypt_valid_passphrase(Context->hdrs[Context->v2r[i]]->security))
- {
- safe_fclose(&fpout);
- break;
- }
+ safe_fclose(&fpout);
+ break;
+ }
- if ((WithCrypto & APPLICATION_PGP) &&
- (Context->hdrs[Context->v2r[i]]->security & APPLICATION_PGP))
- {
- mutt_copy_message(fpout, Context, Context->hdrs[Context->v2r[i]],
- MUTT_CM_DECODE | MUTT_CM_CHARCONV, 0);
- fflush(fpout);
+ if ((WithCrypto & APPLICATION_PGP) && (h->security & APPLICATION_PGP))
+ {
+ mutt_copy_message(fpout, Context, h, MUTT_CM_DECODE | MUTT_CM_CHARCONV, 0);
+ fflush(fpout);
- mutt_endwin(_("Trying to extract PGP keys...\n"));
- crypt_pgp_invoke_import(tempfname);
- }
+ mutt_endwin(_("Trying to extract PGP keys...\n"));
+ crypt_pgp_invoke_import(tempfname);
+ }
- if ((WithCrypto & APPLICATION_SMIME) &&
- (Context->hdrs[Context->v2r[i]]->security & APPLICATION_SMIME))
+ if ((WithCrypto & APPLICATION_SMIME) && (h->security & APPLICATION_SMIME))
+ {
+ if (h->security & ENCRYPT)
+ mutt_copy_message(fpout, Context, h,
+ MUTT_CM_NOHEADER | MUTT_CM_DECODE_CRYPT | MUTT_CM_DECODE_SMIME,
+ 0);
+ else
+ mutt_copy_message(fpout, Context, h, 0, 0);
+ fflush(fpout);
+
+ if (h->env->from)
+ tmp = mutt_expand_aliases(h->env->from);
+ else if (h->env->sender)
+ tmp = mutt_expand_aliases(h->env->sender);
+ mbox = tmp ? tmp->mailbox : NULL;
+ if (mbox)
{
- if (Context->hdrs[Context->v2r[i]]->security & ENCRYPT)
- mutt_copy_message(fpout, Context, Context->hdrs[Context->v2r[i]],
- MUTT_CM_NOHEADER | MUTT_CM_DECODE_CRYPT | MUTT_CM_DECODE_SMIME,
- 0);
- else
- mutt_copy_message(fpout, Context, Context->hdrs[Context->v2r[i]], 0, 0);
- fflush(fpout);
-
- if (Context->hdrs[Context->v2r[i]]->env->from)
- tmp = mutt_expand_aliases(Context->hdrs[Context->v2r[i]]->env->from);
- else if (Context->hdrs[Context->v2r[i]]->env->sender)
- tmp = mutt_expand_aliases(Context->hdrs[Context->v2r[i]]->env->sender);
- mbox = tmp ? tmp->mailbox : NULL;
- if (mbox)
- {
- mutt_endwin(_("Trying to extract S/MIME certificates...\n"));
- crypt_smime_invoke_import(tempfname, mbox);
- tmp = NULL;
- }
+ mutt_endwin(_("Trying to extract S/MIME certificates...\n"));
+ crypt_smime_invoke_import(tempfname, mbox);
+ tmp = NULL;
}
-
- rewind(fpout);
}
+
+ rewind(fpout);
}
}
else
int wcscasecmp(const wchar_t *a, const wchar_t *b);
#endif
+bool message_is_tagged(struct Context *ctx, int index);
+bool message_is_visible(struct Context *ctx, int index);
+
#endif /* _MUTT_PROTOS_H */
if (!curenv)
{
- struct Header *h = NULL;
- for (int i = 0; i < ctx->vcount; i++)
+ for (int i = 0; i < ctx->msgcount; i++)
{
- h = ctx->hdrs[ctx->v2r[i]];
- if (h->tagged)
- mutt_add_to_reference_headers(env, h->env);
+ if (message_is_tagged(ctx, i))
+ mutt_add_to_reference_headers(env, ctx->hdrs[i]->env);
}
}
else
if (!cur)
{
tag = true;
- for (int i = 0; i < ctx->vcount; i++)
- if (ctx->hdrs[ctx->v2r[i]]->tagged)
- {
- cur = ctx->hdrs[ctx->v2r[i]];
- curenv = cur->env;
- break;
- }
+ for (int i = 0; i < ctx->msgcount; i++)
+ {
+ if (!message_is_tagged(ctx, i))
+ continue;
+
+ cur = ctx->hdrs[i];
+ curenv = cur->env;
+ break;
+ }
if (!cur)
{
#endif
if (tag)
{
- struct Header *h = NULL;
-
- for (int i = 0; i < ctx->vcount; i++)
+ for (int i = 0; i < ctx->msgcount; i++)
{
- h = ctx->hdrs[ctx->v2r[i]];
- if (h->tagged && mutt_fetch_recips(env, h->env, flags) == -1)
+ if (!message_is_tagged(ctx, i))
+ continue;
+
+ if (mutt_fetch_recips(env, ctx->hdrs[i]->env, flags) == -1)
return -1;
}
}
struct Context *ctx, struct Header *cur)
{
int i;
- struct Header *h = NULL;
struct Body *tmp = NULL;
if (flags & SENDREPLY)
mutt_message(_("Including quoted message..."));
if (!cur)
{
- for (i = 0; i < ctx->vcount; i++)
+ for (i = 0; i < ctx->msgcount; i++)
{
- h = ctx->hdrs[ctx->v2r[i]];
- if (h->tagged)
+ if (!message_is_tagged(ctx, i))
+ continue;
+
+ if (include_reply(ctx, ctx->hdrs[i], tempfp) == -1)
{
- if (include_reply(ctx, h, tempfp) == -1)
- {
- mutt_error(_("Could not include all requested messages!"));
- return -1;
- }
- fputc('\n', tempfp);
+ mutt_error(_("Could not include all requested messages!"));
+ return -1;
}
+ fputc('\n', tempfp);
}
}
else
}
else
{
- for (i = 0; i < ctx->vcount; i++)
+ for (i = 0; i < ctx->msgcount; i++)
{
- if (ctx->hdrs[ctx->v2r[i]]->tagged)
+ if (!message_is_tagged(ctx, i))
+ continue;
+
+ tmp = mutt_make_message_attach(ctx, ctx->hdrs[i], 0);
+ if (last)
{
- tmp = mutt_make_message_attach(ctx, ctx->hdrs[ctx->v2r[i]], 0);
- if (last)
- {
- last->next = tmp;
- last = tmp;
- }
- else
- last = msg->content = tmp;
+ last->next = tmp;
+ last = tmp;
}
+ else
+ last = msg->content = tmp;
}
}
}
if (cur)
include_forward(ctx, cur, tempfp);
else
- for (i = 0; i < ctx->vcount; i++)
- if (ctx->hdrs[ctx->v2r[i]]->tagged)
- include_forward(ctx, ctx->hdrs[ctx->v2r[i]], tempfp);
+ {
+ for (i = 0; i < ctx->msgcount; i++)
+ {
+ if (message_is_tagged(ctx, i))
+ include_forward(ctx, ctx->hdrs[i], tempfp);
+ }
+ }
}
else if (i == -1)
return -1;
msg->env = mutt_new_envelope();
if (!hdr)
{
- for (int i = 0; i < Context->vcount; i++)
+ for (int i = 0; i < Context->msgcount; i++)
{
- hdr = Context->hdrs[Context->v2r[(i)]];
- if (hdr->tagged)
- rfc822_append(&msg->env->to, hdr->env->from, 0);
+ if (message_is_tagged(Context, i))
+ rfc822_append(&msg->env->to, Context->hdrs[i]->env->from, 0);
}
}
else
mutt_set_flag(ctx, cur, MUTT_REPLIED, is_reply(cur, msg));
else if (!(flags & SENDPOSTPONED) && ctx && ctx->tagged)
{
- for (i = 0; i < ctx->vcount; i++)
- if (ctx->hdrs[ctx->v2r[i]]->tagged)
- mutt_set_flag(ctx, ctx->hdrs[ctx->v2r[i]], MUTT_REPLIED,
- is_reply(ctx->hdrs[ctx->v2r[i]], msg));
+ for (i = 0; i < ctx->msgcount; i++)
+ {
+ if (message_is_tagged(ctx, i))
+ {
+ mutt_set_flag(ctx, ctx->hdrs[i], MUTT_REPLIED, is_reply(ctx->hdrs[i], msg));
+ }
+ }
}
}
{
/* Try to bounce each message out, aborting if we get any failures. */
for (int i = 0; i < Context->msgcount; i++)
- if (Context->hdrs[i]->tagged)
+ if (message_is_tagged(Context, i))
ret |= _mutt_bounce_message(fp, Context->hdrs[i], to, resent_from, env_from);
return ret;
}
if (!last)
{
- for (int i = 0; i < ctx->vcount; i++)
- if (ctx->hdrs[Context->v2r[i]]->tagged)
- changed |= link_threads(cur, ctx->hdrs[Context->v2r[i]], ctx);
+ for (int i = 0; i < ctx->msgcount; i++)
+ if (message_is_tagged(ctx, i))
+ changed |= link_threads(cur, ctx->hdrs[i], ctx);
}
else
changed = link_threads(cur, last, ctx);