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->mailbox->hdrs[i]->pair = 0;
+ Context->mailbox->emails[i]->pair = 0;
}
return 0;
}
if (is_index)
{
for (int i = 0; Context && i < Context->mailbox->msg_count; i++)
- Context->mailbox->hdrs[i]->pair = 0;
+ Context->mailbox->emails[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->mailbox->hdrs[rc]->env->from)
+ if (message_is_tagged(Context, rc) && !Context->mailbox->emails[rc]->env->from)
{
msgcount++;
- if (!Context->mailbox->hdrs[rc]->env->from)
+ if (!Context->mailbox->emails[rc]->env->from)
{
mutt_error(_("Warning: message contains no From: header"));
break;
if (!message_is_tagged(Context, i))
continue;
- mutt_message_hook(Context->mailbox, Context->mailbox->hdrs[i], MUTT_MESSAGE_HOOK);
- mutt_parse_mime_message(Context->mailbox, Context->mailbox->hdrs[i]);
- if (Context->mailbox->hdrs[i]->security & ENCRYPT &&
- !crypt_valid_passphrase(Context->mailbox->hdrs[i]->security))
+ mutt_message_hook(Context->mailbox, Context->mailbox->emails[i], MUTT_MESSAGE_HOOK);
+ mutt_parse_mime_message(Context->mailbox, Context->mailbox->emails[i]);
+ if (Context->mailbox->emails[i]->security & ENCRYPT &&
+ !crypt_valid_passphrase(Context->mailbox->emails[i]->security))
{
return 1;
}
if (!message_is_tagged(Context, i))
continue;
- mutt_message_hook(Context->mailbox, Context->mailbox->hdrs[i], MUTT_MESSAGE_HOOK);
+ mutt_message_hook(Context->mailbox, Context->mailbox->emails[i], MUTT_MESSAGE_HOOK);
mutt_endwin();
thepid = mutt_create_filter(cmd, &fpout, NULL, NULL);
if (thepid < 0)
return 1;
}
OptKeepQuiet = true;
- pipe_msg(Context->mailbox->hdrs[i], fpout, decode, print);
+ pipe_msg(Context->mailbox->emails[i], fpout, decode, print);
/* add the message separator */
if (sep)
fputs(sep, fpout);
if (!message_is_tagged(Context, i))
continue;
- mutt_message_hook(Context->mailbox, Context->mailbox->hdrs[i], MUTT_MESSAGE_HOOK);
- pipe_msg(Context->mailbox->hdrs[i], fpout, decode, print);
+ mutt_message_hook(Context->mailbox, Context->mailbox->emails[i], MUTT_MESSAGE_HOOK);
+ pipe_msg(Context->mailbox->emails[i], fpout, decode, print);
/* add the message separator */
if (sep)
fputs(sep, fpout);
{
if (message_is_tagged(Context, i))
{
- e = Context->mailbox->hdrs[i];
+ e = Context->mailbox->emails[i];
break;
}
}
if (!message_is_tagged(Context, i))
continue;
- mutt_message_hook(Context->mailbox, Context->mailbox->hdrs[i], MUTT_MESSAGE_HOOK);
- rc = mutt_save_message_ctx(Context->mailbox->hdrs[i], delete, decode,
+ mutt_message_hook(Context->mailbox, Context->mailbox->emails[i], MUTT_MESSAGE_HOOK);
+ rc = mutt_save_message_ctx(Context->mailbox->emails[i], delete, decode,
decrypt, savectx->mailbox);
if (rc != 0)
break;
#ifdef USE_COMPRESSED
if (cm)
{
- struct Email *e2 = Context->mailbox->hdrs[i];
+ struct Email *e2 = Context->mailbox->emails[i];
cm->msg_count++;
if (!e2->read)
{
for (int i = 0; i < Context->mailbox->msg_count; i++)
{
if (message_is_tagged(Context, i) &&
- !(Context->mailbox->hdrs[i]->security & PGP_TRADITIONAL_CHECKED))
+ !(Context->mailbox->emails[i]->security & PGP_TRADITIONAL_CHECKED))
{
- rc = check_traditional_pgp(Context->mailbox->hdrs[i], redraw) || rc;
+ rc = check_traditional_pgp(Context->mailbox->emails[i], redraw) || rc;
}
}
}
new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
new->content = mutt_make_message_attach(Context->mailbox,
- Context->mailbox->hdrs[i], true);
+ Context->mailbox->emails[i], true);
if (new->content)
update_idx(menu, actx, new);
else
/**
* message_is_visible - Is a message in the index within limit
* @param ctx Open mailbox
- * @param index Message ID (index into `ctx->hdrs[]`
+ * @param index Message ID (index into `ctx->emails[]`
* @retval true 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->mailbox->hdrs || (index >= ctx->mailbox->msg_count))
+ if (!ctx || !ctx->mailbox->emails || (index >= ctx->mailbox->msg_count))
return false;
- return !ctx->pattern || ctx->mailbox->hdrs[index]->limited;
+ return !ctx->pattern || ctx->mailbox->emails[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[]`
+ * @param index Message ID (index into `ctx->emails[]`
* @retval true 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->mailbox->hdrs[index]->tagged;
+ return message_is_visible(ctx, index) && ctx->mailbox->emails[index]->tagged;
}
{
setlocale(LC_TIME, NONULL(AttributionLocale));
mutt_make_string(tmp, sizeof(tmp) - 1, Attribution, Context,
- Context->mailbox->hdrs[n]);
+ Context->mailbox->emails[n]);
setlocale(LC_TIME, "");
strcat(tmp, "\n");
}
#if 0
/* This only worked for mbox Mailboxes because they had Context->fp set.
* As that no longer exists, the code is now completely broken. */
- bytes = Context->mailbox->hdrs[n]->content->length;
+ bytes = Context->mailbox->emails[n]->content->length;
if (inc_hdrs)
{
- offset = Context->mailbox->hdrs[n]->offset;
- bytes += Context->mailbox->hdrs[n]->content->offset - offset;
+ offset = Context->mailbox->emails[n]->offset;
+ bytes += Context->mailbox->emails[n]->content->offset - offset;
}
else
- offset = Context->mailbox->hdrs[n]->content->offset;
+ offset = Context->mailbox->emails[n]->content->offset;
buf = be_snarf_data(Context->fp, buf, bufmax, buflen, offset, bytes, pfx);
#endif
if (!message_is_tagged(ctx, i))
continue;
- if (edit_or_view_one_message(edit, ctx->mailbox, ctx->mailbox->hdrs[i]) == -1)
+ if (edit_or_view_one_message(edit, ctx->mailbox, ctx->mailbox->emails[i]) == -1)
return -1;
}
{
for (int i = 0; i < Context->mailbox->msg_count; i++)
if (message_is_tagged(Context, i))
- mutt_set_flag(Context->mailbox, Context->mailbox->hdrs[i], flag, bf);
+ mutt_set_flag(Context->mailbox, Context->mailbox->emails[i], flag, bf);
}
/**
if (!adata || adata->mailbox != m)
return -1;
- struct Email **emails = m->hdrs;
+ struct Email **emails = m->emails;
for (n = *pos; n < m->msg_count && buf->dptr - buf->data < IMAP_MAX_CMDLEN; n++)
{
for (int i = 0; i < m->msg_count; i++)
{
- e = m->hdrs[i];
+ e = m->emails[i];
if (e->index == INT_MAX)
{
oldsort = Sort;
if (Sort != SORT_ORDER)
{
- emails = m->hdrs;
- m->hdrs = mutt_mem_malloc(m->msg_count * sizeof(struct Email *));
- memcpy(m->hdrs, emails, m->msg_count * sizeof(struct Email *));
+ emails = m->emails;
+ m->emails = mutt_mem_malloc(m->msg_count * sizeof(struct Email *));
+ memcpy(m->emails, emails, m->msg_count * sizeof(struct Email *));
Sort = SORT_ORDER;
- qsort(m->hdrs, m->msg_count, sizeof(struct Email *), mutt_get_sort_func(SORT_ORDER));
+ qsort(m->emails, m->msg_count, sizeof(struct Email *), mutt_get_sort_func(SORT_ORDER));
}
pos = 0;
if (oldsort != Sort)
{
Sort = oldsort;
- FREE(&m->hdrs);
- m->hdrs = emails;
+ FREE(&m->emails);
+ m->emails = emails;
}
return rc;
struct Buffer buf;
struct ImapAccountData *adata = imap_adata_get(m);
for (int i = 0; i < m->msg_count; i++)
- m->hdrs[i]->matched = false;
+ m->emails[i]->matched = false;
if (do_search(pat, 1) == 0)
return 0;
for (int i = 0; i < m->msg_count; i++)
{
- if (m->hdrs[i]->active && m->hdrs[i]->changed && m->hdrs[i]->deleted &&
- !m->hdrs[i]->purge)
+ if (m->emails[i]->active && m->emails[i]->changed &&
+ m->emails[i]->deleted && !m->emails[i]->purge)
{
- rc = imap_sync_message_for_copy(m, m->hdrs[i], sync_cmd, &err_continue);
+ rc = imap_sync_message_for_copy(m, m->emails[i], sync_cmd, &err_continue);
if (rc < 0)
{
mutt_debug(1, "could not sync\n");
/* 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 < m->msg_count; i++)
- if (m->hdrs[i]->deleted && m->hdrs[i]->changed)
- m->hdrs[i]->active = false;
+ if (m->emails[i]->deleted && m->emails[i]->changed)
+ m->emails[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 < m->msg_count; i++)
{
- e = m->hdrs[i];
+ e = m->emails[i];
if (e->deleted)
{
oldsort = Sort;
if (Sort != SORT_ORDER)
{
- emails = m->hdrs;
- m->hdrs = mutt_mem_malloc(m->msg_count * sizeof(struct Email *));
- memcpy(m->hdrs, emails, m->msg_count * sizeof(struct Email *));
+ emails = m->emails;
+ m->emails = mutt_mem_malloc(m->msg_count * sizeof(struct Email *));
+ memcpy(m->emails, emails, m->msg_count * sizeof(struct Email *));
Sort = SORT_ORDER;
- qsort(m->hdrs, m->msg_count, sizeof(struct Email *), mutt_get_sort_func(SORT_ORDER));
+ qsort(m->emails, m->msg_count, sizeof(struct Email *), mutt_get_sort_func(SORT_ORDER));
}
rc = sync_helper(m, MUTT_ACL_DELETE, MUTT_DELETED, "\\Deleted");
if (oldsort != Sort)
{
Sort = oldsort;
- FREE(&m->hdrs);
- m->hdrs = emails;
+ FREE(&m->emails);
+ m->emails = emails;
}
/* 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 < m->msg_count; i++)
{
- struct ImapEmailData *edata = imap_edata_get(m->hdrs[i]);
- edata->deleted = m->hdrs[i]->deleted;
- edata->flagged = m->hdrs[i]->flagged;
- edata->old = m->hdrs[i]->old;
- edata->read = m->hdrs[i]->read;
- edata->replied = m->hdrs[i]->replied;
- m->hdrs[i]->changed = false;
+ struct ImapEmailData *edata = imap_edata_get(m->emails[i]);
+ edata->deleted = m->emails[i]->deleted;
+ edata->flagged = m->emails[i]->flagged;
+ edata->old = m->emails[i]->old;
+ edata->read = m->emails[i]->read;
+ edata->replied = m->emails[i]->replied;
+ m->emails[i]->changed = false;
}
m->changed = false;
}
m->hdrmax = count;
- m->hdrs = mutt_mem_calloc(count, sizeof(struct Email *));
+ m->emails = mutt_mem_calloc(count, sizeof(struct Email *));
m->v2r = mutt_mem_calloc(count, sizeof(int));
m->msg_count = 0;
m->msg_unread = 0;
continue;
}
- m->hdrs[idx] = imap_hcache_get(mdata, h.data->uid);
- if (m->hdrs[idx])
+ m->emails[idx] = imap_hcache_get(mdata, h.data->uid);
+ if (m->emails[idx])
{
mdata->max_msn = MAX(mdata->max_msn, h.data->msn);
- mdata->msn_index[h.data->msn - 1] = m->hdrs[idx];
- mutt_hash_int_insert(mdata->uid_hash, h.data->uid, m->hdrs[idx]);
+ mdata->msn_index[h.data->msn - 1] = m->emails[idx];
+ mutt_hash_int_insert(mdata->uid_hash, h.data->uid, m->emails[idx]);
- m->hdrs[idx]->index = idx;
+ m->emails[idx]->index = idx;
/* messages which have not been expunged are ACTIVE (borrowed from mh
* folders) */
- m->hdrs[idx]->active = true;
- m->hdrs[idx]->changed = false;
+ m->emails[idx]->active = true;
+ m->emails[idx]->changed = false;
if (!eval_condstore)
{
- m->hdrs[idx]->read = h.data->read;
- m->hdrs[idx]->old = h.data->old;
- m->hdrs[idx]->deleted = h.data->deleted;
- m->hdrs[idx]->flagged = h.data->flagged;
- m->hdrs[idx]->replied = h.data->replied;
+ m->emails[idx]->read = h.data->read;
+ m->emails[idx]->old = h.data->old;
+ m->emails[idx]->deleted = h.data->deleted;
+ m->emails[idx]->flagged = h.data->flagged;
+ m->emails[idx]->replied = h.data->replied;
}
else
{
- h.data->read = m->hdrs[idx]->read;
- h.data->old = m->hdrs[idx]->old;
- h.data->deleted = m->hdrs[idx]->deleted;
- h.data->flagged = m->hdrs[idx]->flagged;
- h.data->replied = m->hdrs[idx]->replied;
+ h.data->read = m->emails[idx]->read;
+ h.data->old = m->emails[idx]->old;
+ h.data->deleted = m->emails[idx]->deleted;
+ h.data->flagged = m->emails[idx]->flagged;
+ h.data->replied = m->emails[idx]->replied;
}
- /* mailbox->hdrs[msgno]->received is restored from mutt_hcache_restore */
- m->hdrs[idx]->edata = h.data;
- m->hdrs[idx]->free_edata = imap_edata_free;
- STAILQ_INIT(&m->hdrs[idx]->tags);
+ /* mailbox->emails[msgno]->received is restored from mutt_hcache_restore */
+ m->emails[idx]->edata = h.data;
+ m->emails[idx]->free_edata = imap_edata_free;
+ STAILQ_INIT(&m->emails[idx]->tags);
/* We take a copy of the tags so we can split the string */
char *tags_copy = mutt_str_strdup(h.data->flags_remote);
- driver_tags_replace(&m->hdrs[idx]->tags, tags_copy);
+ driver_tags_replace(&m->emails[idx]->tags, tags_copy);
FREE(&tags_copy);
m->msg_count++;
- m->size += m->hdrs[idx]->content->length;
+ m->size += m->emails[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(mdata, m->hdrs[idx]);
+ imap_hcache_put(mdata, m->emails[idx]);
h.data = NULL;
idx++;
mutt_hash_int_insert(mdata->uid_hash, uid, e);
m->size += e->content->length;
- m->hdrs[m->msg_count++] = e;
+ m->emails[m->msg_count++] = e;
msn++;
}
continue;
}
- m->hdrs[idx] = mutt_email_new();
+ m->emails[idx] = mutt_email_new();
mdata->max_msn = MAX(mdata->max_msn, h.data->msn);
- mdata->msn_index[h.data->msn - 1] = m->hdrs[idx];
- mutt_hash_int_insert(mdata->uid_hash, h.data->uid, m->hdrs[idx]);
+ mdata->msn_index[h.data->msn - 1] = m->emails[idx];
+ mutt_hash_int_insert(mdata->uid_hash, h.data->uid, m->emails[idx]);
- m->hdrs[idx]->index = idx;
+ m->emails[idx]->index = idx;
/* messages which have not been expunged are ACTIVE (borrowed from mh
* folders) */
- m->hdrs[idx]->active = true;
- m->hdrs[idx]->changed = false;
- m->hdrs[idx]->read = h.data->read;
- m->hdrs[idx]->old = h.data->old;
- m->hdrs[idx]->deleted = h.data->deleted;
- m->hdrs[idx]->flagged = h.data->flagged;
- m->hdrs[idx]->replied = h.data->replied;
- m->hdrs[idx]->received = h.received;
- m->hdrs[idx]->edata = (void *) (h.data);
- m->hdrs[idx]->free_edata = imap_edata_free;
- STAILQ_INIT(&m->hdrs[idx]->tags);
+ m->emails[idx]->active = true;
+ m->emails[idx]->changed = false;
+ m->emails[idx]->read = h.data->read;
+ m->emails[idx]->old = h.data->old;
+ m->emails[idx]->deleted = h.data->deleted;
+ m->emails[idx]->flagged = h.data->flagged;
+ m->emails[idx]->replied = h.data->replied;
+ m->emails[idx]->received = h.received;
+ m->emails[idx]->edata = (void *) (h.data);
+ m->emails[idx]->free_edata = imap_edata_free;
+ STAILQ_INIT(&m->emails[idx]->tags);
/* We take a copy of the tags so we can split the string */
char *tags_copy = mutt_str_strdup(h.data->flags_remote);
- driver_tags_replace(&m->hdrs[idx]->tags, tags_copy);
+ driver_tags_replace(&m->emails[idx]->tags, tags_copy);
FREE(&tags_copy);
if (*maxuid < h.data->uid)
rewind(fp);
/* NOTE: if Date: header is missing, mutt_rfc822_read_header depends
* on h.received being set */
- m->hdrs[idx]->env = mutt_rfc822_read_header(fp, m->hdrs[idx], false, false);
+ m->emails[idx]->env = mutt_rfc822_read_header(fp, m->emails[idx], false, false);
/* content built as a side-effect of mutt_rfc822_read_header */
- m->hdrs[idx]->content->length = h.content_length;
+ m->emails[idx]->content->length = h.content_length;
m->size += h.content_length;
#ifdef USE_HCACHE
- imap_hcache_put(mdata, m->hdrs[idx]);
+ imap_hcache_put(mdata, m->emails[idx]);
#endif /* USE_HCACHE */
m->msg_count++;
if (!message_is_tagged(ctx, i))
continue;
- if (m->hdrs[i]->attach_del)
+ if (m->emails[i]->attach_del)
{
mutt_debug(3, "#2 Message contains attachments to be deleted\n");
return 1;
}
- if (m->hdrs[i]->active && m->hdrs[i]->changed)
+ if (m->emails[i]->active && m->emails[i]->changed)
{
- rc = imap_sync_message_for_copy(m, m->hdrs[i], &sync_cmd, &err_continue);
+ rc = imap_sync_message_for_copy(m, m->emails[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(m, m->hdrs[i], MUTT_DELETE, 1);
- mutt_set_flag(m, m->hdrs[i], MUTT_PURGE, 1);
+ mutt_set_flag(m, m->emails[i], MUTT_DELETE, 1);
+ mutt_set_flag(m, m->emails[i], MUTT_PURGE, 1);
if (DeleteUntag)
- mutt_set_flag(m, m->hdrs[i], MUTT_TAG, 0);
+ mutt_set_flag(m, m->emails[i], MUTT_TAG, 0);
}
}
else
if (!adata || adata->mailbox != m)
return -1;
- struct Email *e = m->hdrs[msgno];
+ struct Email *e = m->emails[msgno];
msg->fp = msg_cache_get(m, e);
if (msg->fp)
break; \
}
-#define CURHDR Context->mailbox->hdrs[Context->mailbox->v2r[menu->current]]
+#define CURHDR Context->mailbox->emails[Context->mailbox->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->mailbox->hdrs[Context->mailbox->v2r[final]];
+ base = Context->mailbox->emails[Context->mailbox->v2r[final]];
/* Iterate all threads, perform collapse/uncollapse as needed */
top = Context->tree;
mutt_set_virtual(Context);
for (int j = 0; j < Context->mailbox->vcount; j++)
{
- if (Context->mailbox->hdrs[Context->mailbox->v2r[j]]->index == base->index)
+ if (Context->mailbox->emails[Context->mailbox->v2r[j]]->index == base->index)
{
menu->current = j;
break;
static int ci_next_undeleted(int msgno)
{
for (int i = msgno + 1; i < Context->mailbox->vcount; i++)
- if (!Context->mailbox->hdrs[Context->mailbox->v2r[i]]->deleted)
+ if (!Context->mailbox->emails[Context->mailbox->v2r[i]]->deleted)
return i;
return -1;
}
static int ci_previous_undeleted(int msgno)
{
for (int i = msgno - 1; i >= 0; i--)
- if (!Context->mailbox->hdrs[Context->mailbox->v2r[i]]->deleted)
+ if (!Context->mailbox->emails[Context->mailbox->v2r[i]]->deleted)
return i;
return -1;
}
int old = -1;
for (int i = 0; i < Context->mailbox->vcount; i++)
{
- if (!Context->mailbox->hdrs[Context->mailbox->v2r[i]]->read &&
- !Context->mailbox->hdrs[Context->mailbox->v2r[i]]->deleted)
+ if (!Context->mailbox->emails[Context->mailbox->v2r[i]]->read &&
+ !Context->mailbox->emails[Context->mailbox->v2r[i]]->deleted)
{
- if (!Context->mailbox->hdrs[Context->mailbox->v2r[i]]->old)
+ if (!Context->mailbox->emails[Context->mailbox->v2r[i]]->old)
return i;
else if (old == -1)
old = i;
for (int i = 0; i < Context->mailbox->vcount; i++)
{
- if (Context->mailbox->hdrs[Context->mailbox->v2r[i]] == current)
+ if (Context->mailbox->emails[Context->mailbox->v2r[i]] == current)
{
menu->current = i;
break;
{
save_new = mutt_mem_malloc(sizeof(struct Email *) * (ctx->mailbox->msg_count - oldcount));
for (int i = oldcount; i < ctx->mailbox->msg_count; i++)
- save_new[i - oldcount] = ctx->mailbox->hdrs[i];
+ save_new[i - oldcount] = ctx->mailbox->emails[i];
}
/* Sort first to thread the new messages, because some patterns
if ((check != MUTT_REOPENED) && oldcount)
e = save_new[i - oldcount];
else
- e = ctx->mailbox->hdrs[i];
+ e = ctx->mailbox->emails[i];
if (mutt_pattern_exec(ctx->limit_pattern, MUTT_MATCH_FULL_ADDRESS, ctx->mailbox, e, NULL))
{
}
if (mutt_pattern_exec(ctx->limit_pattern, MUTT_MATCH_FULL_ADDRESS,
- ctx->mailbox, ctx->mailbox->hdrs[i], NULL))
+ ctx->mailbox, ctx->mailbox->emails[i], NULL))
{
assert(ctx->mailbox->vcount < ctx->mailbox->msg_count);
- ctx->mailbox->hdrs[i]->virtual = ctx->mailbox->vcount;
+ ctx->mailbox->emails[i]->virtual = ctx->mailbox->vcount;
ctx->mailbox->v2r[ctx->mailbox->vcount] = i;
- ctx->mailbox->hdrs[i]->limited = true;
+ ctx->mailbox->emails[i]->limited = true;
ctx->mailbox->vcount++;
- struct Body *b = ctx->mailbox->hdrs[i]->content;
+ struct Body *b = ctx->mailbox->emails[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->mailbox->vcount; i++)
{
- if (ctx->mailbox->hdrs[ctx->mailbox->v2r[i]]->index == menu->oldcurrent)
+ if (ctx->mailbox->emails[ctx->mailbox->v2r[i]]->index == menu->oldcurrent)
{
menu->current = i;
break;
if (!Context || !menu || (line < 0) || (line >= Context->mailbox->hdrmax))
return;
- struct Email *e = Context->mailbox->hdrs[Context->mailbox->v2r[line]];
+ struct Email *e = Context->mailbox->emails[Context->mailbox->v2r[line]];
if (!e)
return;
if (!Context || (line < 0))
return 0;
- struct Email *e = Context->mailbox->hdrs[Context->mailbox->v2r[line]];
+ struct Email *e = Context->mailbox->emails[Context->mailbox->v2r[line]];
if (e && e->pair)
return e->pair;
menu_redraw_sidebar(menu);
#endif
- if (Context && Context->mailbox->hdrs && !(menu->current >= Context->mailbox->vcount))
+ if (Context && Context->mailbox->emails && !(menu->current >= Context->mailbox->vcount))
{
menu_check_recenter(menu);
{
for (i = oldcount; i < Context->mailbox->msg_count; i++)
{
- if (!Context->mailbox->hdrs[i]->read)
+ if (!Context->mailbox->emails[i]->read)
{
mutt_message(_("New mail in this mailbox"));
if (BeepNew)
rc2 = nntp_check_msgid(Context, buf);
if (rc2 == 0)
{
- e = Context->mailbox->hdrs[Context->mailbox->msg_count - 1];
+ e = Context->mailbox->emails[Context->mailbox->msg_count - 1];
mutt_sort_headers(Context, false);
menu->current = e->virtual;
menu->redraw = REDRAW_FULL;
{
for (int k = 0; k < Context->mailbox->msg_count; k++)
{
- if (Context->mailbox->hdrs[k]->index == oldindex)
+ if (Context->mailbox->emails[k]->index == oldindex)
{
- menu->current = Context->mailbox->hdrs[k]->virtual;
+ menu->current = Context->mailbox->emails[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 Email *e = Context->mailbox->hdrs[i - 1];
+ struct Email *e = Context->mailbox->emails[i - 1];
if (mutt_messages_in_thread(Context->mailbox, e, 1) > 1)
{
menu->current = -1;
for (i = 0; i < Context->mailbox->vcount; i++)
{
- if (Context->mailbox->hdrs[Context->mailbox->v2r[i]]->index == menu->oldcurrent)
+ if (Context->mailbox->emails[Context->mailbox->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->mailbox, Context->mailbox->hdrs[j], MUTT_TAG, 0);
+ mutt_set_flag(Context->mailbox, Context->mailbox->emails[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->mailbox->hdrs[Context->mailbox->v2r[newidx]];
+ newhdr = Context->mailbox->emails[Context->mailbox->v2r[newidx]];
}
check = mx_mbox_sync(Context, &index_hint);
{
for (j = 0; j < Context->mailbox->vcount; j++)
{
- if (Context->mailbox->hdrs[Context->mailbox->v2r[j]] == newhdr)
+ if (Context->mailbox->emails[Context->mailbox->v2r[j]] == newhdr)
{
menu->current = j;
break;
{
if (message_is_tagged(Context, j))
{
- Context->mailbox->hdrs[j]->quasi_deleted = true;
+ Context->mailbox->emails[j]->quasi_deleted = true;
Context->mailbox->changed = true;
}
}
if (!Context->mailbox->quiet)
mutt_progress_update(&progress, ++px, -1);
- mx_tags_commit(Context->mailbox, Context->mailbox->hdrs[j], buf);
+ mx_tags_commit(Context->mailbox, Context->mailbox->emails[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->mailbox, Context->mailbox->hdrs[j]);
+ Context->mailbox, Context->mailbox->emails[j]);
#endif
- Context->mailbox->hdrs[j]->quasi_deleted = !still_queried;
+ Context->mailbox->emails[j]->quasi_deleted = !still_queried;
Context->mailbox->changed = true;
}
}
{
mutt_check_traditional_pgp(tag ? NULL : CURHDR, &menu->redraw);
}
- int hint = Context->mailbox->hdrs[Context->mailbox->v2r[menu->current]]->index;
+ int hint =
+ Context->mailbox->emails[Context->mailbox->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 Email *e = Context->mailbox->hdrs[Context->mailbox->v2r[i]];
+ struct Email *e = Context->mailbox->emails[Context->mailbox->v2r[i]];
if (e->collapsed && (Sort & SORT_MASK) == SORT_THREADS)
{
if (UNREAD(e) && first_unread == -1)
{
if (message_is_tagged(Context, j))
{
- mutt_set_flag(Context->mailbox, Context->mailbox->hdrs[j],
- MUTT_FLAG, !Context->mailbox->hdrs[j]->flagged);
+ mutt_set_flag(Context->mailbox, Context->mailbox->emails[j],
+ MUTT_FLAG, !Context->mailbox->emails[j]->flagged);
}
}
if (!message_is_tagged(Context, j))
continue;
- if (Context->mailbox->hdrs[j]->read || Context->mailbox->hdrs[j]->old)
- mutt_set_flag(Context->mailbox, Context->mailbox->hdrs[j], MUTT_NEW, 1);
+ if (Context->mailbox->emails[j]->read || Context->mailbox->emails[j]->old)
+ mutt_set_flag(Context->mailbox, Context->mailbox->emails[j], MUTT_NEW, 1);
else
- mutt_set_flag(Context->mailbox, Context->mailbox->hdrs[j], MUTT_READ, 1);
+ mutt_set_flag(Context->mailbox, Context->mailbox->emails[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->mailbox->hdrs[j]);
+ mutt_resend_message(NULL, Context, Context->mailbox->emails[j]);
}
}
else
for (int i = 0; i < Context->mailbox->msg_count; i++)
{
- struct Envelope *e = Context->mailbox->hdrs[i]->env;
+ struct Envelope *e = Context->mailbox->emails[i]->env;
if (!e || !e->subject)
continue;
return;
for (int i = 0; i < Context->mailbox->msg_count; i++)
- Context->mailbox->hdrs[i]->recip_valid = false;
+ Context->mailbox->emails[i]->recip_valid = false;
}
/**
return;
for (int i = 0; i < Context->mailbox->msg_count; i++)
- Context->mailbox->hdrs[i]->attach_valid = false;
+ Context->mailbox->emails[i]->attach_valid = false;
}
/**
return;
for (int i = 0; i < Context->mailbox->msg_count; i++)
- FREE(&Context->mailbox->hdrs[i]->env->disp_subj);
+ FREE(&Context->mailbox->emails[i]->env->disp_subj);
}
#ifdef USE_NOTMUCH
{
goto bail;
}
- else if (data == MUTT_UNGROUP &&
- mutt_grouplist_remove_regex(&gc, buf->data) < 0)
+ else if (data == MUTT_UNGROUP && mutt_grouplist_remove_regex(&gc, buf->data) < 0)
{
goto bail;
}
if ((strcmp(cdef->name, "charset") == 0) && strchr(str, ':'))
{
- mutt_buffer_printf(err,
- _("'charset' must contain exactly one character set name"));
+ mutt_buffer_printf(
+ err, _("'charset' must contain exactly one character set name"));
return CSR_ERR_INVALID;
}
** .pp
** Example:
** .ts
- ** set dsn_return=hdrs
+ ** set dsn_return=emails
** .te
** .pp
** \fBNote:\fP when using $$sendmail for delivery, you should not enable
** .de
*/
#endif
- { "hdrs", DT_BOOL, R_NONE, &Hdrs, true },
+ { "emails", DT_BOOL, R_NONE, &Hdrs, true },
/*
** .pp
** When \fIunset\fP, the header fields normally added by the "$my_hdr"
int msg_deleted; /**< number of deleted messages */
int msg_tagged; /**< how many messages are tagged? */
- struct Email **hdrs;
- int hdrmax; /**< number of pointers in hdrs */
+ struct Email **emails;
+ int hdrmax; /**< number of pointers in emails */
int *v2r; /**< mapping from virtual to real msgno */
int vcount; /**< the number of virtual messages */
*/
int maildir_sync_message(struct Mailbox *m, int msgno)
{
- if (!m || !m->hdrs)
+ if (!m || !m->emails)
return -1;
- struct Email *e = m->hdrs[msgno];
+ struct Email *e = m->emails[msgno];
struct Buffer *newpath = NULL;
struct Buffer *partpath = NULL;
struct Buffer *fullpath = NULL;
/* check for modifications and adjust flags */
for (int i = 0; i < m->msg_count; i++)
{
- m->hdrs[i]->active = false;
- maildir_canon_filename(buf, m->hdrs[i]->path);
+ m->emails[i]->active = false;
+ maildir_canon_filename(buf, m->emails[i]->path);
p = mutt_hash_find(fnames, mutt_b2s(buf));
if (p && p->email)
{
/* message already exists, merge flags */
- m->hdrs[i]->active = true;
+ m->emails[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(m->hdrs[i]->path, p->email->path) != 0)
- mutt_str_replace(&m->hdrs[i]->path, p->email->path);
+ if (mutt_str_strcmp(m->emails[i]->path, p->email->path) != 0)
+ mutt_str_replace(&m->emails[i]->path, p->email->path);
/* if the user hasn't modified the flags on this message, update
* the flags we just detected.
*/
- if (!m->hdrs[i]->changed)
- if (maildir_update_flags(ctx->mailbox, m->hdrs[i], p->email))
+ if (!m->emails[i]->changed)
+ if (maildir_update_flags(ctx->mailbox, m->emails[i], p->email))
flags_changed = true;
- if (m->hdrs[i]->deleted == m->hdrs[i]->trash)
+ if (m->emails[i]->deleted == m->emails[i]->trash)
{
- if (m->hdrs[i]->deleted != p->email->deleted)
+ if (m->emails[i]->deleted != p->email->deleted)
{
- m->hdrs[i]->deleted = p->email->deleted;
+ m->emails[i]->deleted = p->email->deleted;
flags_changed = true;
}
}
- m->hdrs[i]->trash = p->email->trash;
+ m->emails[i]->trash = p->email->trash;
/* this is a duplicate of an existing header, so remove it */
mutt_email_free(&p->email);
* Check to see if we have enough information to know if the
* message has disappeared out from underneath us.
*/
- else if (((changed & 1) && (strncmp(m->hdrs[i]->path, "new/", 4) == 0)) ||
- ((changed & 2) && (strncmp(m->hdrs[i]->path, "cur/", 4) == 0)))
+ else if (((changed & 1) && (strncmp(m->emails[i]->path, "new/", 4) == 0)) ||
+ ((changed & 2) && (strncmp(m->emails[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.
*/
- m->hdrs[i]->active = true;
+ m->emails[i]->active = true;
}
}
/* now, update our unseen, flagged, and replied sequences */
for (l = 0; l < m->msg_count; l++)
{
- if (m->hdrs[l]->deleted)
+ if (m->emails[l]->deleted)
continue;
- p = strrchr(m->hdrs[l]->path, '/');
+ p = strrchr(m->emails[l]->path, '/');
if (p)
p++;
else
- p = m->hdrs[l]->path;
+ p = m->emails[l]->path;
if (mutt_str_atoi(p, &i) < 0)
continue;
- if (!m->hdrs[l]->read)
+ if (!m->emails[l]->read)
{
mhs_set(&mhs, i, MH_SEQ_UNSEEN);
unseen++;
}
- if (m->hdrs[l]->flagged)
+ if (m->emails[l]->flagged)
{
mhs_set(&mhs, i, MH_SEQ_FLAGGED);
flagged++;
}
- if (m->hdrs[l]->replied)
+ if (m->emails[l]->replied)
{
mhs_set(&mhs, i, MH_SEQ_REPLIED);
replied++;
*/
int mh_sync_message(struct Mailbox *m, int msgno)
{
- if (!m || !m->hdrs)
+ if (!m || !m->emails)
return -1;
- struct Email *e = m->hdrs[msgno];
+ struct Email *e = m->emails[msgno];
if (e->attach_del || e->xlabel_changed ||
(e->env && (e->env->refs_changed || e->env->irt_changed)))
for (i = 0; i < m->msg_count; i++)
{
- m->hdrs[i]->active = false;
+ m->emails[i]->active = false;
- p = mutt_hash_find(fnames, m->hdrs[i]->path);
- if (p && p->email && mutt_email_cmp_strict(m->hdrs[i], p->email))
+ p = mutt_hash_find(fnames, m->emails[i]->path);
+ if (p && p->email && mutt_email_cmp_strict(m->emails[i], p->email))
{
- m->hdrs[i]->active = true;
+ m->emails[i]->active = true;
/* found the right message */
- if (!m->hdrs[i]->changed)
- if (maildir_update_flags(ctx->mailbox, m->hdrs[i], p->email))
+ if (!m->emails[i]->changed)
+ if (maildir_update_flags(ctx->mailbox, m->emails[i], p->email))
flags_changed = true;
mutt_email_free(&p->email);
int oldmsgcount = m->msg_count;
- if (!m->hdrs)
+ if (!m->emails)
{
/* Allocate some memory to get started */
m->hdrmax = m->msg_count;
if (m->msg_count == m->hdrmax)
mx_alloc_memory(m);
- m->hdrs[m->msg_count] = md->email;
- m->hdrs[m->msg_count]->index = m->msg_count;
+ m->emails[m->msg_count] = md->email;
+ m->emails[m->msg_count]->index = m->msg_count;
m->size += md->email->content->length + md->email->content->offset -
md->email->content->hdr_offset;
*/
int maildir_mh_open_message(struct Mailbox *m, struct Message *msg, int msgno, bool is_maildir)
{
- struct Email *cur = m->hdrs[msgno];
+ struct Email *cur = m->emails[msgno];
char path[PATH_MAX];
snprintf(path, sizeof(path), "%s/%s", m->path, cur->path);
*/
int mh_rewrite_message(struct Mailbox *m, int msgno)
{
- if (!m || !m->hdrs)
+ if (!m || !m->emails)
return -1;
- struct Email *e = m->hdrs[msgno];
+ struct Email *e = m->emails[msgno];
bool restore = true;
long old_body_offset = e->content->offset;
const int old_count = m->msg_count;
for (int i = 0, j = 0; i < old_count; i++)
{
- if (m->hdrs[i]->active && index_hint && *index_hint == i)
+ if (m->emails[i]->active && index_hint && *index_hint == i)
*index_hint = j;
- if (m->hdrs[i]->active)
- m->hdrs[i]->index = j++;
+ if (m->emails[i]->active)
+ m->emails[i]->index = j++;
}
mx_update_tables(ctx, false);
int mh_sync_mailbox_message(struct Mailbox *m, int msgno)
#endif
{
- if (!m || !m->hdrs)
+ if (!m || !m->emails)
return -1;
- struct Email *e = m->hdrs[msgno];
+ struct Email *e = m->emails[msgno];
if (e->deleted && (m->magic != MUTT_MAILDIR || !MaildirTrash))
{
{
for (i = 0, j = 0; i < m->msg_count; i++)
{
- if (!m->hdrs[i]->deleted || (m->magic == MUTT_MAILDIR && MaildirTrash))
- m->hdrs[i]->index = j++;
+ if (!m->emails[i]->deleted || (m->magic == MUTT_MAILDIR && MaildirTrash))
+ m->emails[i]->index = j++;
}
}
if (m->msg_count == m->hdrmax)
mx_alloc_memory(m);
e = mutt_email_new();
- m->hdrs[m->msg_count] = e;
+ m->emails[m->msg_count] = e;
e->offset = loc;
e->index = m->msg_count;
mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, ReadInc, 0);
}
- if (!m->hdrs)
+ if (!m->emails)
{
/* Allocate some memory to get started */
m->hdrmax = m->msg_count;
/* Save the Content-Length of the previous message */
if (count > 0)
{
- struct Email *e = m->hdrs[m->msg_count - 1];
+ struct Email *e = m->emails[m->msg_count - 1];
if (e->content->length < 0)
{
e->content->length = loc - e->content->offset - 1;
if (m->msg_count == m->hdrmax)
mx_alloc_memory(m);
- m->hdrs[m->msg_count] = mutt_email_new();
- curhdr = m->hdrs[m->msg_count];
+ m->emails[m->msg_count] = mutt_email_new();
+ curhdr = m->emails[m->msg_count];
curhdr->received = t - mutt_date_local_tz(t);
curhdr->offset = loc;
curhdr->index = m->msg_count;
*/
if (count > 0)
{
- struct Email *e = m->hdrs[m->msg_count - 1];
+ struct Email *e = m->emails[m->msg_count - 1];
if (e->content->length < 0)
{
e->content->length = ftello(adata->fp) - e->content->offset - 1;
if (m->readonly)
{
for (i = 0; i < m->msg_count; i++)
- mutt_email_free(&(m->hdrs[i])); /* nothing to do! */
- FREE(&m->hdrs);
+ mutt_email_free(&(m->emails[i])); /* nothing to do! */
+ FREE(&m->emails);
}
else
{
/* save the old headers */
old_msgcount = m->msg_count;
- old_hdrs = m->hdrs;
- m->hdrs = NULL;
+ old_hdrs = m->emails;
+ m->emails = NULL;
}
m->hdrmax = 0; /* force allocation of new headers */
{
if (!old_hdrs[j])
continue;
- if (cmp_headers(m->hdrs[i], old_hdrs[j]))
+ if (cmp_headers(m->emails[i], old_hdrs[j]))
{
found = true;
break;
{
if (!old_hdrs[j])
continue;
- if (cmp_headers(m->hdrs[i], old_hdrs[j]))
+ if (cmp_headers(m->emails[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(m, m->hdrs[i], MUTT_FLAG, old_hdrs[j]->flagged);
- mutt_set_flag(m, m->hdrs[i], MUTT_REPLIED, old_hdrs[j]->replied);
- mutt_set_flag(m, m->hdrs[i], MUTT_OLD, old_hdrs[j]->old);
- mutt_set_flag(m, m->hdrs[i], MUTT_READ, old_hdrs[j]->read);
+ mutt_set_flag(m, m->emails[i], MUTT_FLAG, old_hdrs[j]->flagged);
+ mutt_set_flag(m, m->emails[i], MUTT_REPLIED, old_hdrs[j]->replied);
+ mutt_set_flag(m, m->emails[i], MUTT_OLD, old_hdrs[j]->old);
+ mutt_set_flag(m, m->emails[i], MUTT_READ, old_hdrs[j]->read);
}
- mutt_set_flag(m, m->hdrs[i], MUTT_DELETE, old_hdrs[j]->deleted);
- mutt_set_flag(m, m->hdrs[i], MUTT_PURGE, old_hdrs[j]->purge);
- mutt_set_flag(m, m->hdrs[i], MUTT_TAG, old_hdrs[j]->tagged);
+ mutt_set_flag(m, m->emails[i], MUTT_DELETE, old_hdrs[j]->deleted);
+ mutt_set_flag(m, m->emails[i], MUTT_PURGE, old_hdrs[j]->purge);
+ mutt_set_flag(m, m->emails[i], MUTT_TAG, old_hdrs[j]->tagged);
/* we don't need this header any more */
mutt_email_free(&(old_hdrs[j]));
static bool mbox_has_new(struct Mailbox *m)
{
for (int i = 0; i < m->msg_count; i++)
- if (!m->hdrs[i]->deleted && !m->hdrs[i]->read && !m->hdrs[i]->old)
+ if (!m->emails[i]->deleted && !m->emails[i]->read && !m->emails[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 < m->msg_count) && !m->hdrs[i]->deleted &&
- !m->hdrs[i]->changed && !m->hdrs[i]->attach_del;
+ for (i = 0; (i < m->msg_count) && !m->emails[i]->deleted &&
+ !m->emails[i]->changed && !m->emails[i]->attach_del;
i++)
{
}
/* save the index of the first changed/deleted message */
first = i;
/* where to start overwriting */
- offset = m->hdrs[i]->offset;
+ offset = m->emails[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 = m->hdrs[i]->offset;
- old_offset[i - first].body = m->hdrs[i]->content->offset;
- old_offset[i - first].lines = m->hdrs[i]->lines;
- old_offset[i - first].length = m->hdrs[i]->content->length;
+ old_offset[i - first].hdr = m->emails[i]->offset;
+ old_offset[i - first].body = m->emails[i]->content->offset;
+ old_offset[i - first].lines = m->emails[i]->lines;
+ old_offset[i - first].length = m->emails[i]->content->length;
- if (!m->hdrs[i]->deleted)
+ if (!m->emails[i]->deleted)
{
j++;
*/
new_offset[i - first].hdr = ftello(fp) + offset;
- if (mutt_copy_message_ctx(fp, ctx->mailbox, m->hdrs[i], MUTT_CM_UPDATE,
+ if (mutt_copy_message_ctx(fp, ctx->mailbox, m->emails[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) - m->hdrs[i]->content->length + offset;
- mutt_body_free(&m->hdrs[i]->content->parts);
+ new_offset[i - first].body = ftello(fp) - m->emails[i]->content->length + offset;
+ mutt_body_free(&m->emails[i]->content->parts);
switch (m->magic)
{
/* update the offsets of the rewritten messages */
for (i = first, j = first; i < m->msg_count; i++)
{
- if (!m->hdrs[i]->deleted)
+ if (!m->emails[i]->deleted)
{
- m->hdrs[i]->offset = new_offset[i - first].hdr;
- m->hdrs[i]->content->hdr_offset = new_offset[i - first].hdr;
- m->hdrs[i]->content->offset = new_offset[i - first].body;
- m->hdrs[i]->index = j++;
+ m->emails[i]->offset = new_offset[i - first].hdr;
+ m->emails[i]->content->hdr_offset = new_offset[i - first].hdr;
+ m->emails[i]->content->offset = new_offset[i - first].body;
+ m->emails[i]->index = j++;
}
}
FREE(&new_offset);
{
for (i = first; (i < m->msg_count) && old_offset[i - first].valid; i++)
{
- m->hdrs[i]->offset = old_offset[i - first].hdr;
- m->hdrs[i]->content->hdr_offset = old_offset[i - first].hdr;
- m->hdrs[i]->content->offset = old_offset[i - first].body;
- m->hdrs[i]->lines = old_offset[i - first].lines;
- m->hdrs[i]->content->length = old_offset[i - first].length;
+ m->emails[i]->offset = old_offset[i - first].hdr;
+ m->emails[i]->content->hdr_offset = old_offset[i - first].hdr;
+ m->emails[i]->content->offset = old_offset[i - first].body;
+ m->emails[i]->lines = old_offset[i - first].lines;
+ m->emails[i]->content->length = old_offset[i - first].length;
}
}
{
struct ColorLineHead *color = NULL;
struct ColorLine *np = NULL;
- struct Email *e = Context->mailbox->hdrs[Context->mailbox->v2r[index]];
+ struct Email *e = Context->mailbox->emails[Context->mailbox->v2r[index]];
int type = *s;
switch (type)
* @retval 0 Success
* @retval -1 Error
*/
-int mutt_grouplist_add_regex(struct GroupList *head, const char *s,
- int flags, struct Buffer *err)
+int mutt_grouplist_add_regex(struct GroupList *head, const char *s, int flags,
+ struct Buffer *err)
{
int rc = 0;
if (!message_is_tagged(Context, i))
continue;
- struct Email *e2 = Context->mailbox->hdrs[i];
+ struct Email *e2 = Context->mailbox->emails[i];
if (label_message(Context->mailbox, e2, new))
{
changed++;
struct Mailbox *m = ctx->mailbox;
struct MuttThread *tree = ctx->tree;
- struct Email **array = m->hdrs + ((Sort & SORT_REVERSE) ? m->msg_count - 1 : 0);
+ struct Email **array = m->emails + ((Sort & SORT_REVERSE) ? m->msg_count - 1 : 0);
while (tree)
{
for (int i = 0; i < m->msg_count; i++)
{
- struct Email *e = m->hdrs[i];
+ struct Email *e = m->emails[i];
if (e->env->real_subj)
mutt_hash_insert(hash, e->env->real_subj, e);
}
*/
void mutt_clear_threads(struct Context *ctx)
{
- if (!ctx || !ctx->mailbox || !ctx->mailbox->hdrs)
+ if (!ctx || !ctx->mailbox || !ctx->mailbox->emails)
return;
struct Mailbox *m = ctx->mailbox;
for (int i = 0; i < m->msg_count; i++)
{
/* mailbox may have been only partially read */
- if (m->hdrs[i])
+ if (m->emails[i])
{
- m->hdrs[i]->thread = NULL;
- m->hdrs[i]->threaded = false;
+ m->emails[i]->thread = NULL;
+ m->emails[i]->threaded = false;
}
}
ctx->tree = NULL;
struct MuttThread *tmp = NULL;
for (int i = 0; i < m->msg_count; i++)
{
- cur = m->hdrs[i];
+ cur = m->emails[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 < m->msg_count; i++)
{
- cur = m->hdrs[i];
+ cur = m->emails[i];
if (!cur->thread)
{
/* thread by references */
for (i = 0; i < m->msg_count; i++)
{
- cur = m->hdrs[i];
+ cur = m->emails[i];
if (cur->threaded)
continue;
cur->threaded = true;
for (int i = 0; i < m->msg_count; i++)
{
- cur = m->hdrs[i];
+ cur = m->emails[i];
if (cur->virtual >= 0)
{
cur->virtual = m->vcount;
for (int i = 0; i < m->msg_count; i++)
{
- struct Email *e = m->hdrs[i];
+ struct Email *e = m->emails[i];
if (e->env->message_id)
mutt_hash_insert(hash, e->env->message_id, e);
}
{
for (int i = 0; i < m->msg_count; i++)
if (message_is_tagged(ctx, i))
- changed |= link_threads(cur, m->hdrs[i], ctx->mailbox);
+ changed |= link_threads(cur, m->emails[i], ctx->mailbox);
}
else
changed = link_threads(cur, last, ctx->mailbox);
mutt_hash_destroy(&m->subj_hash);
mutt_hash_destroy(&m->id_hash);
mutt_hash_destroy(&m->label_hash);
- if (m->hdrs)
+ if (m->emails)
{
mutt_clear_threads(ctx);
for (int i = 0; i < m->msg_count; i++)
- mutt_email_free(&m->hdrs[i]);
- FREE(&m->hdrs);
+ mutt_email_free(&m->emails[i]);
+ FREE(&m->emails);
}
FREE(&m->v2r);
mx_cleanup_context(ctx);
int first_del = -1;
for (i = 0; i < m->msg_count; i++)
{
- if (m->hdrs[i]->deleted && (!m->hdrs[i]->purge))
+ if (m->emails[i]->deleted && (!m->emails[i]->purge))
{
if (first_del < 0)
first_del = i;
/* continue from initial scan above */
for (i = first_del; i < m->msg_count; i++)
{
- if (m->hdrs[i]->deleted && (!m->hdrs[i]->purge))
+ if (m->emails[i]->deleted && (!m->emails[i]->purge))
{
- if (mutt_append_message(ctx_trash->mailbox, m, m->hdrs[i], 0, 0) == -1)
+ if (mutt_append_message(ctx_trash->mailbox, m, m->emails[i], 0, 0) == -1)
{
mx_mbox_close(&ctx_trash, NULL);
return -1;
for (i = 0; i < m->msg_count; i++)
{
- if (!m->hdrs[i])
+ if (!m->emails[i])
break;
- if (!m->hdrs[i]->deleted && m->hdrs[i]->read && !(m->hdrs[i]->flagged && KeepFlagged))
+ if (!m->emails[i]->deleted && m->emails[i]->read && !(m->emails[i]->flagged && KeepFlagged))
{
read_msgs++;
}
{
for (i = 0; i < m->msg_count; i++)
{
- if (!m->hdrs[i]->deleted && !m->hdrs[i]->old && !m->hdrs[i]->read)
- mutt_set_flag(m, m->hdrs[i], MUTT_OLD, 1);
+ if (!m->emails[i]->deleted && !m->emails[i]->old && !m->emails[i]->read)
+ mutt_set_flag(m, m->emails[i], MUTT_OLD, 1);
}
}
/* tag messages for moving, and clear old tags, if any */
for (i = 0; i < m->msg_count; i++)
{
- if (m->hdrs[i]->read && !m->hdrs[i]->deleted && !(m->hdrs[i]->flagged && KeepFlagged))
+ if (m->emails[i]->read && !m->emails[i]->deleted &&
+ !(m->emails[i]->flagged && KeepFlagged))
{
- m->hdrs[i]->tagged = true;
+ m->emails[i]->tagged = true;
}
else
{
- m->hdrs[i]->tagged = false;
+ m->emails[i]->tagged = false;
}
}
for (i = 0; i < m->msg_count; i++)
{
- if (m->hdrs[i]->read && !m->hdrs[i]->deleted && !(m->hdrs[i]->flagged && KeepFlagged))
+ if (m->emails[i]->read && !m->emails[i]->deleted &&
+ !(m->emails[i]->flagged && KeepFlagged))
{
- if (mutt_append_message(f->mailbox, ctx->mailbox, m->hdrs[i], 0, CH_UPDATE_LEN) == 0)
+ if (mutt_append_message(f->mailbox, ctx->mailbox, m->emails[i], 0, CH_UPDATE_LEN) == 0)
{
- mutt_set_flag(m, m->hdrs[i], MUTT_DELETE, 1);
- mutt_set_flag(m, m->hdrs[i], MUTT_PURGE, 1);
+ mutt_set_flag(m, m->emails[i], MUTT_DELETE, 1);
+ mutt_set_flag(m, m->emails[i], MUTT_PURGE, 1);
}
else
{
{
for (i = 0; i < m->msg_count; i++)
{
- m->hdrs[i]->deleted = false;
- m->hdrs[i]->purge = false;
+ m->emails[i]->deleted = false;
+ m->emails[i]->purge = false;
}
m->msg_deleted = 0;
}
{
for (i = 0; i < m->msg_count; i++)
{
- if (m->hdrs[i]->deleted && !m->hdrs[i]->read)
+ if (m->emails[i]->deleted && !m->emails[i]->read)
{
m->msg_unread--;
- if (!m->hdrs[i]->old)
+ if (!m->emails[i]->old)
m->msg_new--;
}
- if (m->hdrs[i]->deleted && m->hdrs[i]->flagged)
+ if (m->emails[i]->deleted && m->emails[i]->flagged)
m->msg_flagged--;
}
}
padding = mx_msg_padding_size(m);
for (i = 0, j = 0; i < m->msg_count; i++)
{
- if (!m->hdrs[i]->quasi_deleted &&
- ((committing && (!m->hdrs[i]->deleted || (m->magic == MUTT_MAILDIR && MaildirTrash))) ||
- (!committing && m->hdrs[i]->active)))
+ if (!m->emails[i]->quasi_deleted &&
+ ((committing && (!m->emails[i]->deleted || (m->magic == MUTT_MAILDIR && MaildirTrash))) ||
+ (!committing && m->emails[i]->active)))
{
if (i != j)
{
- m->hdrs[j] = m->hdrs[i];
- m->hdrs[i] = NULL;
+ m->emails[j] = m->emails[i];
+ m->emails[i] = NULL;
}
- m->hdrs[j]->msgno = j;
- if (m->hdrs[j]->virtual != -1)
+ m->emails[j]->msgno = j;
+ if (m->emails[j]->virtual != -1)
{
m->v2r[m->vcount] = j;
- m->hdrs[j]->virtual = m->vcount++;
- struct Body *b = m->hdrs[j]->content;
+ m->emails[j]->virtual = m->vcount++;
+ struct Body *b = m->emails[j]->content;
ctx->vsize += b->length + b->offset - b->hdr_offset + padding;
}
if (committing)
- m->hdrs[j]->changed = false;
- else if (m->hdrs[j]->changed)
+ m->emails[j]->changed = false;
+ else if (m->emails[j]->changed)
m->changed = true;
if (!committing || (m->magic == MUTT_MAILDIR && MaildirTrash))
{
- if (m->hdrs[j]->deleted)
+ if (m->emails[j]->deleted)
m->msg_deleted++;
}
- if (m->hdrs[j]->tagged)
+ if (m->emails[j]->tagged)
m->msg_tagged++;
- if (m->hdrs[j]->flagged)
+ if (m->emails[j]->flagged)
m->msg_flagged++;
- if (!m->hdrs[j]->read)
+ if (!m->emails[j]->read)
{
m->msg_unread++;
- if (!m->hdrs[j]->old)
+ if (!m->emails[j]->old)
m->msg_new++;
}
{
if (m->magic == MUTT_MH || m->magic == MUTT_MAILDIR)
{
- m->size -= (m->hdrs[i]->content->length + m->hdrs[i]->content->offset -
- m->hdrs[i]->content->hdr_offset);
+ m->size -= (m->emails[i]->content->length + m->emails[i]->content->offset -
+ m->emails[i]->content->hdr_offset);
}
/* remove message from the hash tables */
- if (m->subj_hash && m->hdrs[i]->env->real_subj)
- mutt_hash_delete(m->subj_hash, m->hdrs[i]->env->real_subj, m->hdrs[i]);
- if (m->id_hash && m->hdrs[i]->env->message_id)
- mutt_hash_delete(m->id_hash, m->hdrs[i]->env->message_id, m->hdrs[i]);
- mutt_label_hash_remove(m, m->hdrs[i]);
+ if (m->subj_hash && m->emails[i]->env->real_subj)
+ mutt_hash_delete(m->subj_hash, m->emails[i]->env->real_subj, m->emails[i]);
+ if (m->id_hash && m->emails[i]->env->message_id)
+ mutt_hash_delete(m->id_hash, m->emails[i]->env->message_id, m->emails[i]);
+ mutt_label_hash_remove(m, m->emails[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 == m->hdrs[i])
+ if (ctx->last_tag == m->emails[i])
ctx->last_tag = NULL;
- mutt_email_free(&m->hdrs[i]);
+ mutt_email_free(&m->emails[i]);
}
}
m->msg_count = j;
{
for (int i = 0; i < m->msg_count; i++)
{
- m->hdrs[i]->deleted = false;
- m->hdrs[i]->purge = false;
+ m->emails[i]->deleted = false;
+ m->emails[i]->purge = false;
}
m->msg_deleted = 0;
}
}
m->hdrmax += 25;
- if (m->hdrs)
+ if (m->emails)
{
- mutt_mem_realloc(&m->hdrs, sizeof(struct Email *) * m->hdrmax);
+ mutt_mem_realloc(&m->emails, sizeof(struct Email *) * m->hdrmax);
mutt_mem_realloc(&m->v2r, sizeof(int) * m->hdrmax);
}
else
{
- m->hdrs = mutt_mem_calloc(m->hdrmax, sizeof(struct Email *));
+ m->emails = mutt_mem_calloc(m->hdrmax, sizeof(struct Email *));
m->v2r = mutt_mem_calloc(m->hdrmax, sizeof(int));
}
for (int i = m->msg_count; i < m->hdrmax; i++)
{
- m->hdrs[i] = NULL;
+ m->emails[i] = NULL;
m->v2r[i] = -1;
}
}
struct Email *e = NULL;
for (int msgno = 0; msgno < m->msg_count; msgno++)
{
- e = m->hdrs[msgno];
+ e = m->emails[msgno];
if (WithCrypto)
{
if (!message_is_tagged(Context, i))
continue;
- struct Email *ei = Context->mailbox->hdrs[i];
+ struct Email *ei = Context->mailbox->emails[i];
mutt_parse_mime_message(Context->mailbox, ei);
if (ei->security & ENCRYPT && !crypt_valid_passphrase(ei->security))
int smime_class_application_handler(struct Body *m, struct State *s)
{
int rv = -1;
- struct Body *tattach = smime_handle_entity (m, s, NULL);
+ struct Body *tattach = smime_handle_entity(m, s, NULL);
if (tattach)
{
rv = 0;
- mutt_body_free (&tattach);
+ mutt_body_free(&tattach);
}
return rv;
}
{
/* We don't actually check sequential order, since we mark
* "missing" entries as read/deleted */
- last = nntp_edata_get(m->hdrs[i])->article_num;
- if (last >= mdata->first_message && !m->hdrs[i]->deleted && !m->hdrs[i]->read)
+ last = nntp_edata_get(m->emails[i])->article_num;
+ if (last >= mdata->first_message && !m->emails[i]->deleted &&
+ !m->emails[i]->read)
{
if (mdata->newsrc_len >= entries)
{
/* search for first read */
else
{
- if (m->hdrs[i]->deleted || m->hdrs[i]->read)
+ if (m->emails[i]->deleted || m->emails[i]->read)
{
first = last + 1;
series = true;
}
- last = nntp_edata_get(m->hdrs[i])->article_num;
+ last = nntp_edata_get(m->emails[i])->article_num;
}
}
if (m && (m->mdata == mdata))
{
for (unsigned int i = 0; i < m->msg_count; i++)
- mutt_set_flag(m, m->hdrs[i], MUTT_READ, 1);
+ mutt_set_flag(m, m->emails[i], MUTT_READ, 1);
}
return mdata;
}
{
mdata->unread = m->msg_count;
for (unsigned int i = 0; i < m->msg_count; i++)
- mutt_set_flag(m, m->hdrs[i], MUTT_READ, 0);
+ mutt_set_flag(m, m->emails[i], MUTT_READ, 0);
}
else
{
unsigned int unread = 0;
for (unsigned int j = 0; j < m->msg_count; j++)
- if (!m->hdrs[j]->read && !m->hdrs[j]->deleted)
+ if (!m->emails[j]->read && !m->emails[j]->deleted)
unread++;
if (!unread)
continue;
mx_alloc_memory(m);
/* parse header */
- m->hdrs[m->msg_count] = mutt_email_new();
- e = m->hdrs[m->msg_count];
+ m->emails[m->msg_count] = mutt_email_new();
+ e = m->emails[m->msg_count];
e->env = mutt_rfc822_read_header(fp, e, false, false);
e->env->newsgroups = mutt_str_strdup(mdata->group);
e->received = e->date_sent;
mutt_debug(2, "mutt_hcache_fetch %s\n", buf);
mutt_email_free(&e);
e = mutt_hcache_restore(hdata);
- m->hdrs[m->msg_count] = e;
+ m->emails[m->msg_count] = e;
mutt_hcache_free(fc->hc, &hdata);
e->edata = NULL;
e->read = false;
fc.hc = hc;
#endif
- if (!m->hdrs)
+ if (!m->emails)
{
/* Allocate some memory to get started */
m->hdrmax = m->msg_count;
{
mutt_debug(2, "mutt_hcache_fetch %s\n", buf);
e = mutt_hcache_restore(hdata);
- m->hdrs[m->msg_count] = e;
+ m->emails[m->msg_count] = e;
mutt_hcache_free(fc.hc, &hdata);
e->edata = NULL;
}
/* parse header */
- m->hdrs[m->msg_count] = mutt_email_new();
- e = m->hdrs[m->msg_count];
+ m->emails[m->msg_count] = mutt_email_new();
+ e = m->emails[m->msg_count];
e->env = mutt_rfc822_read_header(fp, e, false, false);
e->received = e->date_sent;
mutt_file_fclose(&fp);
if (mdata->last_message < mdata->last_loaded)
{
for (int i = 0; i < m->msg_count; i++)
- mutt_email_free(&m->hdrs[i]);
+ mutt_email_free(&m->emails[i]);
m->msg_count = 0;
m->msg_tagged = 0;
for (int i = 0; i < m->msg_count; i++)
{
bool flagged = false;
- anum = nntp_edata_get(m->hdrs[i])->article_num;
+ anum = nntp_edata_get(m->emails[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(m, m->hdrs[i], MUTT_TAG, 0);
- mutt_email_free(&m->hdrs[i]);
+ mutt_set_flag(m, m->emails[i], MUTT_TAG, 0);
+ mutt_email_free(&m->emails[i]);
continue;
}
}
}
#endif
- if (!m->hdrs[i]->changed)
+ if (!m->emails[i]->changed)
{
- m->hdrs[i]->flagged = flagged;
- m->hdrs[i]->read = false;
- m->hdrs[i]->old = false;
- nntp_article_status(m, m->hdrs[i], NULL, anum);
- if (!m->hdrs[i]->read)
- nntp_parse_xref(m, m->hdrs[i]);
+ m->emails[i]->flagged = flagged;
+ m->emails[i]->read = false;
+ m->emails[i]->old = false;
+ nntp_article_status(m, m->emails[i], NULL, anum);
+ if (!m->emails[i]->read)
+ nntp_parse_xref(m, m->emails[i]);
}
- m->hdrs[j++] = m->hdrs[i];
+ m->emails[j++] = m->emails[i];
}
#ifdef USE_HCACHE
mx_alloc_memory(m);
e = mutt_hcache_restore(hdata);
- m->hdrs[m->msg_count] = e;
+ m->emails[m->msg_count] = e;
mutt_hcache_free(hc, &hdata);
e->edata = NULL;
if (e->deleted)
if (!line || sscanf(line, ANUM, &anum) != 1)
return 0;
for (unsigned int i = 0; i < cc->mailbox->msg_count; i++)
- if (nntp_edata_get(cc->mailbox->hdrs[i])->article_num == anum)
+ if (nntp_edata_get(cc->mailbox->emails[i])->article_num == anum)
return 0;
if (cc->num >= cc->max)
{
/* parse header */
if (m->msg_count == m->hdrmax)
mx_alloc_memory(m);
- m->hdrs[m->msg_count] = mutt_email_new();
- struct Email *e = m->hdrs[m->msg_count];
+ m->emails[m->msg_count] = mutt_email_new();
+ struct Email *e = m->emails[m->msg_count];
e->edata = nntp_edata_new();
e->free_edata = nntp_edata_free;
e->env = mutt_rfc822_read_header(fp, e, false, false);
for (int i = 0; i < m->msg_count; i++)
{
- struct Email *e = m->hdrs[i];
+ struct Email *e = m->emails[i];
char buf[16];
snprintf(buf, sizeof(buf), "%d", nntp_edata_get(e)->article_num);
*/
static int nntp_msg_open(struct Mailbox *m, struct Message *msg, int msgno)
{
- if (!m || !m->hdrs || !msg)
+ if (!m || !m->emails || !msg)
return -1;
struct NntpMboxData *mdata = m->mdata;
- struct Email *e = m->hdrs[msgno];
+ struct Email *e = m->emails[msgno];
char article[16];
/* try to get article from cache */
e->active = true;
e->index = m->msg_count;
m->size += e->content->length + e->content->offset - e->content->hdr_offset;
- m->hdrs[m->msg_count] = e;
+ m->emails[m->msg_count] = e;
m->msg_count++;
if (newpath)
progress_reset(m);
- if (!m->hdrs)
+ if (!m->emails)
{
/* Allocate some memory to get started */
m->hdrmax = m->msg_count;
mdata->noprogress = true;
for (int i = 0; i < m->msg_count; i++)
- m->hdrs[i]->active = false;
+ m->emails[i]->active = false;
int limit = get_limit(mdata);
for (int i = 0; i < m->msg_count; i++)
{
- if (!m->hdrs[i]->active)
+ if (!m->emails[i]->active)
{
occult = true;
break;
for (int i = 0; i < m->msg_count; i++)
{
char old[PATH_MAX], new[PATH_MAX];
- struct Email *e = m->hdrs[i];
+ struct Email *e = m->emails[i];
struct NmEmailData *edata = e->edata;
if (!m->quiet)
*/
static int nm_msg_open(struct Mailbox *m, struct Message *msg, int msgno)
{
- if (!m || !m->hdrs || !msg)
+ if (!m || !m->emails || !msg)
return -1;
- struct Email *e = m->hdrs[msgno];
+ struct Email *e = m->emails[msgno];
char path[PATH_MAX];
char *folder = nm_email_get_folder(e);
{
for (i = oldcount; i < Context->mailbox->msg_count; i++)
{
- struct Email *e = Context->mailbox->hdrs[i];
+ struct Email *e = Context->mailbox->emails[i];
if (e && !e->read)
{
* rd.index->current might be invalid */
rd.index->current =
MIN(rd.index->current, (Context->mailbox->msg_count - 1));
- index_hint =
- Context->mailbox->hdrs[Context->mailbox->v2r[rd.index->current]]->index;
+ index_hint = Context->mailbox
+ ->emails[Context->mailbox->v2r[rd.index->current]]
+ ->index;
bool q = Context->mailbox->quiet;
Context->mailbox->quiet = true;
* 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->email !=
- Context->mailbox->hdrs[Context->mailbox->v2r[rd.index->current]])
+ Context->mailbox->emails[Context->mailbox->v2r[rd.index->current]])
{
extra->email =
- Context->mailbox->hdrs[Context->mailbox->v2r[rd.index->current]];
+ Context->mailbox->emails[Context->mailbox->v2r[rd.index->current]];
break;
}
}
#define KILO 1024
#define MEGA 1048576
#define HMSG(h) (((h)->msgno) + 1)
-#define CTX_MSGNO(c) (HMSG((c)->mailbox->hdrs[(c)->mailbox->v2r[(c)->menu->current]]))
+#define CTX_MSGNO(c) (HMSG((c)->mailbox->emails[(c)->mailbox->v2r[(c)->menu->current]]))
#define MUTT_MAXRANGE -1
FILE *fp = NULL;
long lng = 0;
- struct Email *e = m->hdrs[msgno];
+ struct Email *e = m->emails[msgno];
#ifdef USE_FMEMOPEN
char *temp = NULL;
size_t tempsize;
for (int i = 0; i < Context->mailbox->msg_count; i++)
{
- 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;
+ Context->mailbox->emails[i]->virtual = -1;
+ Context->mailbox->emails[i]->limited = false;
+ Context->mailbox->emails[i]->collapsed = false;
+ Context->mailbox->emails[i]->num_hidden = 0;
- if (top_of_thread(Context->mailbox->hdrs[i]) == me)
+ if (top_of_thread(Context->mailbox->emails[i]) == me)
{
- struct Body *body = Context->mailbox->hdrs[i]->content;
+ struct Body *body = Context->mailbox->emails[i]->content;
- Context->mailbox->hdrs[i]->virtual = Context->mailbox->vcount;
- Context->mailbox->hdrs[i]->limited = true;
+ Context->mailbox->emails[i]->virtual = Context->mailbox->vcount;
+ Context->mailbox->emails[i]->limited = true;
Context->mailbox->v2r[Context->mailbox->vcount] = i;
Context->mailbox->vcount++;
Context->vsize += (body->length + body->offset - body->hdr_offset);
{
mutt_progress_update(&progress, i, -1);
/* new limit pattern implicitly uncollapses all threads */
- 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;
+ Context->mailbox->emails[i]->virtual = -1;
+ Context->mailbox->emails[i]->limited = false;
+ Context->mailbox->emails[i]->collapsed = false;
+ Context->mailbox->emails[i]->num_hidden = 0;
if (mutt_pattern_exec(pat, MUTT_MATCH_FULL_ADDRESS, Context->mailbox,
- Context->mailbox->hdrs[i], NULL))
+ Context->mailbox->emails[i], NULL))
{
- Context->mailbox->hdrs[i]->virtual = Context->mailbox->vcount;
- Context->mailbox->hdrs[i]->limited = true;
+ Context->mailbox->emails[i]->virtual = Context->mailbox->vcount;
+ Context->mailbox->emails[i]->limited = true;
Context->mailbox->v2r[Context->mailbox->vcount] = i;
Context->mailbox->vcount++;
- struct Body *b = Context->mailbox->hdrs[i]->content;
+ struct Body *b = Context->mailbox->emails[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->mailbox,
- Context->mailbox->hdrs[Context->mailbox->v2r[i]], NULL))
+ Context->mailbox->emails[Context->mailbox->v2r[i]], NULL))
{
switch (op)
{
case MUTT_UNDELETE:
mutt_set_flag(Context->mailbox,
- Context->mailbox->hdrs[Context->mailbox->v2r[i]],
+ Context->mailbox->emails[Context->mailbox->v2r[i]],
MUTT_PURGE, 0);
/* fallthrough */
case MUTT_DELETE:
mutt_set_flag(Context->mailbox,
- Context->mailbox->hdrs[Context->mailbox->v2r[i]],
+ Context->mailbox->emails[Context->mailbox->v2r[i]],
MUTT_DELETE, (op == MUTT_DELETE));
break;
case MUTT_TAG:
case MUTT_UNTAG:
mutt_set_flag(Context->mailbox,
- Context->mailbox->hdrs[Context->mailbox->v2r[i]],
+ Context->mailbox->emails[Context->mailbox->v2r[i]],
MUTT_TAG, (op == MUTT_TAG));
break;
}
if (OptSearchInvalid)
{
for (int i = 0; i < Context->mailbox->msg_count; i++)
- Context->mailbox->hdrs[i]->searched = false;
+ Context->mailbox->emails[i]->searched = false;
#ifdef USE_IMAP
if (Context->mailbox->magic == MUTT_IMAP &&
imap_search(Context->mailbox, SearchPattern) < 0)
}
}
- struct Email *e = Context->mailbox->hdrs[Context->mailbox->v2r[i]];
+ struct Email *e = Context->mailbox->emails[Context->mailbox->v2r[i]];
if (e->searched)
{
/* if we've already evaluated this message, use the cached value */
int i;
for (i = 0; i < m->msg_count; i++)
{
- struct PopEmailData *edata = m->hdrs[i]->edata;
+ struct PopEmailData *edata = m->emails[i]->edata;
if (mutt_str_strcmp(line, edata->uid) == 0)
break;
}
mx_alloc_memory(m);
m->msg_count++;
- m->hdrs[i] = mutt_email_new();
+ m->emails[i] = mutt_email_new();
- m->hdrs[i]->edata = pop_edata_new(line);
- m->hdrs[i]->free_edata = pop_edata_free;
+ m->emails[i]->edata = pop_edata_new(line);
+ m->emails[i]->free_edata = pop_edata_free;
}
- else if (m->hdrs[i]->index != index - 1)
+ else if (m->emails[i]->index != index - 1)
adata->clear_cache = true;
- m->hdrs[i]->refno = index;
- m->hdrs[i]->index = index - 1;
+ m->emails[i]->refno = index;
+ m->emails[i]->index = index - 1;
return 0;
}
for (int i = 0; i < m->msg_count; i++)
{
- struct PopEmailData *edata = m->hdrs[i]->edata;
+ struct PopEmailData *edata = m->emails[i]->edata;
/* if the id we get is known for a header: done (i.e. keep in cache) */
if (edata->uid && (mutt_str_strcmp(edata->uid, id) == 0))
return 0;
time(&adata->check_time);
adata->clear_cache = false;
- if (!m->hdrs)
+ if (!m->emails)
{
/* Allocate some memory to get started */
m->hdrmax = m->msg_count;
}
for (int i = 0; i < m->msg_count; i++)
- m->hdrs[i]->refno = -1;
+ m->emails[i]->refno = -1;
const int old_count = m->msg_count;
int ret = pop_fetch_data(adata, "UIDL\r\n", NULL, fetch_uidl, m);
int i, deleted;
for (i = 0, deleted = 0; i < old_count; i++)
{
- if (m->hdrs[i]->refno == -1)
+ if (m->emails[i]->refno == -1)
{
- m->hdrs[i]->deleted = true;
+ m->emails[i]->deleted = true;
deleted++;
}
}
{
if (!m->quiet)
mutt_progress_update(&progress, i + 1 - old_count, -1);
- struct PopEmailData *edata = m->hdrs[i]->edata;
+ struct PopEmailData *edata = m->emails[i]->edata;
#ifdef USE_HCACHE
void *data = mutt_hcache_fetch(hc, edata->uid, strlen(edata->uid));
if (data)
{
/* Detach the private data */
- m->hdrs[i]->edata = NULL;
+ m->emails[i]->edata = NULL;
- int refno = m->hdrs[i]->refno;
- int index = m->hdrs[i]->index;
+ int refno = m->emails[i]->refno;
+ int index = m->emails[i]->index;
/* - POP dynamically numbers headers and relies on e->refno
* to map messages; so restore header and overwrite restored
* refno with current refno, same for index
*/
struct Email *e = mutt_hcache_restore((unsigned char *) data);
mutt_hcache_free(hc, &data);
- mutt_email_free(&m->hdrs[i]);
- m->hdrs[i] = e;
- m->hdrs[i]->refno = refno;
- m->hdrs[i]->index = index;
+ mutt_email_free(&m->emails[i]);
+ m->emails[i] = e;
+ m->emails[i]->refno = refno;
+ m->emails[i]->index = index;
/* Reattach the private data */
- m->hdrs[i]->edata = edata;
- m->hdrs[i]->free_edata = pop_edata_free;
+ m->emails[i]->edata = edata;
+ m->emails[i]->free_edata = pop_edata_free;
ret = 0;
hcached = true;
}
else
#endif
- if ((ret = pop_read_header(adata, m->hdrs[i])) < 0)
+ if ((ret = pop_read_header(adata, m->emails[i])) < 0)
break;
#ifdef USE_HCACHE
else
{
- mutt_hcache_store(hc, edata->uid, strlen(edata->uid), m->hdrs[i], 0);
+ mutt_hcache_store(hc, edata->uid, strlen(edata->uid), m->emails[i], 0);
}
#endif
*/
const bool bcached =
(mutt_bcache_exists(adata->bcache, cache_id(edata->uid)) == 0);
- m->hdrs[i]->old = false;
- m->hdrs[i]->read = false;
+ m->emails[i]->old = false;
+ m->emails[i]->read = false;
if (hcached)
{
if (bcached)
- m->hdrs[i]->read = true;
+ m->emails[i]->read = true;
else if (MarkOld)
- m->hdrs[i]->old = true;
+ m->emails[i]->old = true;
}
else
{
if (bcached)
- m->hdrs[i]->read = true;
+ m->emails[i]->read = true;
}
m->msg_count++;
if (ret < 0)
{
for (int i = m->msg_count; i < new_count; i++)
- mutt_email_free(&m->hdrs[i]);
+ mutt_email_free(&m->emails[i]);
return ret;
}
int num_deleted = 0;
for (i = 0; i < m->msg_count; i++)
{
- if (m->hdrs[i]->deleted)
+ if (m->emails[i]->deleted)
num_deleted++;
}
for (i = 0, j = 0, ret = 0; (ret == 0) && (i < m->msg_count); i++)
{
- struct PopEmailData *edata = m->hdrs[i]->edata;
- if (m->hdrs[i]->deleted && m->hdrs[i]->refno != -1)
+ struct PopEmailData *edata = m->emails[i]->edata;
+ if (m->emails[i]->deleted && m->emails[i]->refno != -1)
{
j++;
if (!m->quiet)
mutt_progress_update(&progress, j, -1);
- snprintf(buf, sizeof(buf), "DELE %d\r\n", m->hdrs[i]->refno);
+ snprintf(buf, sizeof(buf), "DELE %d\r\n", m->emails[i]->refno);
ret = pop_query(adata, buf, sizeof(buf));
if (ret == 0)
{
}
#ifdef USE_HCACHE
- if (m->hdrs[i]->changed)
+ if (m->emails[i]->changed)
{
- mutt_hcache_store(hc, edata->uid, strlen(edata->uid), m->hdrs[i], 0);
+ mutt_hcache_store(hc, edata->uid, strlen(edata->uid), m->emails[i], 0);
}
#endif
}
char path[PATH_MAX];
struct Progress progressbar;
struct PopAccountData *adata = pop_get_adata(m);
- struct Email *e = m->hdrs[msgno];
+ struct Email *e = m->emails[msgno];
struct PopEmailData *edata = e->edata;
bool bcache = true;
fgets(buf, sizeof(buf), msg->fp);
while (!feof(msg->fp))
{
- m->hdrs[msgno]->lines++;
+ m->emails[msgno]->lines++;
fgets(buf, sizeof(buf), msg->fp);
}
struct Mailbox *m = data;
for (int i = 0; i < m->msg_count; i++)
{
- struct PopEmailData *edata = m->hdrs[i]->edata;
+ struct PopEmailData *edata = m->emails[i]->edata;
if (mutt_str_strcmp(edata->uid, line) == 0)
{
- m->hdrs[i]->refno = index;
+ m->emails[i]->refno = index;
break;
}
}
MUTT_PROGRESS_SIZE, NetInc, 0);
for (int i = 0; i < m->msg_count; i++)
- m->hdrs[i]->refno = -1;
+ m->emails[i]->refno = -1;
ret = pop_fetch_data(adata, "UIDL\r\n", &progressbar, check_uidl, m);
if (ret == -2)
struct Context *ctx = menu->data;
mutt_make_string_flags(buf, buflen, NONULL(IndexFormat), ctx,
- ctx->mailbox->hdrs[line], MUTT_FORMAT_ARROWCURSOR);
+ ctx->mailbox->emails[line], MUTT_FORMAT_ARROWCURSOR);
}
/**
case OP_DELETE:
case OP_UNDELETE:
/* should deleted draft messages be saved in the trash folder? */
- mutt_set_flag(PostContext->mailbox, PostContext->mailbox->hdrs[menu->current],
+ mutt_set_flag(PostContext->mailbox, PostContext->mailbox->emails[menu->current],
MUTT_DELETE, (i == OP_DELETE) ? 1 : 0);
PostCount = PostContext->mailbox->msg_count - PostContext->mailbox->msg_deleted;
if (Resolve && menu->current < menu->max - 1)
Sort = orig_sort;
mutt_menu_pop_current(menu);
mutt_menu_destroy(&menu);
- return r > -1 ? PostContext->mailbox->hdrs[r] : NULL;
+ return r > -1 ? PostContext->mailbox->emails[r] : NULL;
}
/**
if (PostContext->mailbox->msg_count == 1)
{
/* only one message, so just use that one. */
- e = PostContext->mailbox->hdrs[0];
+ e = PostContext->mailbox->emails[0];
}
else if (!(e = select_msg()))
{
* %n is the integer number of sub-parts in the multipart
* %F is "content-type filename" repeated for each sub-part
*/
-int rfc1524_expand_command(struct Body *a, const char *filename, const char *type, char *command, int clen)
+int rfc1524_expand_command(struct Body *a, const char *filename,
+ const char *type, char *command, int clen)
{
int x = 0, y = 0;
int needspipe = true;
* for a "%s". If none is found, the nametemplate is used as the template for
* newfile. The first path component of the nametemplate and oldfile are ignored.
*/
-int rfc1524_expand_filename(const char *nametemplate, const char *oldfile, char *newfile, size_t nflen)
+int rfc1524_expand_filename(const char *nametemplate, const char *oldfile,
+ char *newfile, size_t nflen)
{
int i, j, k, ps;
char *s = NULL;
for (int i = 0; m && i < m->msg_count; i++)
{
- mutt_score_message(m, m->hdrs[i], true);
- m->hdrs[i]->pair = 0;
+ mutt_score_message(m, m->emails[i], true);
+ m->emails[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->mailbox->hdrs[i]->env);
+ mutt_add_to_reference_headers(env, ctx->mailbox->emails[i]->env);
}
}
else
if (!message_is_tagged(ctx, i))
continue;
- cur = ctx->mailbox->hdrs[i];
+ cur = ctx->mailbox->emails[i];
curenv = cur->env;
break;
}
if (!message_is_tagged(ctx, i))
continue;
- if (mutt_fetch_recips(env, ctx->mailbox->hdrs[i]->env, flags) == -1)
+ if (mutt_fetch_recips(env, ctx->mailbox->emails[i]->env, flags) == -1)
return -1;
}
}
if (!message_is_tagged(ctx, i))
continue;
- if (include_reply(ctx, ctx->mailbox->hdrs[i], tempfp) == -1)
+ if (include_reply(ctx, ctx->mailbox->emails[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->mailbox, ctx->mailbox->hdrs[i], false);
+ tmp = mutt_make_message_attach(ctx->mailbox, ctx->mailbox->emails[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->mailbox->hdrs[i], tempfp);
+ include_forward(ctx, ctx->mailbox->emails[i], tempfp);
}
}
}
{
if (message_is_tagged(ctx, i))
{
- mutt_set_flag(ctx->mailbox, ctx->mailbox->hdrs[i], MUTT_REPLIED,
- is_reply(ctx->mailbox->hdrs[i], msg));
+ mutt_set_flag(ctx->mailbox, ctx->mailbox->emails[i], MUTT_REPLIED,
+ is_reply(ctx->mailbox->emails[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->mailbox->hdrs[i], to, resent_from, env_from);
+ rc |= bounce_message(fp, Context->mailbox->emails[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->mailbox, ctx->mailbox->hdrs[i], true);
+ mutt_score_message(ctx->mailbox, ctx->mailbox->emails[i], true);
}
OptNeedRescore = false;
return;
}
else
- qsort((void *) ctx->mailbox->hdrs, ctx->mailbox->msg_count,
+ qsort((void *) ctx->mailbox->emails, ctx->mailbox->msg_count,
sizeof(struct Email *), sortfunc);
/* adjust the virtual message numbers */
ctx->mailbox->vcount = 0;
for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
- struct Email *cur = ctx->mailbox->hdrs[i];
+ struct Email *cur = ctx->mailbox->emails[i];
if (cur->virtual != -1 || (cur->collapsed && (!ctx->pattern || cur->limited)))
{
cur->virtual = ctx->mailbox->vcount;