mutt_menu_set_redraw_full(MENU_MAIN);
/* force re-caching of index colors */
for (int i = 0; Context && i < Context->mailbox->msg_count; i++)
- Context->hdrs[i]->pair = 0;
+ Context->mailbox->hdrs[i]->pair = 0;
}
return 0;
}
if (is_index)
{
for (int i = 0; Context && i < Context->mailbox->msg_count; i++)
- Context->hdrs[i]->pair = 0;
+ Context->mailbox->hdrs[i]->pair = 0;
}
return 0;
msgcount = 0; // count the precise number of messages.
for (rc = 0; rc < Context->mailbox->msg_count; rc++)
{
- if (message_is_tagged(Context, rc) && !Context->hdrs[rc]->env->from)
+ if (message_is_tagged(Context, rc) && !Context->mailbox->hdrs[rc]->env->from)
{
msgcount++;
- if (!Context->hdrs[rc]->env->from)
+ if (!Context->mailbox->hdrs[rc]->env->from)
{
mutt_error(_("Warning: message contains no From: header"));
break;
if (!message_is_tagged(Context, i))
continue;
- mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGE_HOOK);
- 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->mailbox->hdrs[i], MUTT_MESSAGE_HOOK);
+ mutt_parse_mime_message(Context, Context->mailbox->hdrs[i]);
+ if (Context->mailbox->hdrs[i]->security & ENCRYPT &&
+ !crypt_valid_passphrase(Context->mailbox->hdrs[i]->security))
{
return 1;
}
if (!message_is_tagged(Context, i))
continue;
- mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGE_HOOK);
+ mutt_message_hook(Context, Context->mailbox->hdrs[i], MUTT_MESSAGE_HOOK);
mutt_endwin();
thepid = mutt_create_filter(cmd, &fpout, NULL, NULL);
if (thepid < 0)
return 1;
}
OptKeepQuiet = true;
- pipe_msg(Context->hdrs[i], fpout, decode, print);
+ pipe_msg(Context->mailbox->hdrs[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_MESSAGE_HOOK);
- pipe_msg(Context->hdrs[i], fpout, decode, print);
+ mutt_message_hook(Context, Context->mailbox->hdrs[i], MUTT_MESSAGE_HOOK);
+ pipe_msg(Context->mailbox->hdrs[i], fpout, decode, print);
/* add the message separator */
if (sep)
fputs(sep, fpout);
{
if (message_is_tagged(Context, i))
{
- h = Context->hdrs[i];
+ h = Context->mailbox->hdrs[i];
break;
}
}
if (!message_is_tagged(Context, i))
continue;
- mutt_message_hook(Context, Context->hdrs[i], MUTT_MESSAGE_HOOK);
- rc = mutt_save_message_ctx(Context->hdrs[i], delete, decode, decrypt, savectx);
+ mutt_message_hook(Context, Context->mailbox->hdrs[i], MUTT_MESSAGE_HOOK);
+ rc = mutt_save_message_ctx(Context->mailbox->hdrs[i], delete, decode, decrypt, savectx);
if (rc != 0)
break;
#ifdef USE_COMPRESSED
if (cm)
{
- struct Header *h2 = Context->hdrs[i];
+ struct Header *h2 = Context->mailbox->hdrs[i];
cm->msg_count++;
if (!h2->read)
cm->msg_unread++;
{
for (int i = 0; i < Context->mailbox->msg_count; i++)
{
- if (message_is_tagged(Context, i) && !(Context->hdrs[i]->security & PGP_TRADITIONAL_CHECKED))
+ if (message_is_tagged(Context, i) &&
+ !(Context->mailbox->hdrs[i]->security & PGP_TRADITIONAL_CHECKED))
{
- rc = check_traditional_pgp(Context->hdrs[i], redraw) || rc;
+ rc = check_traditional_pgp(Context->mailbox->hdrs[i], redraw) || rc;
}
}
}
continue;
new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
- new->content = mutt_make_message_attach(Context, Context->hdrs[i], true);
+ new->content =
+ mutt_make_message_attach(Context, Context->mailbox->hdrs[i], true);
if (new->content)
update_idx(menu, actx, new);
else
off_t vsize;
char *pattern; /**< limit pattern string */
struct Pattern *limit_pattern; /**< compiled limit pattern */
- struct Header **hdrs;
struct Header *last_tag; /**< last tagged msg. used to link threads */
struct MuttThread *tree; /**< top of thread tree */
struct Hash *id_hash; /**< hash table by msg id */
struct Hash *thread_hash; /**< hash table for threading */
struct Hash *label_hash; /**< hash table for x-labels */
int *v2r; /**< mapping from virtual to real msgno */
- int hdrmax; /**< number of pointers in hdrs */
int vcount; /**< the number of virtual messages */
int tagged; /**< how many messages are tagged? */
int new; /**< how many new messages? */
*/
bool message_is_visible(struct Context *ctx, int index)
{
- if (!ctx || !ctx->hdrs || (index >= ctx->mailbox->msg_count))
+ if (!ctx || !ctx->mailbox->hdrs || (index >= ctx->mailbox->msg_count))
return false;
- return !ctx->pattern || ctx->hdrs[index]->limited;
+ return !ctx->pattern || ctx->mailbox->hdrs[index]->limited;
}
/**
*/
bool message_is_tagged(struct Context *ctx, int index)
{
- return message_is_visible(ctx, index) && ctx->hdrs[index]->tagged;
+ return message_is_visible(ctx, index) && ctx->mailbox->hdrs[index]->tagged;
}
break; \
}
-#define CURHDR Context->hdrs[Context->v2r[menu->current]]
+#define CURHDR Context->mailbox->hdrs[Context->v2r[menu->current]]
#define UNREAD(h) mutt_thread_contains_unread(Context, h)
#define FLAGGED(h) mutt_thread_contains_flagged(Context, h)
else
final = CURHDR->virtual;
- base = Context->hdrs[Context->v2r[final]];
+ base = Context->mailbox->hdrs[Context->v2r[final]];
/* Iterate all threads, perform collapse/uncollapse as needed */
top = Context->tree;
mutt_set_virtual(Context);
for (int j = 0; j < Context->vcount; j++)
{
- if (Context->hdrs[Context->v2r[j]]->index == base->index)
+ if (Context->mailbox->hdrs[Context->v2r[j]]->index == base->index)
{
menu->current = j;
break;
static int ci_next_undeleted(int msgno)
{
for (int i = msgno + 1; i < Context->vcount; i++)
- if (!Context->hdrs[Context->v2r[i]]->deleted)
+ if (!Context->mailbox->hdrs[Context->v2r[i]]->deleted)
return i;
return -1;
}
static int ci_previous_undeleted(int msgno)
{
for (int i = msgno - 1; i >= 0; i--)
- if (!Context->hdrs[Context->v2r[i]]->deleted)
+ if (!Context->mailbox->hdrs[Context->v2r[i]]->deleted)
return i;
return -1;
}
int old = -1;
for (int i = 0; i < Context->vcount; i++)
{
- if (!Context->hdrs[Context->v2r[i]]->read && !Context->hdrs[Context->v2r[i]]->deleted)
+ if (!Context->mailbox->hdrs[Context->v2r[i]]->read &&
+ !Context->mailbox->hdrs[Context->v2r[i]]->deleted)
{
- if (!Context->hdrs[Context->v2r[i]]->old)
+ if (!Context->mailbox->hdrs[Context->v2r[i]]->old)
return i;
else if (old == -1)
old = i;
for (int i = 0; i < Context->vcount; i++)
{
- if (Context->hdrs[Context->v2r[i]] == current)
+ if (Context->mailbox->hdrs[Context->v2r[i]] == current)
{
menu->current = i;
break;
{
save_new = mutt_mem_malloc(sizeof(struct Header *) * (ctx->mailbox->msg_count - oldcount));
for (int i = oldcount; i < ctx->mailbox->msg_count; i++)
- save_new[i - oldcount] = ctx->hdrs[i];
+ save_new[i - oldcount] = ctx->mailbox->hdrs[i];
}
/* Sort first to thread the new messages, because some patterns
if ((check != MUTT_REOPENED) && oldcount)
h = save_new[i - oldcount];
else
- h = ctx->hdrs[i];
+ h = ctx->mailbox->hdrs[i];
if (mutt_pattern_exec(ctx->limit_pattern, MUTT_MATCH_FULL_ADDRESS, ctx, h, NULL))
{
}
if (mutt_pattern_exec(ctx->limit_pattern, MUTT_MATCH_FULL_ADDRESS, ctx,
- ctx->hdrs[i], NULL))
+ ctx->mailbox->hdrs[i], NULL))
{
assert(ctx->vcount < ctx->mailbox->msg_count);
- ctx->hdrs[i]->virtual = ctx->vcount;
+ ctx->mailbox->hdrs[i]->virtual = ctx->vcount;
ctx->v2r[ctx->vcount] = i;
- ctx->hdrs[i]->limited = true;
+ ctx->mailbox->hdrs[i]->limited = true;
ctx->vcount++;
- struct Body *b = ctx->hdrs[i]->content;
+ struct Body *b = ctx->mailbox->hdrs[i]->content;
ctx->vsize += b->length + b->offset - b->hdr_offset + padding;
}
}
/* restore the current message to the message it was pointing to */
for (int i = 0; i < ctx->vcount; i++)
{
- if (ctx->hdrs[ctx->v2r[i]]->index == menu->oldcurrent)
+ if (ctx->mailbox->hdrs[ctx->v2r[i]]->index == menu->oldcurrent)
{
menu->current = i;
break;
*/
void index_make_entry(char *buf, size_t buflen, struct Menu *menu, int num)
{
- if (!Context || !menu || (num < 0) || (num >= Context->hdrmax))
+ if (!Context || !menu || (num < 0) || (num >= Context->mailbox->hdrmax))
return;
- struct Header *h = Context->hdrs[Context->v2r[num]];
+ struct Header *h = Context->mailbox->hdrs[Context->v2r[num]];
if (!h)
return;
if (!Context || (index_no < 0))
return 0;
- struct Header *h = Context->hdrs[Context->v2r[index_no]];
+ struct Header *h = Context->mailbox->hdrs[Context->v2r[index_no]];
if (h && h->pair)
return h->pair;
}
#endif
- if (Context && Context->hdrs && !(menu->current >= Context->vcount))
+ if (Context && Context->mailbox->hdrs && !(menu->current >= Context->vcount))
{
menu_check_recenter(menu);
{
for (i = oldcount; i < Context->mailbox->msg_count; i++)
{
- if (!Context->hdrs[i]->read)
+ if (!Context->mailbox->hdrs[i]->read)
{
mutt_message(_("New mail in this mailbox"));
if (BeepNew)
rc2 = nntp_check_msgid(Context, buf);
if (rc2 == 0)
{
- hdr = Context->hdrs[Context->mailbox->msg_count - 1];
+ hdr = Context->mailbox->hdrs[Context->mailbox->msg_count - 1];
mutt_sort_headers(Context, false);
menu->current = hdr->virtual;
menu->redraw = REDRAW_FULL;
{
for (int k = 0; k < Context->mailbox->msg_count; k++)
{
- if (Context->hdrs[k]->index == oldindex)
+ if (Context->mailbox->hdrs[k]->index == oldindex)
{
- menu->current = Context->hdrs[k]->virtual;
+ menu->current = Context->mailbox->hdrs[k]->virtual;
/* as an added courtesy, recenter the menu
* with the current entry at the middle of the screen */
menu_check_recenter(menu);
mutt_error(_("That message is not visible"));
else
{
- struct Header *hdr = Context->hdrs[i - 1];
+ struct Header *hdr = Context->mailbox->hdrs[i - 1];
if (mutt_messages_in_thread(Context, hdr, 1) != 1)
{
menu->current = -1;
for (i = 0; i < Context->vcount; i++)
{
- if (Context->hdrs[Context->v2r[i]]->index == menu->oldcurrent)
+ if (Context->mailbox->hdrs[Context->v2r[i]]->index == menu->oldcurrent)
{
menu->current = i;
break;
{
for (j = 0; j < Context->mailbox->msg_count; j++)
if (message_is_visible(Context, j))
- mutt_set_flag(Context, Context->hdrs[j], MUTT_TAG, 0);
+ mutt_set_flag(Context, Context->mailbox->hdrs[j], MUTT_TAG, 0);
menu->redraw |= REDRAW_STATUS | REDRAW_INDEX;
}
else
if (newidx < 0)
newidx = ci_previous_undeleted(menu->current);
if (newidx >= 0)
- newhdr = Context->hdrs[Context->v2r[newidx]];
+ newhdr = Context->mailbox->hdrs[Context->v2r[newidx]];
}
check = mx_mbox_sync(Context, &index_hint);
{
for (j = 0; j < Context->vcount; j++)
{
- if (Context->hdrs[Context->v2r[j]] == newhdr)
+ if (Context->mailbox->hdrs[Context->v2r[j]] == newhdr)
{
menu->current = j;
break;
{
if (message_is_tagged(Context, j))
{
- Context->hdrs[j]->quasi_deleted = true;
+ Context->mailbox->hdrs[j]->quasi_deleted = true;
Context->changed = true;
}
}
if (!Context->quiet)
mutt_progress_update(&progress, ++px, -1);
- mx_tags_commit(Context, Context->hdrs[j], buf);
+ mx_tags_commit(Context, Context->mailbox->hdrs[j], buf);
if (op == OP_MAIN_MODIFY_TAGS_THEN_HIDE)
{
bool still_queried = false;
#ifdef USE_NOTMUCH
if (Context->mailbox->magic == MUTT_NOTMUCH)
- still_queried = nm_message_is_still_queried(Context, Context->hdrs[j]);
+ still_queried =
+ nm_message_is_still_queried(Context, Context->mailbox->hdrs[j]);
#endif
- Context->hdrs[j]->quasi_deleted = !still_queried;
+ Context->mailbox->hdrs[j]->quasi_deleted = !still_queried;
Context->changed = true;
}
}
{
mutt_check_traditional_pgp(tag ? NULL : CURHDR, &menu->redraw);
}
- int hint = Context->hdrs[Context->v2r[menu->current]]->index;
+ int hint = Context->mailbox->hdrs[Context->v2r[menu->current]]->index;
/* If we are returning to the pager via an index menu redirection, we
* need to reset the menu->menu. Otherwise mutt_menu_pop_current() will
}
}
- struct Header *h = Context->hdrs[Context->v2r[i]];
+ struct Header *h = Context->mailbox->hdrs[Context->v2r[i]];
if (h->collapsed && (Sort & SORT_MASK) == SORT_THREADS)
{
if (UNREAD(h) && first_unread == -1)
{
if (message_is_tagged(Context, j))
{
- mutt_set_flag(Context, Context->hdrs[j], MUTT_FLAG,
- !Context->hdrs[j]->flagged);
+ mutt_set_flag(Context, Context->mailbox->hdrs[j], MUTT_FLAG,
+ !Context->mailbox->hdrs[j]->flagged);
}
}
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);
+ if (Context->mailbox->hdrs[j]->read || Context->mailbox->hdrs[j]->old)
+ mutt_set_flag(Context, Context->mailbox->hdrs[j], MUTT_NEW, 1);
else
- mutt_set_flag(Context, Context->hdrs[j], MUTT_READ, 1);
+ mutt_set_flag(Context, Context->mailbox->hdrs[j], MUTT_READ, 1);
}
menu->redraw |= REDRAW_STATUS | REDRAW_INDEX;
}
for (j = 0; j < Context->mailbox->msg_count; j++)
{
if (message_is_tagged(Context, j))
- mutt_resend_message(NULL, Context, Context->hdrs[j]);
+ mutt_resend_message(NULL, Context, Context->mailbox->hdrs[j]);
}
}
else
for (int i = 0; i < Context->mailbox->msg_count; i++)
{
- struct Envelope *e = Context->hdrs[i]->env;
+ struct Envelope *e = Context->mailbox->hdrs[i]->env;
if (!e || !e->subject)
continue;
if (Attribution)
{
setlocale(LC_TIME, NONULL(AttributionLocale));
- mutt_make_string(tmp, sizeof(tmp) - 1, Attribution, Context, Context->hdrs[n]);
+ mutt_make_string(tmp, sizeof(tmp) - 1, Attribution, Context,
+ Context->mailbox->hdrs[n]);
setlocale(LC_TIME, "");
strcat(tmp, "\n");
}
mutt_mem_realloc(&buf, sizeof(char *) * (*bufmax += 25));
buf[(*buflen)++] = mutt_str_strdup(tmp);
- bytes = Context->hdrs[n]->content->length;
+ bytes = Context->mailbox->hdrs[n]->content->length;
if (inc_hdrs)
{
- offset = Context->hdrs[n]->offset;
- bytes += Context->hdrs[n]->content->offset - offset;
+ offset = Context->mailbox->hdrs[n]->offset;
+ bytes += Context->mailbox->hdrs[n]->content->offset - offset;
}
else
- offset = Context->hdrs[n]->content->offset;
+ offset = Context->mailbox->hdrs[n]->content->offset;
buf = be_snarf_data(Context->fp, buf, bufmax, buflen, offset, bytes, pfx);
if (*bufmax == *buflen)
if (!message_is_tagged(ctx, i))
continue;
- if (edit_or_view_one_message(edit, ctx, ctx->hdrs[i]) == -1)
+ if (edit_or_view_one_message(edit, ctx, ctx->mailbox->hdrs[i]) == -1)
return -1;
}
{
for (int i = 0; i < Context->mailbox->msg_count; i++)
if (message_is_tagged(Context, i))
- mutt_set_flag(Context, Context->hdrs[i], flag, bf);
+ mutt_set_flag(Context, Context->mailbox->hdrs[i], flag, bf);
}
/**
unsigned int setstart = 0; /* start of current message range */
int n;
bool started = false;
- struct Header **hdrs = idata->ctx->hdrs;
+ struct Header **hdrs = idata->ctx->mailbox->hdrs;
for (n = *pos; n < idata->ctx->mailbox->msg_count && buf->dptr - buf->data < IMAP_MAX_CMDLEN;
n++)
for (int i = 0; i < idata->ctx->mailbox->msg_count; i++)
{
- h = idata->ctx->hdrs[i];
+ h = idata->ctx->mailbox->hdrs[i];
if (h->index == INT_MAX)
{
oldsort = Sort;
if (Sort != SORT_ORDER)
{
- hdrs = idata->ctx->hdrs;
- idata->ctx->hdrs =
+ hdrs = idata->ctx->mailbox->hdrs;
+ idata->ctx->mailbox->hdrs =
mutt_mem_malloc(idata->ctx->mailbox->msg_count * sizeof(struct Header *));
- memcpy(idata->ctx->hdrs, hdrs, idata->ctx->mailbox->msg_count * sizeof(struct Header *));
+ memcpy(idata->ctx->mailbox->hdrs, hdrs,
+ idata->ctx->mailbox->msg_count * sizeof(struct Header *));
Sort = SORT_ORDER;
- qsort(idata->ctx->hdrs, idata->ctx->mailbox->msg_count,
+ qsort(idata->ctx->mailbox->hdrs, idata->ctx->mailbox->msg_count,
sizeof(struct Header *), mutt_get_sort_func(SORT_ORDER));
}
if (oldsort != Sort)
{
Sort = oldsort;
- FREE(&idata->ctx->hdrs);
- idata->ctx->hdrs = hdrs;
+ FREE(&idata->ctx->mailbox->hdrs);
+ idata->ctx->mailbox->hdrs = hdrs;
}
return rc;
struct Buffer buf;
struct ImapData *idata = ctx->mailbox->data;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
- ctx->hdrs[i]->matched = false;
+ ctx->mailbox->hdrs[i]->matched = false;
if (do_search(pat, 1) == 0)
return 0;
sync_cmd = mutt_buffer_new();
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (ctx->hdrs[i]->active && ctx->hdrs[i]->changed &&
- ctx->hdrs[i]->deleted && !ctx->hdrs[i]->purge)
+ if (ctx->mailbox->hdrs[i]->active && ctx->mailbox->hdrs[i]->changed &&
+ ctx->mailbox->hdrs[i]->deleted && !ctx->mailbox->hdrs[i]->purge)
{
- rc = imap_sync_message_for_copy(idata, ctx->hdrs[i], sync_cmd, &err_continue);
+ rc = imap_sync_message_for_copy(idata, ctx->mailbox->hdrs[i], sync_cmd, &err_continue);
if (rc < 0)
{
mutt_debug(1, "could not sync\n");
ctx->readonly = true;
}
- ctx->hdrmax = count;
- ctx->hdrs = mutt_mem_calloc(count, sizeof(struct Header *));
+ ctx->mailbox->hdrmax = count;
+ ctx->mailbox->hdrs = mutt_mem_calloc(count, sizeof(struct Header *));
ctx->v2r = mutt_mem_calloc(count, sizeof(int));
ctx->mailbox->msg_count = 0;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
/* mailbox may not have fully loaded */
- if (ctx->hdrs[i] && ctx->hdrs[i]->data)
- imap_free_header_data((struct ImapHeaderData **) &(ctx->hdrs[i]->data));
+ if (ctx->mailbox->hdrs[i] && ctx->mailbox->hdrs[i]->data)
+ imap_free_header_data((struct ImapHeaderData **) &(ctx->mailbox->hdrs[i]->data));
}
return 0;
/* mark these messages as unchanged so second pass ignores them. Done
* here so BOGUS UW-IMAP 4.7 SILENT FLAGS updates are ignored. */
for (int i = 0; i < ctx->mailbox->msg_count; i++)
- if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->changed)
- ctx->hdrs[i]->active = false;
+ if (ctx->mailbox->hdrs[i]->deleted && ctx->mailbox->hdrs[i]->changed)
+ ctx->mailbox->hdrs[i]->active = false;
mutt_message(ngettext("Marking %d message deleted...",
"Marking %d messages deleted...", rc),
rc);
/* save messages with real (non-flag) changes */
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- h = ctx->hdrs[i];
+ h = ctx->mailbox->hdrs[i];
if (h->deleted)
{
oldsort = Sort;
if (Sort != SORT_ORDER)
{
- hdrs = ctx->hdrs;
- ctx->hdrs = mutt_mem_malloc(ctx->mailbox->msg_count * sizeof(struct Header *));
- memcpy(ctx->hdrs, hdrs, ctx->mailbox->msg_count * sizeof(struct Header *));
+ hdrs = ctx->mailbox->hdrs;
+ ctx->mailbox->hdrs =
+ mutt_mem_malloc(ctx->mailbox->msg_count * sizeof(struct Header *));
+ memcpy(ctx->mailbox->hdrs, hdrs, ctx->mailbox->msg_count * sizeof(struct Header *));
Sort = SORT_ORDER;
- qsort(ctx->hdrs, ctx->mailbox->msg_count, sizeof(struct Header *),
+ qsort(ctx->mailbox->hdrs, ctx->mailbox->msg_count, sizeof(struct Header *),
mutt_get_sort_func(SORT_ORDER));
}
if (oldsort != Sort)
{
Sort = oldsort;
- FREE(&ctx->hdrs);
- ctx->hdrs = hdrs;
+ FREE(&ctx->mailbox->hdrs);
+ ctx->mailbox->hdrs = hdrs;
}
/* Flush the queued flags if any were changed in sync_helper. */
* there is no need to mutate the hcache after flag-only changes. */
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- HEADER_DATA(ctx->hdrs[i])->deleted = ctx->hdrs[i]->deleted;
- HEADER_DATA(ctx->hdrs[i])->flagged = ctx->hdrs[i]->flagged;
- HEADER_DATA(ctx->hdrs[i])->old = ctx->hdrs[i]->old;
- HEADER_DATA(ctx->hdrs[i])->read = ctx->hdrs[i]->read;
- HEADER_DATA(ctx->hdrs[i])->replied = ctx->hdrs[i]->replied;
- ctx->hdrs[i]->changed = false;
+ HEADER_DATA(ctx->mailbox->hdrs[i])->deleted = ctx->mailbox->hdrs[i]->deleted;
+ HEADER_DATA(ctx->mailbox->hdrs[i])->flagged = ctx->mailbox->hdrs[i]->flagged;
+ HEADER_DATA(ctx->mailbox->hdrs[i])->old = ctx->mailbox->hdrs[i]->old;
+ HEADER_DATA(ctx->mailbox->hdrs[i])->read = ctx->mailbox->hdrs[i]->read;
+ HEADER_DATA(ctx->mailbox->hdrs[i])->replied = ctx->mailbox->hdrs[i]->replied;
+ ctx->mailbox->hdrs[i]->changed = false;
}
ctx->changed = false;
continue;
}
- ctx->hdrs[idx] = imap_hcache_get(idata, h.data->uid);
- if (ctx->hdrs[idx])
+ ctx->mailbox->hdrs[idx] = imap_hcache_get(idata, h.data->uid);
+ if (ctx->mailbox->hdrs[idx])
{
idata->max_msn = MAX(idata->max_msn, h.data->msn);
- idata->msn_index[h.data->msn - 1] = ctx->hdrs[idx];
- mutt_hash_int_insert(idata->uid_hash, h.data->uid, ctx->hdrs[idx]);
+ idata->msn_index[h.data->msn - 1] = ctx->mailbox->hdrs[idx];
+ mutt_hash_int_insert(idata->uid_hash, h.data->uid, ctx->mailbox->hdrs[idx]);
- ctx->hdrs[idx]->index = idx;
+ ctx->mailbox->hdrs[idx]->index = idx;
/* messages which have not been expunged are ACTIVE (borrowed from mh
* folders) */
- ctx->hdrs[idx]->active = true;
- ctx->hdrs[idx]->changed = false;
+ ctx->mailbox->hdrs[idx]->active = true;
+ ctx->mailbox->hdrs[idx]->changed = false;
if (!eval_condstore)
{
- ctx->hdrs[idx]->read = h.data->read;
- ctx->hdrs[idx]->old = h.data->old;
- ctx->hdrs[idx]->deleted = h.data->deleted;
- ctx->hdrs[idx]->flagged = h.data->flagged;
- ctx->hdrs[idx]->replied = h.data->replied;
+ ctx->mailbox->hdrs[idx]->read = h.data->read;
+ ctx->mailbox->hdrs[idx]->old = h.data->old;
+ ctx->mailbox->hdrs[idx]->deleted = h.data->deleted;
+ ctx->mailbox->hdrs[idx]->flagged = h.data->flagged;
+ ctx->mailbox->hdrs[idx]->replied = h.data->replied;
}
else
{
- h.data->read = ctx->hdrs[idx]->read;
- h.data->old = ctx->hdrs[idx]->old;
- h.data->deleted = ctx->hdrs[idx]->deleted;
- h.data->flagged = ctx->hdrs[idx]->flagged;
- h.data->replied = ctx->hdrs[idx]->replied;
+ h.data->read = ctx->mailbox->hdrs[idx]->read;
+ h.data->old = ctx->mailbox->hdrs[idx]->old;
+ h.data->deleted = ctx->mailbox->hdrs[idx]->deleted;
+ h.data->flagged = ctx->mailbox->hdrs[idx]->flagged;
+ h.data->replied = ctx->mailbox->hdrs[idx]->replied;
}
/* ctx->hdrs[msgno]->received is restored from mutt_hcache_restore */
- ctx->hdrs[idx]->data = h.data;
- STAILQ_INIT(&ctx->hdrs[idx]->tags);
- driver_tags_replace(&ctx->hdrs[idx]->tags, mutt_str_strdup(h.data->flags_remote));
+ ctx->mailbox->hdrs[idx]->data = h.data;
+ STAILQ_INIT(&ctx->mailbox->hdrs[idx]->tags);
+ driver_tags_replace(&ctx->mailbox->hdrs[idx]->tags,
+ mutt_str_strdup(h.data->flags_remote));
ctx->mailbox->msg_count++;
- ctx->size += ctx->hdrs[idx]->content->length;
+ ctx->size += ctx->mailbox->hdrs[idx]->content->length;
/* If this is the first time we are fetching, we need to
* store the current state of flags back into the header cache */
if (!eval_condstore && store_flag_updates)
- imap_hcache_put(idata, ctx->hdrs[idx]);
+ imap_hcache_put(idata, ctx->mailbox->hdrs[idx]);
h.data = NULL;
idx++;
idata->max_msn = MAX(idata->max_msn, msn);
idata->msn_index[msn - 1] = h;
- if (ctx->mailbox->msg_count >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
struct ImapHeaderData *ihd = mutt_mem_calloc(1, sizeof(struct ImapHeaderData));
mutt_hash_int_insert(idata->uid_hash, uid, h);
ctx->size += h->content->length;
- ctx->hdrs[ctx->mailbox->msg_count++] = h;
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count++] = h;
msn++;
}
continue;
}
- ctx->hdrs[idx] = mutt_header_new();
+ ctx->mailbox->hdrs[idx] = mutt_header_new();
idata->max_msn = MAX(idata->max_msn, h.data->msn);
- idata->msn_index[h.data->msn - 1] = ctx->hdrs[idx];
- mutt_hash_int_insert(idata->uid_hash, h.data->uid, ctx->hdrs[idx]);
+ idata->msn_index[h.data->msn - 1] = ctx->mailbox->hdrs[idx];
+ mutt_hash_int_insert(idata->uid_hash, h.data->uid, ctx->mailbox->hdrs[idx]);
- ctx->hdrs[idx]->index = idx;
+ ctx->mailbox->hdrs[idx]->index = idx;
/* messages which have not been expunged are ACTIVE (borrowed from mh
* folders) */
- ctx->hdrs[idx]->active = true;
- ctx->hdrs[idx]->changed = false;
- ctx->hdrs[idx]->read = h.data->read;
- ctx->hdrs[idx]->old = h.data->old;
- ctx->hdrs[idx]->deleted = h.data->deleted;
- ctx->hdrs[idx]->flagged = h.data->flagged;
- ctx->hdrs[idx]->replied = h.data->replied;
- ctx->hdrs[idx]->received = h.received;
- ctx->hdrs[idx]->data = (void *) (h.data);
- STAILQ_INIT(&ctx->hdrs[idx]->tags);
- driver_tags_replace(&ctx->hdrs[idx]->tags, mutt_str_strdup(h.data->flags_remote));
+ ctx->mailbox->hdrs[idx]->active = true;
+ ctx->mailbox->hdrs[idx]->changed = false;
+ ctx->mailbox->hdrs[idx]->read = h.data->read;
+ ctx->mailbox->hdrs[idx]->old = h.data->old;
+ ctx->mailbox->hdrs[idx]->deleted = h.data->deleted;
+ ctx->mailbox->hdrs[idx]->flagged = h.data->flagged;
+ ctx->mailbox->hdrs[idx]->replied = h.data->replied;
+ ctx->mailbox->hdrs[idx]->received = h.received;
+ ctx->mailbox->hdrs[idx]->data = (void *) (h.data);
+ STAILQ_INIT(&ctx->mailbox->hdrs[idx]->tags);
+ driver_tags_replace(&ctx->mailbox->hdrs[idx]->tags,
+ mutt_str_strdup(h.data->flags_remote));
if (*maxuid < h.data->uid)
*maxuid = h.data->uid;
rewind(fp);
/* NOTE: if Date: header is missing, mutt_rfc822_read_header depends
* on h.received being set */
- ctx->hdrs[idx]->env = mutt_rfc822_read_header(fp, ctx->hdrs[idx], false, false);
+ ctx->mailbox->hdrs[idx]->env =
+ mutt_rfc822_read_header(fp, ctx->mailbox->hdrs[idx], false, false);
/* content built as a side-effect of mutt_rfc822_read_header */
- ctx->hdrs[idx]->content->length = h.content_length;
+ ctx->mailbox->hdrs[idx]->content->length = h.content_length;
ctx->size += h.content_length;
#ifdef USE_HCACHE
- imap_hcache_put(idata, ctx->hdrs[idx]);
+ imap_hcache_put(idata, ctx->mailbox->hdrs[idx]);
#endif /* USE_HCACHE */
ctx->mailbox->msg_count++;
fetch_msn_end = idata->max_msn;
msn_begin = idata->max_msn + 1;
msn_end = idata->new_mail_count;
- while (msn_end > ctx->hdrmax)
+ while (msn_end > ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
alloc_msn_index(idata, msn_end);
idata->reopen &= ~IMAP_NEWMAIL_PENDING;
struct Context *ctx = idata->ctx;
/* make sure context has room to hold the mailbox */
- while (msn_end > ctx->hdrmax)
+ while (msn_end > ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
alloc_msn_index(idata, msn_end);
imap_alloc_uid_hash(idata, msn_end);
int output_progress;
struct ImapData *idata = ctx->mailbox->data;
- struct Header *h = ctx->hdrs[msgno];
+ struct Header *h = ctx->mailbox->hdrs[msgno];
msg->fp = msg_cache_get(idata, h);
if (msg->fp)
if (!message_is_tagged(ctx, i))
continue;
- if (ctx->hdrs[i]->attach_del)
+ if (ctx->mailbox->hdrs[i]->attach_del)
{
mutt_debug(3, "#2 Message contains attachments to be deleted\n");
return 1;
}
- if (ctx->hdrs[i]->active && ctx->hdrs[i]->changed)
+ if (ctx->mailbox->hdrs[i]->active && ctx->mailbox->hdrs[i]->changed)
{
- rc = imap_sync_message_for_copy(idata, ctx->hdrs[i], &sync_cmd, &err_continue);
+ rc = imap_sync_message_for_copy(idata, ctx->mailbox->hdrs[i],
+ &sync_cmd, &err_continue);
if (rc < 0)
{
mutt_debug(1, "#1 could not sync\n");
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);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_DELETE, 1);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_PURGE, 1);
if (DeleteUntag)
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_TAG, 0);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_TAG, 0);
}
}
else
return;
for (int i = 0; i < Context->mailbox->msg_count; i++)
- Context->hdrs[i]->recip_valid = false;
+ Context->mailbox->hdrs[i]->recip_valid = false;
}
/**
return;
for (int i = 0; i < Context->mailbox->msg_count; i++)
- Context->hdrs[i]->attach_valid = false;
+ Context->mailbox->hdrs[i]->attach_valid = false;
}
/**
return;
for (int i = 0; i < Context->mailbox->msg_count; i++)
- FREE(&Context->hdrs[i]->env->disp_subj);
+ FREE(&Context->mailbox->hdrs[i]->env->disp_subj);
}
#ifdef USE_NOTMUCH
int msg_unread; /**< number of unread messages */
int msg_flagged; /**< number of flagged messages */
+ struct Header **hdrs;
+ int hdrmax; /**< number of pointers in hdrs */
+
bool notified; /**< user has been notified */
enum MailboxType magic; /**< mailbox type */
bool newly_created; /**< mbox or mmdf just popped into existence */
/* now, update our unseen, flagged, and replied sequences */
for (l = 0; l < ctx->mailbox->msg_count; l++)
{
- if (ctx->hdrs[l]->deleted)
+ if (ctx->mailbox->hdrs[l]->deleted)
continue;
- p = strrchr(ctx->hdrs[l]->path, '/');
+ p = strrchr(ctx->mailbox->hdrs[l]->path, '/');
if (p)
p++;
else
- p = ctx->hdrs[l]->path;
+ p = ctx->mailbox->hdrs[l]->path;
if (mutt_str_atoi(p, &i) < 0)
continue;
- if (!ctx->hdrs[l]->read)
+ if (!ctx->mailbox->hdrs[l]->read)
{
mhs_set(&mhs, i, MH_SEQ_UNSEEN);
unseen++;
}
- if (ctx->hdrs[l]->flagged)
+ if (ctx->mailbox->hdrs[l]->flagged)
{
mhs_set(&mhs, i, MH_SEQ_FLAGGED);
flagged++;
}
- if (ctx->hdrs[l]->replied)
+ if (ctx->mailbox->hdrs[l]->replied)
{
mhs_set(&mhs, i, MH_SEQ_REPLIED);
replied++;
mutt_debug(2, "Adding header structure. Flags: %s%s%s%s%s\n",
md->h->flagged ? "f" : "", md->h->deleted ? "D" : "",
md->h->replied ? "r" : "", md->h->old ? "O" : "", md->h->read ? "R" : "");
- if (ctx->mailbox->msg_count == ctx->hdrmax)
+ if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
- ctx->hdrs[ctx->mailbox->msg_count] = md->h;
- ctx->hdrs[ctx->mailbox->msg_count]->index = ctx->mailbox->msg_count;
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = md->h;
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count]->index = ctx->mailbox->msg_count;
ctx->size += md->h->content->length + md->h->content->offset -
md->h->content->hdr_offset;
static int maildir_mh_open_message(struct Context *ctx, struct Message *msg,
int msgno, int is_maildir)
{
- struct Header *cur = ctx->hdrs[msgno];
+ struct Header *cur = ctx->mailbox->hdrs[msgno];
char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s", ctx->mailbox->path, cur->path);
*/
static int mh_rewrite_message(struct Context *ctx, int msgno)
{
- struct Header *h = ctx->hdrs[msgno];
+ struct Header *h = ctx->mailbox->hdrs[msgno];
bool restore = true;
long old_body_offset = h->content->offset;
*/
static int mh_sync_message(struct Context *ctx, int msgno)
{
- struct Header *h = ctx->hdrs[msgno];
+ struct Header *h = ctx->mailbox->hdrs[msgno];
if (h->attach_del || h->xlabel_changed ||
(h->env && (h->env->refs_changed || h->env->irt_changed)))
*/
static int maildir_sync_message(struct Context *ctx, int msgno)
{
- struct Header *h = ctx->hdrs[msgno];
+ struct Header *h = ctx->mailbox->hdrs[msgno];
if (h->attach_del || h->xlabel_changed ||
(h->env && (h->env->refs_changed || h->env->irt_changed)))
int mh_sync_mailbox_message(struct Context *ctx, int msgno)
#endif
{
- struct Header *h = ctx->hdrs[msgno];
+ struct Header *h = ctx->mailbox->hdrs[msgno];
if (h->deleted && (ctx->mailbox->magic != MUTT_MAILDIR || !MaildirTrash))
{
const int old_count = ctx->mailbox->msg_count;
for (int i = 0, j = 0; i < old_count; i++)
{
- if (ctx->hdrs[i]->active && index_hint && *index_hint == i)
+ if (ctx->mailbox->hdrs[i]->active && index_hint && *index_hint == i)
*index_hint = j;
- if (ctx->hdrs[i]->active)
- ctx->hdrs[i]->index = j++;
+ if (ctx->mailbox->hdrs[i]->active)
+ ctx->mailbox->hdrs[i]->index = j++;
}
mx_update_tables(ctx, false);
/* check for modifications and adjust flags */
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- ctx->hdrs[i]->active = false;
- maildir_canon_filename(ctx->hdrs[i]->path, buf, sizeof(buf));
+ ctx->mailbox->hdrs[i]->active = false;
+ maildir_canon_filename(ctx->mailbox->hdrs[i]->path, buf, sizeof(buf));
p = mutt_hash_find(fnames, buf);
if (p && p->h)
{
/* message already exists, merge flags */
- ctx->hdrs[i]->active = true;
+ ctx->mailbox->hdrs[i]->active = true;
/* check to see if the message has moved to a different
* subdirectory. If so, update the associated filename.
*/
- if (mutt_str_strcmp(ctx->hdrs[i]->path, p->h->path) != 0)
- mutt_str_replace(&ctx->hdrs[i]->path, p->h->path);
+ if (mutt_str_strcmp(ctx->mailbox->hdrs[i]->path, p->h->path) != 0)
+ mutt_str_replace(&ctx->mailbox->hdrs[i]->path, p->h->path);
/* if the user hasn't modified the flags on this message, update
* the flags we just detected.
*/
- if (!ctx->hdrs[i]->changed)
- if (maildir_update_flags(ctx, ctx->hdrs[i], p->h))
+ if (!ctx->mailbox->hdrs[i]->changed)
+ if (maildir_update_flags(ctx, ctx->mailbox->hdrs[i], p->h))
flags_changed = true;
- if (ctx->hdrs[i]->deleted == ctx->hdrs[i]->trash)
+ if (ctx->mailbox->hdrs[i]->deleted == ctx->mailbox->hdrs[i]->trash)
{
- if (ctx->hdrs[i]->deleted != p->h->deleted)
+ if (ctx->mailbox->hdrs[i]->deleted != p->h->deleted)
{
- ctx->hdrs[i]->deleted = p->h->deleted;
+ ctx->mailbox->hdrs[i]->deleted = p->h->deleted;
flags_changed = true;
}
}
- ctx->hdrs[i]->trash = p->h->trash;
+ ctx->mailbox->hdrs[i]->trash = p->h->trash;
/* this is a duplicate of an existing header, so remove it */
mutt_header_free(&p->h);
* Check to see if we have enough information to know if the
* message has disappeared out from underneath us.
*/
- else if (((changed & 1) && (strncmp(ctx->hdrs[i]->path, "new/", 4) == 0)) ||
- ((changed & 2) && (strncmp(ctx->hdrs[i]->path, "cur/", 4) == 0)))
+ else if (((changed & 1) && (strncmp(ctx->mailbox->hdrs[i]->path, "new/", 4) == 0)) ||
+ ((changed & 2) && (strncmp(ctx->mailbox->hdrs[i]->path, "cur/", 4) == 0)))
{
/* This message disappeared, so we need to simulate a "reopen"
* event. We know it disappeared because we just scanned the
* modified, so we assume that it is still present and
* unchanged.
*/
- ctx->hdrs[i]->active = true;
+ ctx->mailbox->hdrs[i]->active = true;
}
}
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- ctx->hdrs[i]->active = false;
+ ctx->mailbox->hdrs[i]->active = false;
- p = mutt_hash_find(fnames, ctx->hdrs[i]->path);
- if (p && p->h && mutt_header_cmp_strict(ctx->hdrs[i], p->h))
+ p = mutt_hash_find(fnames, ctx->mailbox->hdrs[i]->path);
+ if (p && p->h && mutt_header_cmp_strict(ctx->mailbox->hdrs[i], p->h))
{
- ctx->hdrs[i]->active = true;
+ ctx->mailbox->hdrs[i]->active = true;
/* found the right message */
- if (!ctx->hdrs[i]->changed)
- if (maildir_update_flags(ctx, ctx->hdrs[i], p->h))
+ if (!ctx->mailbox->hdrs[i]->changed)
+ if (maildir_update_flags(ctx, ctx->mailbox->hdrs[i], p->h))
flags_changed = true;
mutt_header_free(&p->h);
{
for (i = 0, j = 0; i < ctx->mailbox->msg_count; i++)
{
- if (!ctx->hdrs[i]->deleted || (ctx->mailbox->magic == MUTT_MAILDIR && MaildirTrash))
- ctx->hdrs[i]->index = j++;
+ if (!ctx->mailbox->hdrs[i]->deleted || (ctx->mailbox->magic == MUTT_MAILDIR && MaildirTrash))
+ ctx->mailbox->hdrs[i]->index = j++;
}
}
if (!ctx->quiet)
mutt_progress_update(&progress, count, (int) (loc / (ctx->size / 100 + 1)));
- if (ctx->mailbox->msg_count == ctx->hdrmax)
+ if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
hdr = mutt_header_new();
- ctx->hdrs[ctx->mailbox->msg_count] = hdr;
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = hdr;
hdr->offset = loc;
hdr->index = ctx->mailbox->msg_count;
/* Save the Content-Length of the previous message */
if (count > 0)
{
- struct Header *h = ctx->hdrs[ctx->mailbox->msg_count - 1];
+ struct Header *h = ctx->mailbox->hdrs[ctx->mailbox->msg_count - 1];
if (h->content->length < 0)
{
h->content->length = loc - h->content->offset - 1;
(int) (ftello(ctx->fp) / (ctx->size / 100 + 1)));
}
- if (ctx->mailbox->msg_count == ctx->hdrmax)
+ if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
- ctx->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
- curhdr = ctx->hdrs[ctx->mailbox->msg_count];
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
+ curhdr = ctx->mailbox->hdrs[ctx->mailbox->msg_count];
curhdr->received = t - mutt_date_local_tz(t);
curhdr->offset = loc;
curhdr->index = ctx->mailbox->msg_count;
*/
if (count > 0)
{
- struct Header *h = ctx->hdrs[ctx->mailbox->msg_count - 1];
+ struct Header *h = ctx->mailbox->hdrs[ctx->mailbox->msg_count - 1];
if (h->content->length < 0)
{
h->content->length = ftello(ctx->fp) - h->content->offset - 1;
if (ctx->readonly)
{
for (i = 0; i < ctx->mailbox->msg_count; i++)
- mutt_header_free(&(ctx->hdrs[i])); /* nothing to do! */
- FREE(&ctx->hdrs);
+ mutt_header_free(&(ctx->mailbox->hdrs[i])); /* nothing to do! */
+ FREE(&ctx->mailbox->hdrs);
}
else
{
/* save the old headers */
old_msgcount = ctx->mailbox->msg_count;
- old_hdrs = ctx->hdrs;
- ctx->hdrs = NULL;
+ old_hdrs = ctx->mailbox->hdrs;
+ ctx->mailbox->hdrs = NULL;
}
- ctx->hdrmax = 0; /* force allocation of new headers */
+ ctx->mailbox->hdrmax = 0; /* force allocation of new headers */
ctx->mailbox->msg_count = 0;
ctx->vcount = 0;
ctx->vsize = 0;
{
if (!old_hdrs[j])
continue;
- if (cmp_headers(ctx->hdrs[i], old_hdrs[j]))
+ if (cmp_headers(ctx->mailbox->hdrs[i], old_hdrs[j]))
{
found = true;
break;
{
if (!old_hdrs[j])
continue;
- if (cmp_headers(ctx->hdrs[i], old_hdrs[j]))
+ if (cmp_headers(ctx->mailbox->hdrs[i], old_hdrs[j]))
{
found = true;
break;
* otherwise, the header may have been modified externally,
* and we don't want to lose _those_ changes
*/
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_FLAG, old_hdrs[j]->flagged);
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_REPLIED, old_hdrs[j]->replied);
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_OLD, old_hdrs[j]->old);
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_READ, old_hdrs[j]->read);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_FLAG, old_hdrs[j]->flagged);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_REPLIED, old_hdrs[j]->replied);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_OLD, old_hdrs[j]->old);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_READ, old_hdrs[j]->read);
}
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_DELETE, old_hdrs[j]->deleted);
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_PURGE, old_hdrs[j]->purge);
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_TAG, old_hdrs[j]->tagged);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_DELETE, old_hdrs[j]->deleted);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_PURGE, old_hdrs[j]->purge);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_TAG, old_hdrs[j]->tagged);
/* we don't need this header any more */
mutt_header_free(&(old_hdrs[j]));
static bool mbox_has_new(struct Context *ctx)
{
for (int i = 0; i < ctx->mailbox->msg_count; i++)
- if (!ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read && !ctx->hdrs[i]->old)
+ if (!ctx->mailbox->hdrs[i]->deleted && !ctx->mailbox->hdrs[i]->read &&
+ !ctx->mailbox->hdrs[i]->old)
return true;
return false;
}
/* find the first deleted/changed message. we save a lot of time by only
* rewriting the mailbox from the point where it has actually changed.
*/
- for (i = 0; (i < ctx->mailbox->msg_count) && !ctx->hdrs[i]->deleted &&
- !ctx->hdrs[i]->changed && !ctx->hdrs[i]->attach_del;
+ for (i = 0; (i < ctx->mailbox->msg_count) && !ctx->mailbox->hdrs[i]->deleted &&
+ !ctx->mailbox->hdrs[i]->changed && !ctx->mailbox->hdrs[i]->attach_del;
i++)
{
}
/* save the index of the first changed/deleted message */
first = i;
/* where to start overwriting */
- offset = ctx->hdrs[i]->offset;
+ offset = ctx->mailbox->hdrs[i]->offset;
/* the offset stored in the header does not include the MMDF_SEP, so make
* sure we seek to the correct location
*/
old_offset[i - first].valid = true;
- old_offset[i - first].hdr = ctx->hdrs[i]->offset;
- old_offset[i - first].body = ctx->hdrs[i]->content->offset;
- old_offset[i - first].lines = ctx->hdrs[i]->lines;
- old_offset[i - first].length = ctx->hdrs[i]->content->length;
+ old_offset[i - first].hdr = ctx->mailbox->hdrs[i]->offset;
+ old_offset[i - first].body = ctx->mailbox->hdrs[i]->content->offset;
+ old_offset[i - first].lines = ctx->mailbox->hdrs[i]->lines;
+ old_offset[i - first].length = ctx->mailbox->hdrs[i]->content->length;
- if (!ctx->hdrs[i]->deleted)
+ if (!ctx->mailbox->hdrs[i]->deleted)
{
j++;
*/
new_offset[i - first].hdr = ftello(fp) + offset;
- if (mutt_copy_message_ctx(fp, ctx, ctx->hdrs[i], MUTT_CM_UPDATE,
+ if (mutt_copy_message_ctx(fp, ctx, ctx->mailbox->hdrs[i], MUTT_CM_UPDATE,
CH_FROM | CH_UPDATE | CH_UPDATE_LEN) != 0)
{
mutt_perror(tempfile);
* we just flush the in memory cache so that the message will be reparsed
* if the user accesses it later.
*/
- new_offset[i - first].body = ftello(fp) - ctx->hdrs[i]->content->length + offset;
- mutt_body_free(&ctx->hdrs[i]->content->parts);
+ new_offset[i - first].body =
+ ftello(fp) - ctx->mailbox->hdrs[i]->content->length + offset;
+ mutt_body_free(&ctx->mailbox->hdrs[i]->content->parts);
switch (ctx->mailbox->magic)
{
/* update the offsets of the rewritten messages */
for (i = first, j = first; i < ctx->mailbox->msg_count; i++)
{
- if (!ctx->hdrs[i]->deleted)
+ if (!ctx->mailbox->hdrs[i]->deleted)
{
- ctx->hdrs[i]->offset = new_offset[i - first].hdr;
- ctx->hdrs[i]->content->hdr_offset = new_offset[i - first].hdr;
- ctx->hdrs[i]->content->offset = new_offset[i - first].body;
- ctx->hdrs[i]->index = j++;
+ ctx->mailbox->hdrs[i]->offset = new_offset[i - first].hdr;
+ ctx->mailbox->hdrs[i]->content->hdr_offset = new_offset[i - first].hdr;
+ ctx->mailbox->hdrs[i]->content->offset = new_offset[i - first].body;
+ ctx->mailbox->hdrs[i]->index = j++;
}
}
FREE(&new_offset);
{
for (i = first; (i < ctx->mailbox->msg_count) && old_offset[i - first].valid; i++)
{
- ctx->hdrs[i]->offset = old_offset[i - first].hdr;
- ctx->hdrs[i]->content->hdr_offset = old_offset[i - first].hdr;
- ctx->hdrs[i]->content->offset = old_offset[i - first].body;
- ctx->hdrs[i]->lines = old_offset[i - first].lines;
- ctx->hdrs[i]->content->length = old_offset[i - first].length;
+ ctx->mailbox->hdrs[i]->offset = old_offset[i - first].hdr;
+ ctx->mailbox->hdrs[i]->content->hdr_offset = old_offset[i - first].hdr;
+ ctx->mailbox->hdrs[i]->content->offset = old_offset[i - first].body;
+ ctx->mailbox->hdrs[i]->lines = old_offset[i - first].lines;
+ ctx->mailbox->hdrs[i]->content->length = old_offset[i - first].length;
}
}
#include "curs_lib.h"
#include "globals.h"
#include "keymap.h"
+#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_logging.h"
#include "mutt_window.h"
{
struct ColorLineHead *color = NULL;
struct ColorLine *np = NULL;
- struct Header *hdr = Context->hdrs[Context->v2r[index]];
+ struct Header *hdr = Context->mailbox->hdrs[Context->v2r[index]];
int type = *s;
switch (type)
if (!message_is_tagged(Context, i))
continue;
- struct Header *h = Context->hdrs[i];
+ struct Header *h = Context->mailbox->hdrs[i];
if (label_message(Context, h, new))
{
changed++;
{
struct MuttThread *tree = ctx->tree;
struct Header **array =
- ctx->hdrs + ((Sort & SORT_REVERSE) ? ctx->mailbox->msg_count - 1 : 0);
+ ctx->mailbox->hdrs + ((Sort & SORT_REVERSE) ? ctx->mailbox->msg_count - 1 : 0);
while (tree)
{
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- struct Header *hdr = ctx->hdrs[i];
+ struct Header *hdr = ctx->mailbox->hdrs[i];
if (hdr->env->real_subj)
mutt_hash_insert(hash, hdr->env->real_subj, hdr);
}
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
/* mailbox may have been only partially read */
- if (ctx->hdrs[i])
+ if (ctx->mailbox->hdrs[i])
{
- ctx->hdrs[i]->thread = NULL;
- ctx->hdrs[i]->threaded = false;
+ ctx->mailbox->hdrs[i]->thread = NULL;
+ ctx->mailbox->hdrs[i]->threaded = false;
}
}
ctx->tree = NULL;
struct MuttThread *tmp = NULL;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- cur = ctx->hdrs[i];
+ cur = ctx->mailbox->hdrs[i];
if (cur->thread->check_subject)
cur->thread->check_subject = false;
else if (!init)
* MuttThread, make a new one for it. */
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- cur = ctx->hdrs[i];
+ cur = ctx->mailbox->hdrs[i];
if (!cur->thread)
{
/* thread by references */
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- cur = ctx->hdrs[i];
+ cur = ctx->mailbox->hdrs[i];
if (cur->threaded)
continue;
cur->threaded = true;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- cur = ctx->hdrs[i];
+ cur = ctx->mailbox->hdrs[i];
if (cur->virtual >= 0)
{
cur->virtual = ctx->vcount;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- struct Header *hdr = ctx->hdrs[i];
+ struct Header *hdr = ctx->mailbox->hdrs[i];
if (hdr->env->message_id)
mutt_hash_insert(hash, hdr->env->message_id, hdr);
}
{
for (int i = 0; i < ctx->mailbox->msg_count; i++)
if (message_is_tagged(ctx, i))
- changed |= link_threads(cur, ctx->hdrs[i], ctx);
+ changed |= link_threads(cur, ctx->mailbox->hdrs[i], ctx);
}
else
changed = link_threads(cur, last, ctx);
mutt_hash_destroy(&ctx->label_hash);
mutt_clear_threads(ctx);
for (int i = 0; i < ctx->mailbox->msg_count; i++)
- mutt_header_free(&ctx->hdrs[i]);
- FREE(&ctx->hdrs);
+ mutt_header_free(&ctx->mailbox->hdrs[i]);
+ FREE(&ctx->mailbox->hdrs);
FREE(&ctx->v2r);
FREE(&ctx->pattern);
if (ctx->limit_pattern)
int first_del = -1;
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (ctx->hdrs[i]->deleted && (!ctx->hdrs[i]->purge))
+ if (ctx->mailbox->hdrs[i]->deleted && (!ctx->mailbox->hdrs[i]->purge))
{
if (first_del < 0)
first_del = i;
/* continue from initial scan above */
for (i = first_del; i < ctx->mailbox->msg_count; i++)
{
- if (ctx->hdrs[i]->deleted && (!ctx->hdrs[i]->purge))
+ if (ctx->mailbox->hdrs[i]->deleted && (!ctx->mailbox->hdrs[i]->purge))
{
- if (mutt_append_message(ctx_trash, ctx, ctx->hdrs[i], 0, 0) == -1)
+ if (mutt_append_message(ctx_trash, ctx, ctx->mailbox->hdrs[i], 0, 0) == -1)
{
mx_mbox_close(&ctx_trash, NULL);
return -1;
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read && !(ctx->hdrs[i]->flagged && KeepFlagged))
+ if (!ctx->mailbox->hdrs[i]->deleted && ctx->mailbox->hdrs[i]->read &&
+ !(ctx->mailbox->hdrs[i]->flagged && KeepFlagged))
{
read_msgs++;
}
{
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (!ctx->hdrs[i]->deleted && !ctx->hdrs[i]->old && !ctx->hdrs[i]->read)
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_OLD, 1);
+ if (!ctx->mailbox->hdrs[i]->deleted && !ctx->mailbox->hdrs[i]->old &&
+ !ctx->mailbox->hdrs[i]->read)
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_OLD, 1);
}
}
/* tag messages for moving, and clear old tags, if any */
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (ctx->hdrs[i]->read && !ctx->hdrs[i]->deleted &&
- !(ctx->hdrs[i]->flagged && KeepFlagged))
+ if (ctx->mailbox->hdrs[i]->read && !ctx->mailbox->hdrs[i]->deleted &&
+ !(ctx->mailbox->hdrs[i]->flagged && KeepFlagged))
{
- ctx->hdrs[i]->tagged = true;
+ ctx->mailbox->hdrs[i]->tagged = true;
}
else
{
- ctx->hdrs[i]->tagged = false;
+ ctx->mailbox->hdrs[i]->tagged = false;
}
}
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (ctx->hdrs[i]->read && !ctx->hdrs[i]->deleted &&
- !(ctx->hdrs[i]->flagged && KeepFlagged))
+ if (ctx->mailbox->hdrs[i]->read && !ctx->mailbox->hdrs[i]->deleted &&
+ !(ctx->mailbox->hdrs[i]->flagged && KeepFlagged))
{
- if (mutt_append_message(f, ctx, ctx->hdrs[i], 0, CH_UPDATE_LEN) == 0)
+ if (mutt_append_message(f, ctx, ctx->mailbox->hdrs[i], 0, CH_UPDATE_LEN) == 0)
{
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_DELETE, 1);
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_PURGE, 1);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_DELETE, 1);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_PURGE, 1);
}
else
{
{
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- ctx->hdrs[i]->deleted = false;
- ctx->hdrs[i]->purge = false;
+ ctx->mailbox->hdrs[i]->deleted = false;
+ ctx->mailbox->hdrs[i]->purge = false;
}
ctx->deleted = 0;
}
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read)
+ if (ctx->mailbox->hdrs[i]->deleted && !ctx->mailbox->hdrs[i]->read)
ctx->mailbox->msg_unread--;
- if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged)
+ if (ctx->mailbox->hdrs[i]->deleted && ctx->mailbox->hdrs[i]->flagged)
ctx->mailbox->msg_flagged--;
}
ctx->mailbox->msg_count -= ctx->deleted;
padding = mx_msg_padding_size(ctx);
for (i = 0, j = 0; i < ctx->mailbox->msg_count; i++)
{
- if (!ctx->hdrs[i]->quasi_deleted &&
- ((committing && (!ctx->hdrs[i]->deleted ||
+ if (!ctx->mailbox->hdrs[i]->quasi_deleted &&
+ ((committing && (!ctx->mailbox->hdrs[i]->deleted ||
(ctx->mailbox->magic == MUTT_MAILDIR && MaildirTrash))) ||
- (!committing && ctx->hdrs[i]->active)))
+ (!committing && ctx->mailbox->hdrs[i]->active)))
{
if (i != j)
{
- ctx->hdrs[j] = ctx->hdrs[i];
- ctx->hdrs[i] = NULL;
+ ctx->mailbox->hdrs[j] = ctx->mailbox->hdrs[i];
+ ctx->mailbox->hdrs[i] = NULL;
}
- ctx->hdrs[j]->msgno = j;
- if (ctx->hdrs[j]->virtual != -1)
+ ctx->mailbox->hdrs[j]->msgno = j;
+ if (ctx->mailbox->hdrs[j]->virtual != -1)
{
ctx->v2r[ctx->vcount] = j;
- ctx->hdrs[j]->virtual = ctx->vcount++;
- struct Body *b = ctx->hdrs[j]->content;
+ ctx->mailbox->hdrs[j]->virtual = ctx->vcount++;
+ struct Body *b = ctx->mailbox->hdrs[j]->content;
ctx->vsize += b->length + b->offset - b->hdr_offset + padding;
}
if (committing)
- ctx->hdrs[j]->changed = false;
- else if (ctx->hdrs[j]->changed)
+ ctx->mailbox->hdrs[j]->changed = false;
+ else if (ctx->mailbox->hdrs[j]->changed)
ctx->changed = true;
if (!committing || (ctx->mailbox->magic == MUTT_MAILDIR && MaildirTrash))
{
- if (ctx->hdrs[j]->deleted)
+ if (ctx->mailbox->hdrs[j]->deleted)
ctx->deleted++;
}
- if (ctx->hdrs[j]->tagged)
+ if (ctx->mailbox->hdrs[j]->tagged)
ctx->tagged++;
- if (ctx->hdrs[j]->flagged)
+ if (ctx->mailbox->hdrs[j]->flagged)
ctx->mailbox->msg_flagged++;
- if (!ctx->hdrs[j]->read)
+ if (!ctx->mailbox->hdrs[j]->read)
{
ctx->mailbox->msg_unread++;
- if (!ctx->hdrs[j]->old)
+ if (!ctx->mailbox->hdrs[j]->old)
ctx->new ++;
}
{
if (ctx->mailbox->magic == MUTT_MH || ctx->mailbox->magic == MUTT_MAILDIR)
{
- ctx->size -= (ctx->hdrs[i]->content->length + ctx->hdrs[i]->content->offset -
- ctx->hdrs[i]->content->hdr_offset);
+ ctx->size -= (ctx->mailbox->hdrs[i]->content->length +
+ ctx->mailbox->hdrs[i]->content->offset -
+ ctx->mailbox->hdrs[i]->content->hdr_offset);
}
/* remove message from the hash tables */
- if (ctx->subj_hash && ctx->hdrs[i]->env->real_subj)
- mutt_hash_delete(ctx->subj_hash, ctx->hdrs[i]->env->real_subj, ctx->hdrs[i]);
- if (ctx->id_hash && ctx->hdrs[i]->env->message_id)
- mutt_hash_delete(ctx->id_hash, ctx->hdrs[i]->env->message_id, ctx->hdrs[i]);
- mutt_label_hash_remove(ctx, ctx->hdrs[i]);
+ if (ctx->subj_hash && ctx->mailbox->hdrs[i]->env->real_subj)
+ mutt_hash_delete(ctx->subj_hash, ctx->mailbox->hdrs[i]->env->real_subj,
+ ctx->mailbox->hdrs[i]);
+ if (ctx->id_hash && ctx->mailbox->hdrs[i]->env->message_id)
+ mutt_hash_delete(ctx->id_hash, ctx->mailbox->hdrs[i]->env->message_id,
+ ctx->mailbox->hdrs[i]);
+ mutt_label_hash_remove(ctx, ctx->mailbox->hdrs[i]);
/* The path mx_mbox_check() -> imap_check_mailbox() ->
* imap_expunge_mailbox() -> mx_update_tables()
* can occur before a call to mx_mbox_sync(), resulting in
* last_tag being stale if it's not reset here.
*/
- if (ctx->last_tag == ctx->hdrs[i])
+ if (ctx->last_tag == ctx->mailbox->hdrs[i])
ctx->last_tag = NULL;
- mutt_header_free(&ctx->hdrs[i]);
+ mutt_header_free(&ctx->mailbox->hdrs[i]);
}
}
ctx->mailbox->msg_count = j;
{
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- ctx->hdrs[i]->deleted = false;
- ctx->hdrs[i]->purge = false;
+ ctx->mailbox->hdrs[i]->deleted = false;
+ ctx->mailbox->hdrs[i]->purge = false;
}
ctx->deleted = 0;
}
{
size_t s = MAX(sizeof(struct Header *), sizeof(int));
- if ((ctx->hdrmax + 25) * s < ctx->hdrmax * s)
+ if ((ctx->mailbox->hdrmax + 25) * s < ctx->mailbox->hdrmax * s)
{
mutt_error(_("Out of memory"));
mutt_exit(1);
}
- if (ctx->hdrs)
+ if (ctx->mailbox->hdrs)
{
- mutt_mem_realloc(&ctx->hdrs, sizeof(struct Header *) * (ctx->hdrmax += 25));
- mutt_mem_realloc(&ctx->v2r, sizeof(int) * ctx->hdrmax);
+ mutt_mem_realloc(&ctx->mailbox->hdrs,
+ sizeof(struct Header *) * (ctx->mailbox->hdrmax += 25));
+ mutt_mem_realloc(&ctx->v2r, sizeof(int) * ctx->mailbox->hdrmax);
}
else
{
- ctx->hdrs = mutt_mem_calloc((ctx->hdrmax += 25), sizeof(struct Header *));
- ctx->v2r = mutt_mem_calloc(ctx->hdrmax, sizeof(int));
+ ctx->mailbox->hdrs =
+ mutt_mem_calloc((ctx->mailbox->hdrmax += 25), sizeof(struct Header *));
+ ctx->v2r = mutt_mem_calloc(ctx->mailbox->hdrmax, sizeof(int));
}
- for (int i = ctx->mailbox->msg_count; i < ctx->hdrmax; i++)
+ for (int i = ctx->mailbox->msg_count; i < ctx->mailbox->hdrmax; i++)
{
- ctx->hdrs[i] = NULL;
+ ctx->mailbox->hdrs[i] = NULL;
ctx->v2r[i] = -1;
}
}
for (int msgno = ctx->mailbox->msg_count - new_messages;
msgno < ctx->mailbox->msg_count; msgno++)
{
- h = ctx->hdrs[msgno];
+ h = ctx->mailbox->hdrs[msgno];
if (WithCrypto)
{
if (!message_is_tagged(Context, i))
continue;
- struct Header *hi = Context->hdrs[i];
+ struct Header *hi = Context->mailbox->hdrs[i];
mutt_parse_mime_message(Context, hi);
if (hi->security & ENCRYPT && !crypt_valid_passphrase(hi->security))
{
/* We don't actually check sequential order, since we mark
* "missing" entries as read/deleted */
- last = NHDR(ctx->hdrs[i])->article_num;
- if (last >= nntp_data->first_message && !ctx->hdrs[i]->deleted &&
- !ctx->hdrs[i]->read)
+ last = NHDR(ctx->mailbox->hdrs[i])->article_num;
+ if (last >= nntp_data->first_message && !ctx->mailbox->hdrs[i]->deleted &&
+ !ctx->mailbox->hdrs[i]->read)
{
if (nntp_data->newsrc_len >= entries)
{
/* search for first read */
else
{
- if (ctx->hdrs[i]->deleted || ctx->hdrs[i]->read)
+ if (ctx->mailbox->hdrs[i]->deleted || ctx->mailbox->hdrs[i]->read)
{
first = last + 1;
series = true;
}
- last = NHDR(ctx->hdrs[i])->article_num;
+ last = NHDR(ctx->mailbox->hdrs[i])->article_num;
}
}
if (Context && Context->mailbox->data == nntp_data)
{
for (unsigned int i = 0; i < Context->mailbox->msg_count; i++)
- mutt_set_flag(Context, Context->hdrs[i], MUTT_READ, 1);
+ mutt_set_flag(Context, Context->mailbox->hdrs[i], MUTT_READ, 1);
}
return nntp_data;
}
{
nntp_data->unread = Context->mailbox->msg_count;
for (unsigned int i = 0; i < Context->mailbox->msg_count; i++)
- mutt_set_flag(Context, Context->hdrs[i], MUTT_READ, 0);
+ mutt_set_flag(Context, Context->mailbox->hdrs[i], MUTT_READ, 0);
}
else
{
unsigned int unread = 0;
for (unsigned int j = 0; j < Context->mailbox->msg_count; j++)
- if (!Context->hdrs[j]->read && !Context->hdrs[j]->deleted)
+ if (!Context->mailbox->hdrs[j]->read && !Context->mailbox->hdrs[j]->deleted)
unread++;
if (!unread)
continue;
rewind(fp);
/* allocate memory for headers */
- if (ctx->mailbox->msg_count >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
/* parse header */
- ctx->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
- hdr = ctx->hdrs[ctx->mailbox->msg_count];
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
+ hdr = ctx->mailbox->hdrs[ctx->mailbox->msg_count];
hdr->env = mutt_rfc822_read_header(fp, hdr, false, false);
hdr->env->newsgroups = mutt_str_strdup(nntp_data->group);
hdr->received = hdr->date_sent;
mutt_debug(2, "mutt_hcache_fetch %s\n", buf);
mutt_header_free(&hdr);
hdr = mutt_hcache_restore(hdata);
- ctx->hdrs[ctx->mailbox->msg_count] = hdr;
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = hdr;
mutt_hcache_free(fc->hc, &hdata);
hdr->data = NULL;
hdr->read = false;
continue;
/* allocate memory for headers */
- if (ctx->mailbox->msg_count >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
#ifdef USE_HCACHE
{
mutt_debug(2, "mutt_hcache_fetch %s\n", buf);
hdr = mutt_hcache_restore(hdata);
- ctx->hdrs[ctx->mailbox->msg_count] = hdr;
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = hdr;
mutt_hcache_free(fc.hc, &hdata);
hdr->data = NULL;
}
/* parse header */
- ctx->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
- hdr = ctx->hdrs[ctx->mailbox->msg_count];
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
+ hdr = ctx->mailbox->hdrs[ctx->mailbox->msg_count];
hdr->env = mutt_rfc822_read_header(fp, hdr, false, false);
hdr->received = hdr->date_sent;
mutt_file_fclose(&fp);
static int nntp_msg_open(struct Context *ctx, struct Message *msg, int msgno)
{
struct NntpData *nntp_data = ctx->mailbox->data;
- struct Header *hdr = ctx->hdrs[msgno];
+ struct Header *hdr = ctx->mailbox->hdrs[msgno];
char article[16];
/* try to get article from cache */
if (nntp_data->last_message < nntp_data->last_loaded)
{
for (int i = 0; i < ctx->mailbox->msg_count; i++)
- mutt_header_free(&ctx->hdrs[i]);
+ mutt_header_free(&ctx->mailbox->hdrs[i]);
ctx->mailbox->msg_count = 0;
ctx->tagged = 0;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
bool flagged = false;
- anum = NHDR(ctx->hdrs[i])->article_num;
+ anum = NHDR(ctx->mailbox->hdrs[i])->article_num;
#ifdef USE_HCACHE
/* check hcache for flagged and deleted flags */
/* header marked as deleted, removing from context */
if (deleted)
{
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_TAG, 0);
- mutt_header_free(&ctx->hdrs[i]);
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_TAG, 0);
+ mutt_header_free(&ctx->mailbox->hdrs[i]);
continue;
}
}
}
#endif
- if (!ctx->hdrs[i]->changed)
+ if (!ctx->mailbox->hdrs[i]->changed)
{
- ctx->hdrs[i]->flagged = flagged;
- ctx->hdrs[i]->read = false;
- ctx->hdrs[i]->old = false;
- nntp_article_status(ctx, ctx->hdrs[i], NULL, anum);
- if (!ctx->hdrs[i]->read)
- nntp_parse_xref(ctx, ctx->hdrs[i]);
+ ctx->mailbox->hdrs[i]->flagged = flagged;
+ ctx->mailbox->hdrs[i]->read = false;
+ ctx->mailbox->hdrs[i]->old = false;
+ nntp_article_status(ctx, ctx->mailbox->hdrs[i], NULL, anum);
+ if (!ctx->mailbox->hdrs[i]->read)
+ nntp_parse_xref(ctx, ctx->mailbox->hdrs[i]);
}
- ctx->hdrs[j++] = ctx->hdrs[i];
+ ctx->mailbox->hdrs[j++] = ctx->mailbox->hdrs[i];
}
#ifdef USE_HCACHE
if (hdata)
{
mutt_debug(2, "#2 mutt_hcache_fetch %s\n", buf);
- if (ctx->mailbox->msg_count >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
hdr = mutt_hcache_restore(hdata);
- ctx->hdrs[ctx->mailbox->msg_count] = hdr;
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = hdr;
mutt_hcache_free(hc, &hdata);
hdr->data = NULL;
if (hdr->deleted)
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- struct Header *hdr = ctx->hdrs[i];
+ struct Header *hdr = ctx->mailbox->hdrs[i];
char buf[16];
snprintf(buf, sizeof(buf), "%d", NHDR(hdr)->article_num);
}
/* parse header */
- if (ctx->mailbox->msg_count == ctx->hdrmax)
+ if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
- ctx->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
- struct Header *hdr = ctx->hdrs[ctx->mailbox->msg_count];
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
+ struct Header *hdr = ctx->mailbox->hdrs[ctx->mailbox->msg_count];
hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData));
hdr->env = mutt_rfc822_read_header(fp, hdr, false, false);
mutt_file_fclose(&fp);
if (!line || sscanf(line, ANUM, &anum) != 1)
return 0;
for (unsigned int i = 0; i < cc->ctx->mailbox->msg_count; i++)
- if (NHDR(cc->ctx->hdrs[i])->article_num == anum)
+ if (NHDR(cc->ctx->mailbox->hdrs[i])->article_num == anum)
return 0;
if (cc->num >= cc->max)
{
mutt_debug(2, "nm: appending message, i=%d, id=%s, path=%s\n",
ctx->mailbox->msg_count, notmuch_message_get_message_id(msg), path);
- if (ctx->mailbox->msg_count >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->mailbox->hdrmax)
{
mutt_debug(2, "nm: allocate mx memory\n");
mx_alloc_memory(ctx);
h->active = true;
h->index = ctx->mailbox->msg_count;
ctx->size += h->content->length + h->content->offset - h->content->hdr_offset;
- ctx->hdrs[ctx->mailbox->msg_count] = h;
+ ctx->mailbox->hdrs[ctx->mailbox->msg_count] = h;
ctx->mailbox->msg_count++;
if (newpath)
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- struct Header *h = ctx->hdrs[i];
+ struct Header *h = ctx->mailbox->hdrs[i];
if (h)
{
free_hdrdata(h->data);
data->noprogress = true;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
- ctx->hdrs[i]->active = false;
+ ctx->mailbox->hdrs[i]->active = false;
limit = get_limit(data);
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (!ctx->hdrs[i]->active)
+ if (!ctx->mailbox->hdrs[i]->active)
{
occult = true;
break;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
char old[PATH_MAX], new[PATH_MAX];
- struct Header *h = ctx->hdrs[i];
+ struct Header *h = ctx->mailbox->hdrs[i];
struct NmHdrData *hd = h->data;
if (!ctx->quiet)
{
if (!ctx || !msg)
return 1;
- struct Header *cur = ctx->hdrs[msgno];
+ struct Header *cur = ctx->mailbox->hdrs[msgno];
char path[PATH_MAX];
char *folder = nm_header_get_folder(cur);
{
for (i = oldcount; i < Context->mailbox->msg_count; i++)
{
- struct Header *h = Context->hdrs[i];
+ struct Header *h = Context->mailbox->hdrs[i];
if (h && !h->read)
{
* rd.index->current might be invalid */
rd.index->current =
MIN(rd.index->current, (Context->mailbox->msg_count - 1));
- index_hint = Context->hdrs[Context->v2r[rd.index->current]]->index;
+ index_hint = Context->mailbox->hdrs[Context->v2r[rd.index->current]]->index;
bool q = Context->quiet;
Context->quiet = true;
* been deleted. Make the pointer safe, then leave the pager.
* This have a unpleasant behaviour to close the pager even the
* deleted message is not the opened one, but at least it's safe. */
- if (extra->hdr != Context->hdrs[Context->v2r[rd.index->current]])
+ if (extra->hdr != Context->mailbox->hdrs[Context->v2r[rd.index->current]])
{
- extra->hdr = Context->hdrs[Context->v2r[rd.index->current]];
+ extra->hdr = Context->mailbox->hdrs[Context->v2r[rd.index->current]];
break;
}
}
#define KILO 1024
#define MEGA 1048576
#define HMSG(h) (((h)->msgno) + 1)
-#define CTX_MSGNO(c) (HMSG((c)->hdrs[(c)->v2r[(c)->menu->current]]))
+#define CTX_MSGNO(c) (HMSG((c)->mailbox->hdrs[(c)->v2r[(c)->menu->current]]))
#define MUTT_MAXRANGE -1
FILE *fp = NULL;
long lng = 0;
- struct Header *h = ctx->hdrs[msgno];
+ struct Header *h = ctx->mailbox->hdrs[msgno];
#ifdef USE_FMEMOPEN
char *temp = NULL;
size_t tempsize;
for (int i = 0; i < Context->mailbox->msg_count; i++)
{
- Context->hdrs[i]->virtual = -1;
- Context->hdrs[i]->limited = false;
- Context->hdrs[i]->collapsed = false;
- Context->hdrs[i]->num_hidden = 0;
+ Context->mailbox->hdrs[i]->virtual = -1;
+ Context->mailbox->hdrs[i]->limited = false;
+ Context->mailbox->hdrs[i]->collapsed = false;
+ Context->mailbox->hdrs[i]->num_hidden = 0;
- if (top_of_thread(Context->hdrs[i]) == me)
+ if (top_of_thread(Context->mailbox->hdrs[i]) == me)
{
- struct Body *body = Context->hdrs[i]->content;
+ struct Body *body = Context->mailbox->hdrs[i]->content;
- Context->hdrs[i]->virtual = Context->vcount;
- Context->hdrs[i]->limited = true;
+ Context->mailbox->hdrs[i]->virtual = Context->vcount;
+ Context->mailbox->hdrs[i]->limited = true;
Context->v2r[Context->vcount] = i;
Context->vcount++;
Context->vsize += (body->length + body->offset - body->hdr_offset);
{
mutt_progress_update(&progress, i, -1);
/* new limit pattern implicitly uncollapses all threads */
- Context->hdrs[i]->virtual = -1;
- Context->hdrs[i]->limited = false;
- Context->hdrs[i]->collapsed = false;
- Context->hdrs[i]->num_hidden = 0;
- if (mutt_pattern_exec(pat, MUTT_MATCH_FULL_ADDRESS, Context, Context->hdrs[i], NULL))
+ Context->mailbox->hdrs[i]->virtual = -1;
+ Context->mailbox->hdrs[i]->limited = false;
+ Context->mailbox->hdrs[i]->collapsed = false;
+ Context->mailbox->hdrs[i]->num_hidden = 0;
+ if (mutt_pattern_exec(pat, MUTT_MATCH_FULL_ADDRESS, Context,
+ Context->mailbox->hdrs[i], NULL))
{
- Context->hdrs[i]->virtual = Context->vcount;
- Context->hdrs[i]->limited = true;
+ Context->mailbox->hdrs[i]->virtual = Context->vcount;
+ Context->mailbox->hdrs[i]->limited = true;
Context->v2r[Context->vcount] = i;
Context->vcount++;
- struct Body *b = Context->hdrs[i]->content;
+ struct Body *b = Context->mailbox->hdrs[i]->content;
Context->vsize += b->length + b->offset - b->hdr_offset + padding;
}
}
{
mutt_progress_update(&progress, i, -1);
if (mutt_pattern_exec(pat, MUTT_MATCH_FULL_ADDRESS, Context,
- Context->hdrs[Context->v2r[i]], NULL))
+ Context->mailbox->hdrs[Context->v2r[i]], NULL))
{
switch (op)
{
case MUTT_UNDELETE:
- mutt_set_flag(Context, Context->hdrs[Context->v2r[i]], MUTT_PURGE, 0);
+ mutt_set_flag(Context, Context->mailbox->hdrs[Context->v2r[i]], MUTT_PURGE, 0);
/* fallthrough */
case MUTT_DELETE:
- mutt_set_flag(Context, Context->hdrs[Context->v2r[i]], MUTT_DELETE,
- (op == MUTT_DELETE));
+ mutt_set_flag(Context, Context->mailbox->hdrs[Context->v2r[i]],
+ MUTT_DELETE, (op == MUTT_DELETE));
break;
case MUTT_TAG:
case MUTT_UNTAG:
- mutt_set_flag(Context, Context->hdrs[Context->v2r[i]], MUTT_TAG,
- (op == MUTT_TAG));
+ mutt_set_flag(Context, Context->mailbox->hdrs[Context->v2r[i]],
+ MUTT_TAG, (op == MUTT_TAG));
break;
}
}
if (OptSearchInvalid)
{
for (int i = 0; i < Context->mailbox->msg_count; i++)
- Context->hdrs[i]->searched = false;
+ Context->mailbox->hdrs[i]->searched = false;
#ifdef USE_IMAP
if (Context->mailbox->magic == MUTT_IMAP && imap_search(Context, SearchPattern) < 0)
return -1;
}
}
- struct Header *h = Context->hdrs[Context->v2r[i]];
+ struct Header *h = Context->mailbox->hdrs[Context->v2r[i]];
if (h->searched)
{
/* if we've already evaluated this message, use the cached value */
return -1;
for (i = 0; i < ctx->mailbox->msg_count; i++)
- if (mutt_str_strcmp(line, ctx->hdrs[i]->data) == 0)
+ if (mutt_str_strcmp(line, ctx->mailbox->hdrs[i]->data) == 0)
break;
if (i == ctx->mailbox->msg_count)
{
mutt_debug(1, "new header %d %s\n", index, line);
- if (i >= ctx->hdrmax)
+ if (i >= ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
ctx->mailbox->msg_count++;
- ctx->hdrs[i] = mutt_header_new();
- ctx->hdrs[i]->data = mutt_str_strdup(line);
+ ctx->mailbox->hdrs[i] = mutt_header_new();
+ ctx->mailbox->hdrs[i]->data = mutt_str_strdup(line);
}
- else if (ctx->hdrs[i]->index != index - 1)
+ else if (ctx->mailbox->hdrs[i]->index != index - 1)
pop_data->clear_cache = true;
- ctx->hdrs[i]->refno = index;
- ctx->hdrs[i]->index = index - 1;
+ ctx->mailbox->hdrs[i]->refno = index;
+ ctx->mailbox->hdrs[i]->index = index - 1;
return 0;
}
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
/* if the id we get is known for a header: done (i.e. keep in cache) */
- if (ctx->hdrs[i]->data && (mutt_str_strcmp(ctx->hdrs[i]->data, id) == 0))
+ if (ctx->mailbox->hdrs[i]->data &&
+ (mutt_str_strcmp(ctx->mailbox->hdrs[i]->data, id) == 0))
return 0;
}
pop_data->clear_cache = false;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
- ctx->hdrs[i]->refno = -1;
+ ctx->mailbox->hdrs[i]->refno = -1;
const int old_count = ctx->mailbox->msg_count;
int ret = pop_fetch_data(pop_data, "UIDL\r\n", NULL, fetch_uidl, ctx);
int i, deleted;
for (i = 0, deleted = 0; i < old_count; i++)
{
- if (ctx->hdrs[i]->refno == -1)
+ if (ctx->mailbox->hdrs[i]->refno == -1)
{
- ctx->hdrs[i]->deleted = true;
+ ctx->mailbox->hdrs[i]->deleted = true;
deleted++;
}
}
if (!ctx->quiet)
mutt_progress_update(&progress, i + 1 - old_count, -1);
#ifdef USE_HCACHE
- void *data = mutt_hcache_fetch(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data));
+ void *data = mutt_hcache_fetch(hc, ctx->mailbox->hdrs[i]->data,
+ strlen(ctx->mailbox->hdrs[i]->data));
if (data)
{
- char *uidl = mutt_str_strdup(ctx->hdrs[i]->data);
- int refno = ctx->hdrs[i]->refno;
- int index = ctx->hdrs[i]->index;
+ char *uidl = mutt_str_strdup(ctx->mailbox->hdrs[i]->data);
+ int refno = ctx->mailbox->hdrs[i]->refno;
+ int index = ctx->mailbox->hdrs[i]->index;
/* - POP dynamically numbers headers and relies on h->refno
* to map messages; so restore header and overwrite restored
* refno with current refno, same for index
*/
struct Header *h = mutt_hcache_restore((unsigned char *) data);
mutt_hcache_free(hc, &data);
- mutt_header_free(&ctx->hdrs[i]);
- ctx->hdrs[i] = h;
- ctx->hdrs[i]->refno = refno;
- ctx->hdrs[i]->index = index;
- ctx->hdrs[i]->data = uidl;
+ mutt_header_free(&ctx->mailbox->hdrs[i]);
+ ctx->mailbox->hdrs[i] = h;
+ ctx->mailbox->hdrs[i]->refno = refno;
+ ctx->mailbox->hdrs[i]->index = index;
+ ctx->mailbox->hdrs[i]->data = uidl;
ret = 0;
hcached = true;
}
else
#endif
- if ((ret = pop_read_header(pop_data, ctx->hdrs[i])) < 0)
+ if ((ret = pop_read_header(pop_data, ctx->mailbox->hdrs[i])) < 0)
break;
#ifdef USE_HCACHE
else
{
- mutt_hcache_store(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data),
- ctx->hdrs[i], 0);
+ mutt_hcache_store(hc, ctx->mailbox->hdrs[i]->data,
+ strlen(ctx->mailbox->hdrs[i]->data), ctx->mailbox->hdrs[i], 0);
}
#endif
* - if we don't have a body: new
*/
const bool bcached =
- (mutt_bcache_exists(pop_data->bcache, cache_id(ctx->hdrs[i]->data)) == 0);
- ctx->hdrs[i]->old = false;
- ctx->hdrs[i]->read = false;
+ (mutt_bcache_exists(pop_data->bcache, cache_id(ctx->mailbox->hdrs[i]->data)) == 0);
+ ctx->mailbox->hdrs[i]->old = false;
+ ctx->mailbox->hdrs[i]->read = false;
if (hcached)
{
if (bcached)
- ctx->hdrs[i]->read = true;
+ ctx->mailbox->hdrs[i]->read = true;
else if (MarkOld)
- ctx->hdrs[i]->old = true;
+ ctx->mailbox->hdrs[i]->old = true;
}
else
{
if (bcached)
- ctx->hdrs[i]->read = true;
+ ctx->mailbox->hdrs[i]->read = true;
}
ctx->mailbox->msg_count++;
if (ret < 0)
{
for (int i = ctx->mailbox->msg_count; i < new_count; i++)
- mutt_header_free(&ctx->hdrs[i]);
+ mutt_header_free(&ctx->mailbox->hdrs[i]);
return ret;
}
struct Progress progressbar;
struct PopData *pop_data = ctx->mailbox->data;
struct PopCache *cache = NULL;
- struct Header *h = ctx->hdrs[msgno];
+ struct Header *h = ctx->mailbox->hdrs[msgno];
unsigned short bcache = 1;
/* see if we already have the message in body cache */
fgets(buf, sizeof(buf), msg->fp);
while (!feof(msg->fp))
{
- ctx->hdrs[msgno]->lines++;
+ ctx->mailbox->hdrs[msgno]->lines++;
fgets(buf, sizeof(buf), msg->fp);
}
for (i = 0, j = 0, ret = 0; ret == 0 && i < ctx->mailbox->msg_count; i++)
{
- if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->refno != -1)
+ if (ctx->mailbox->hdrs[i]->deleted && ctx->mailbox->hdrs[i]->refno != -1)
{
j++;
if (!ctx->quiet)
mutt_progress_update(&progress, j, -1);
- snprintf(buf, sizeof(buf), "DELE %d\r\n", ctx->hdrs[i]->refno);
+ snprintf(buf, sizeof(buf), "DELE %d\r\n", ctx->mailbox->hdrs[i]->refno);
ret = pop_query(pop_data, buf, sizeof(buf));
if (ret == 0)
{
- mutt_bcache_del(pop_data->bcache, cache_id(ctx->hdrs[i]->data));
+ mutt_bcache_del(pop_data->bcache, cache_id(ctx->mailbox->hdrs[i]->data));
#ifdef USE_HCACHE
- mutt_hcache_delete(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data));
+ mutt_hcache_delete(hc, ctx->mailbox->hdrs[i]->data,
+ strlen(ctx->mailbox->hdrs[i]->data));
#endif
}
}
#ifdef USE_HCACHE
- if (ctx->hdrs[i]->changed)
+ if (ctx->mailbox->hdrs[i]->changed)
{
- mutt_hcache_store(hc, ctx->hdrs[i]->data, strlen(ctx->hdrs[i]->data),
- ctx->hdrs[i], 0);
+ mutt_hcache_store(hc, ctx->mailbox->hdrs[i]->data,
+ strlen(ctx->mailbox->hdrs[i]->data), ctx->mailbox->hdrs[i], 0);
}
#endif
}
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (mutt_str_strcmp(ctx->hdrs[i]->data, line) == 0)
+ if (mutt_str_strcmp(ctx->mailbox->hdrs[i]->data, line) == 0)
{
- ctx->hdrs[i]->refno = index;
+ ctx->mailbox->hdrs[i]->refno = index;
break;
}
}
MUTT_PROGRESS_SIZE, NetInc, 0);
for (int i = 0; i < ctx->mailbox->msg_count; i++)
- ctx->hdrs[i]->refno = -1;
+ ctx->mailbox->hdrs[i]->refno = -1;
ret = pop_fetch_data(pop_data, "UIDL\r\n", &progressbar, check_uidl, ctx);
if (ret == -2)
{
struct Context *ctx = menu->data;
- mutt_make_string_flags(buf, buflen, NONULL(IndexFormat), ctx, ctx->hdrs[num],
- MUTT_FORMAT_ARROWCURSOR);
+ mutt_make_string_flags(buf, buflen, NONULL(IndexFormat), ctx,
+ ctx->mailbox->hdrs[num], MUTT_FORMAT_ARROWCURSOR);
}
/**
case OP_DELETE:
case OP_UNDELETE:
/* should deleted draft messages be saved in the trash folder? */
- mutt_set_flag(PostContext, PostContext->hdrs[menu->current],
+ mutt_set_flag(PostContext, PostContext->mailbox->hdrs[menu->current],
MUTT_DELETE, (i == OP_DELETE) ? 1 : 0);
PostCount = PostContext->mailbox->msg_count - PostContext->deleted;
if (Resolve && menu->current < menu->max - 1)
Sort = orig_sort;
mutt_menu_pop_current(menu);
mutt_menu_destroy(&menu);
- return r > -1 ? PostContext->hdrs[r] : NULL;
+ return r > -1 ? PostContext->mailbox->hdrs[r] : NULL;
}
/**
if (PostContext->mailbox->msg_count == 1)
{
/* only one message, so just use that one. */
- h = PostContext->hdrs[0];
+ h = PostContext->mailbox->hdrs[0];
}
else if (!(h = select_msg()))
{
for (int i = 0; ctx && i < ctx->mailbox->msg_count; i++)
{
- mutt_score_message(ctx, ctx->hdrs[i], true);
- ctx->hdrs[i]->pair = 0;
+ mutt_score_message(ctx, ctx->mailbox->hdrs[i], true);
+ ctx->mailbox->hdrs[i]->pair = 0;
}
}
OptNeedRescore = false;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
if (message_is_tagged(ctx, i))
- mutt_add_to_reference_headers(env, ctx->hdrs[i]->env);
+ mutt_add_to_reference_headers(env, ctx->mailbox->hdrs[i]->env);
}
}
else
if (!message_is_tagged(ctx, i))
continue;
- cur = ctx->hdrs[i];
+ cur = ctx->mailbox->hdrs[i];
curenv = cur->env;
break;
}
if (!message_is_tagged(ctx, i))
continue;
- if (mutt_fetch_recips(env, ctx->hdrs[i]->env, flags) == -1)
+ if (mutt_fetch_recips(env, ctx->mailbox->hdrs[i]->env, flags) == -1)
return -1;
}
}
if (!message_is_tagged(ctx, i))
continue;
- if (include_reply(ctx, ctx->hdrs[i], tempfp) == -1)
+ if (include_reply(ctx, ctx->mailbox->hdrs[i], tempfp) == -1)
{
mutt_error(_("Could not include all requested messages"));
return -1;
if (!message_is_tagged(ctx, i))
continue;
- tmp = mutt_make_message_attach(ctx, ctx->hdrs[i], false);
+ tmp = mutt_make_message_attach(ctx, ctx->mailbox->hdrs[i], false);
if (last)
{
last->next = tmp;
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (message_is_tagged(ctx, i))
- include_forward(ctx, ctx->hdrs[i], tempfp);
+ include_forward(ctx, ctx->mailbox->hdrs[i], tempfp);
}
}
}
{
if (message_is_tagged(ctx, i))
{
- mutt_set_flag(ctx, ctx->hdrs[i], MUTT_REPLIED, is_reply(ctx->hdrs[i], msg));
+ mutt_set_flag(ctx, ctx->mailbox->hdrs[i], MUTT_REPLIED,
+ is_reply(ctx->mailbox->hdrs[i], msg));
}
}
}
/* Try to bounce each message out, aborting if we get any failures. */
for (int i = 0; i < Context->mailbox->msg_count; i++)
if (message_is_tagged(Context, i))
- rc |= bounce_message(fp, Context->hdrs[i], to, resent_from, env_from);
+ rc |= bounce_message(fp, Context->mailbox->hdrs[i], to, resent_from, env_from);
return rc;
}
if (OptNeedRescore && Score)
{
for (int i = 0; i < ctx->mailbox->msg_count; i++)
- mutt_score_message(ctx, ctx->hdrs[i], true);
+ mutt_score_message(ctx, ctx->mailbox->hdrs[i], true);
}
OptNeedRescore = false;
return;
}
else
- qsort((void *) ctx->hdrs, ctx->mailbox->msg_count, sizeof(struct Header *), sortfunc);
+ qsort((void *) ctx->mailbox->hdrs, ctx->mailbox->msg_count,
+ sizeof(struct Header *), sortfunc);
/* adjust the virtual message numbers */
ctx->vcount = 0;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- struct Header *cur = ctx->hdrs[i];
+ struct Header *cur = ctx->mailbox->hdrs[i];
if (cur->virtual != -1 || (cur->collapsed && (!ctx->pattern || cur->limited)))
{
cur->virtual = ctx->vcount;