if (np && Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0))
{
- np->b->msg_count = Context->msgcount;
+ np->b->msg_count = Context->mailbox->msg_count;
np->b->msg_unread = Context->unread;
}
add_folder(menu, state, de->d_name, NULL, &s, np ? np->b : NULL, NULL);
{
if (Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0))
{
- np->b->msg_count = Context->msgcount;
+ np->b->msg_count = Context->mailbox->msg_count;
np->b->msg_unread = Context->unread;
}
#include "context.h"
#include "globals.h"
#include "keymap.h"
+#include "mailbox.h"
#include "menu.h"
#include "mutt_curses.h"
#include "options.h"
{
mutt_menu_set_redraw_full(MENU_MAIN);
/* force re-caching of index colors */
- for (int i = 0; Context && i < Context->msgcount; i++)
+ for (int i = 0; Context && i < Context->mailbox->msg_count; i++)
Context->hdrs[i]->pair = 0;
}
return 0;
/* force re-caching of index colors */
if (is_index)
{
- for (int i = 0; Context && i < Context->msgcount; i++)
+ for (int i = 0; Context && i < Context->mailbox->msg_count; i++)
Context->hdrs[i]->pair = 0;
}
else if (Context)
{
msgcount = 0; // count the precise number of messages.
- for (rc = 0; rc < Context->msgcount; rc++)
+ for (rc = 0; rc < Context->mailbox->msg_count; rc++)
{
if (message_is_tagged(Context, rc) && !Context->hdrs[rc]->env->from)
{
/* handle tagged messages */
if ((WithCrypto != 0) && decode)
{
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
if (!message_is_tagged(Context, i))
continue;
if (split)
{
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
if (!message_is_tagged(Context, i))
continue;
return 1;
}
OptKeepQuiet = true;
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
if (!message_is_tagged(Context, i))
continue;
else if (Context)
{
msgcount = 0; // count the precise number of messages.
- for (i = 0; i < Context->msgcount; i++)
+ for (i = 0; i < Context->mailbox->msg_count; i++)
if (message_is_tagged(Context, i))
msgcount++;
}
else
{
/* look for the first tagged message */
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
if (message_is_tagged(Context, i))
{
if (Context->magic == MUTT_NOTMUCH)
nm_longrun_init(Context, true);
#endif
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
if (!message_is_tagged(Context, i))
continue;
rc = check_traditional_pgp(h, redraw);
else
{
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
if (message_is_tagged(Context, i) && !(Context->hdrs[i]->security & PGP_TRADITIONAL_CHECKED))
{
break;
}
- if (!ctx->msgcount)
+ if (!ctx->mailbox->msg_count)
{
mx_mbox_close(&ctx, NULL);
mutt_error(_("No messages in that folder"));
break;
}
- for (i = 0; i < Context->msgcount; i++)
+ for (i = 0; i < Context->mailbox->msg_count; i++)
{
if (!message_is_tagged(Context, i))
continue;
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 msgcount; /**< number of messages in the mailbox */
int vcount; /**< the number of virtual messages */
int tagged; /**< how many messages are tagged? */
int new; /**< how many new messages? */
#include "context.h"
#include "enter_state.h"
#include "globals.h"
+#include "mailbox.h"
#include "menu.h"
#include "mutt_curses.h"
#include "mutt_logging.h"
*/
bool message_is_visible(struct Context *ctx, int index)
{
- if (!ctx || !ctx->hdrs || (index >= ctx->msgcount))
+ if (!ctx || !ctx->hdrs || (index >= ctx->mailbox->msg_count))
return false;
return !ctx->pattern || ctx->hdrs[index]->limited;
mutt_error(_(No_mailbox_is_open)); \
break; \
} \
- else if (!Context->msgcount) \
+ else if (!Context->mailbox->msg_count) \
{ \
mutt_flushinp(); \
mutt_error(_(There_are_no_messages)); \
struct MuttThread *thread = NULL, *top = NULL;
int final;
- if (!Context || (Context->msgcount == 0))
+ if (!Context || (Context->mailbox->msg_count == 0))
return;
/* Figure out what the current message would be after folding / unfolding,
*/
static int ci_first_message(void)
{
- if (!Context || !Context->msgcount)
+ if (!Context || !Context->mailbox->msg_count)
return 0;
int old = -1;
/* save the list of new messages */
if ((check != MUTT_REOPENED) && oldcount && (ctx->pattern || UncollapseNew))
{
- save_new = mutt_mem_malloc(sizeof(struct Header *) * (ctx->msgcount - oldcount));
- for (int i = oldcount; i < ctx->msgcount; i++)
+ 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];
}
if (ctx->pattern)
{
- for (int i = (check == MUTT_REOPENED) ? 0 : oldcount; i < ctx->msgcount; i++)
+ for (int i = (check == MUTT_REOPENED) ? 0 : oldcount; i < ctx->mailbox->msg_count; i++)
{
struct Header *h = NULL;
}
else if (oldcount)
{
- for (int j = 0; j < (ctx->msgcount - oldcount); j++)
+ for (int j = 0; j < (ctx->mailbox->msg_count - oldcount); j++)
{
if (!ctx->pattern || save_new[j]->limited)
{
if (ctx->pattern)
{
int padding = mx_msg_padding_size(ctx);
- for (int i = (check == MUTT_REOPENED) ? 0 : oldcount; i < ctx->msgcount; i++)
+ for (int i = (check == MUTT_REOPENED) ? 0 : oldcount; i < ctx->mailbox->msg_count; i++)
{
if (!i)
{
if (mutt_pattern_exec(ctx->limit_pattern, MUTT_MATCH_FULL_ADDRESS, ctx,
ctx->hdrs[i], NULL))
{
- assert(ctx->vcount < ctx->msgcount);
+ assert(ctx->vcount < ctx->mailbox->msg_count);
ctx->hdrs[i]->virtual = ctx->vcount;
ctx->v2r[ctx->vcount] = i;
ctx->hdrs[i]->limited = true;
else
#endif
new_last_folder = mutt_str_strdup(Context->mailbox->path);
- *oldcount = Context ? Context->msgcount : 0;
+ *oldcount = Context ? Context->mailbox->msg_count : 0;
int check = mx_mbox_close(&Context, index_hint);
if (check != 0)
* any 'op' below could do mutt_enter_command(), either here or
* from any new menu launched, and change $sort/$sort_aux
*/
- if (OptNeedResort && Context && Context->msgcount && menu->current >= 0)
+ if (OptNeedResort && Context && Context->mailbox->msg_count && menu->current >= 0)
resort_index(menu);
menu->max = Context ? Context->vcount : 0;
- oldcount = Context ? Context->msgcount : 0;
+ oldcount = Context ? Context->mailbox->msg_count : 0;
- if (OptRedrawTree && Context && Context->msgcount && (Sort & SORT_MASK) == SORT_THREADS)
+ if (OptRedrawTree && Context && Context->mailbox->msg_count && (Sort & SORT_MASK) == SORT_THREADS)
{
mutt_draw_tree(Context);
menu->redraw |= REDRAW_STATUS;
}
else if (check == MUTT_NEW_MAIL)
{
- for (i = oldcount; i < Context->msgcount; i++)
+ for (i = oldcount; i < Context->mailbox->msg_count; i++)
{
if (!Context->hdrs[i]->read)
{
rc2 = nntp_check_msgid(Context, buf);
if (rc2 == 0)
{
- hdr = Context->hdrs[Context->msgcount - 1];
+ hdr = Context->hdrs[Context->mailbox->msg_count - 1];
mutt_sort_headers(Context, false);
menu->current = hdr->virtual;
menu->redraw = REDRAW_FULL;
CHECK_ATTACH;
if (Context->magic == MUTT_NNTP)
{
- int oldmsgcount = Context->msgcount;
+ int oldmsgcount = Context->mailbox->msg_count;
int oldindex = CURHDR->index;
int rc2 = 0;
rc2 = nntp_check_children(Context, buf);
/* at least one message has been loaded */
- if (Context->msgcount > oldmsgcount)
+ if (Context->mailbox->msg_count > oldmsgcount)
{
struct Header *oldcur = CURHDR;
struct Header *hdr = NULL;
/* try to restore old position */
else
{
- for (int k = 0; k < Context->msgcount; k++)
+ for (int k = 0; k < Context->mailbox->msg_count; k++)
{
if (Context->hdrs[k]->index == oldindex)
{
}
else if (mutt_str_atoi(buf, &i) < 0)
mutt_error(_("Argument must be a message number"));
- else if ((i < 1) || (i > Context->msgcount))
+ else if ((i < 1) || (i > Context->mailbox->msg_count))
mutt_error(_("Invalid message number"));
else if (!message_is_visible(Context, i - 1))
mutt_error(_("That message is not visible"));
}
else
menu->current = 0;
- if (Context->msgcount && (Sort & SORT_MASK) == SORT_THREADS)
+ if (Context->mailbox->msg_count && (Sort & SORT_MASK) == SORT_THREADS)
mutt_draw_tree(Context);
menu->redraw = REDRAW_FULL;
}
{
int check;
- oldcount = Context ? Context->msgcount : 0;
+ oldcount = Context ? Context->mailbox->msg_count : 0;
mutt_startup_shutdown_hook(MUTT_SHUTDOWN_HOOK);
if (mutt_select_sort((op == OP_SORT_REVERSE)) == 0)
{
- if (Context && Context->msgcount)
+ if (Context && Context->mailbox->msg_count)
{
resort_index(menu);
OptSearchInvalid = true;
CHECK_VISIBLE;
if (tag && !AutoTag)
{
- for (j = 0; j < Context->msgcount; j++)
+ 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);
menu->redraw |= REDRAW_STATUS | REDRAW_INDEX;
case OP_MAIN_SYNC_FOLDER:
- if (Context && !Context->msgcount)
+ if (Context && !Context->mailbox->msg_count)
break;
CHECK_MSGCOUNT;
CHECK_READONLY;
{
int ovc = Context->vcount;
- int oc = Context->msgcount;
+ int oc = Context->mailbox->msg_count;
int check;
struct Header *newhdr = NULL;
CHECK_VISIBLE;
if (tag)
{
- for (j = 0; j < Context->msgcount; j++)
+ for (j = 0; j < Context->mailbox->msg_count; j++)
{
if (message_is_tagged(Context, j))
{
}
CHECK_MSGCOUNT;
CHECK_VISIBLE;
- int oc = Context->msgcount;
+ int oc = Context->mailbox->msg_count;
if (nm_read_entire_thread(Context, CURHDR) < 0)
{
mutt_message(_("Failed to read thread, aborting"));
break;
}
- if (oc < Context->msgcount)
+ if (oc < Context->mailbox->msg_count)
{
struct Header *oldcur = CURHDR;
if (Context->magic == MUTT_NOTMUCH)
nm_longrun_init(Context, true);
#endif
- for (px = 0, j = 0; j < Context->msgcount; j++)
+ for (px = 0, j = 0; j < Context->mailbox->msg_count; j++)
{
if (!message_is_tagged(Context, j))
continue;
menu->menu = MENU_PAGER;
menu->oldcurrent = menu->current;
if (Context)
- update_index(menu, Context, MUTT_NEW_MAIL, Context->msgcount, hint);
+ update_index(menu, Context, MUTT_NEW_MAIL, Context->mailbox->msg_count, hint);
continue;
if (tag)
{
- for (j = 0; j < Context->msgcount; j++)
+ for (j = 0; j < Context->mailbox->msg_count; j++)
{
if (message_is_tagged(Context, j))
{
if (tag)
{
- for (j = 0; j < Context->msgcount; j++)
+ for (j = 0; j < Context->mailbox->msg_count; j++)
{
if (!message_is_tagged(Context, j))
continue;
if (tag)
{
- for (j = 0; j < Context->msgcount; j++)
+ for (j = 0; j < Context->mailbox->msg_count; j++)
{
if (message_is_tagged(Context, j))
mutt_resend_message(NULL, Context, Context->hdrs[j]);
regmatch_t pmatch[1];
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
struct Envelope *e = Context->hdrs[i]->env;
if (!e || !e->subject)
#include "curs_lib.h"
#include "globals.h"
#include "hdrline.h"
+#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_header.h"
#include "mutt_window.h"
while ((msg = strtok(msg, " ,")))
{
- if (mutt_str_atoi(msg, &n) == 0 && n > 0 && n <= Context->msgcount)
+ if (mutt_str_atoi(msg, &n) == 0 && n > 0 && n <= Context->mailbox->msg_count)
{
n--;
if (hdr)
return edit_or_view_one_message(edit, ctx, hdr);
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!message_is_tagged(ctx, i))
continue;
#include "curs_lib.h"
#include "curs_main.h"
#include "globals.h"
+#include "mailbox.h"
#include "menu.h"
#include "mutt_curses.h"
#include "mutt_window.h"
*/
void mutt_tag_set_flag(int flag, int bf)
{
- for (int i = 0; i < Context->msgcount; i++)
+ 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);
}
if (ctx)
{
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, ctx->msgcount);
+ snprintf(buf, buflen, fmt, ctx->mailbox->msg_count);
}
else
mutt_str_strfcpy(buf, "(null)", buflen);
{
if (Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0))
{
- np->b->msg_count = Context->msgcount;
+ np->b->msg_count = Context->mailbox->msg_count;
np->b->msg_unread = Context->unread;
}
(state->entry)[state->entrylen].has_mailbox = true;
bool started = false;
struct Header **hdrs = idata->ctx->hdrs;
- for (n = *pos; n < idata->ctx->msgcount && buf->dptr - buf->data < IMAP_MAX_CMDLEN; n++)
+ for (n = *pos; n < idata->ctx->mailbox->msg_count && buf->dptr - buf->data < IMAP_MAX_CMDLEN; n++)
{
bool match = false; /* whether current message matches flag condition */
/* don't include pending expunged messages */
mutt_buffer_printf(buf, ",%u", HEADER_DATA(hdrs[n])->uid);
}
/* tie up if the last message also matches */
- else if (n == idata->ctx->msgcount - 1)
+ else if (n == idata->ctx->mailbox->msg_count - 1)
mutt_buffer_printf(buf, ":%u", HEADER_DATA(hdrs[n])->uid);
}
/* End current set if message doesn't match or we've reached the end
* of the mailbox via inactive messages following the last match. */
- else if (setstart && (hdrs[n]->active || n == idata->ctx->msgcount - 1))
+ else if (setstart && (hdrs[n]->active || n == idata->ctx->mailbox->msg_count - 1))
{
if (HEADER_DATA(hdrs[n - 1])->uid > setstart)
mutt_buffer_printf(buf, ":%u", HEADER_DATA(hdrs[n - 1])->uid);
Sort = SORT_ORDER;
mutt_sort_headers(idata->ctx, false);
- for (int i = 0; i < idata->ctx->msgcount; i++)
+ for (int i = 0; i < idata->ctx->mailbox->msg_count; i++)
{
h = idata->ctx->hdrs[i];
if (Sort != SORT_ORDER)
{
hdrs = idata->ctx->hdrs;
- idata->ctx->hdrs = mutt_mem_malloc(idata->ctx->msgcount * sizeof(struct Header *));
- memcpy(idata->ctx->hdrs, hdrs, idata->ctx->msgcount * sizeof(struct Header *));
+ idata->ctx->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 *));
Sort = SORT_ORDER;
- qsort(idata->ctx->hdrs, idata->ctx->msgcount, sizeof(struct Header *),
+ qsort(idata->ctx->hdrs, idata->ctx->mailbox->msg_count, sizeof(struct Header *),
mutt_get_sort_func(SORT_ORDER));
}
* Note that imap_mxcmp() converts NULL to "INBOX", so we need to
* make sure the idata really is open to a folder. */
if (idata->ctx && !imap_mxcmp(buf, idata->mailbox))
- return idata->ctx->msgcount;
+ return idata->ctx->mailbox->msg_count;
else if (mutt_bit_isset(idata->capabilities, IMAP4REV1) ||
mutt_bit_isset(idata->capabilities, STATUS))
{
{
struct Buffer buf;
struct ImapData *idata = ctx->data;
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
ctx->hdrs[i]->matched = false;
if (do_search(pat, 1) == 0)
imap_munge_mbox_name(idata, mmbox, sizeof(mmbox), mbox);
sync_cmd = mutt_buffer_new();
- for (int i = 0; i < ctx->msgcount; i++)
+ 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)
ctx->hdrmax = count;
ctx->hdrs = mutt_mem_calloc(count, sizeof(struct Header *));
ctx->v2r = mutt_mem_calloc(count, sizeof(int));
- ctx->msgcount = 0;
+ ctx->mailbox->msg_count = 0;
if (count && (imap_read_headers(idata, 1, count, true) < 0))
{
goto fail;
}
- mutt_debug(2, "msgcount is %d\n", ctx->msgcount);
+ mutt_debug(2, "mailbox->msg_count is %d\n", ctx->mailbox->msg_count);
FREE(&mx.mbox);
return 0;
}
/* free IMAP part of headers */
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
/* mailbox may not have fully loaded */
if (ctx->hdrs[i] && ctx->hdrs[i]->data)
{
/* 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->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->changed)
ctx->hdrs[i]->active = false;
mutt_message(ngettext("Marking %d message deleted...",
#endif
/* save messages with real (non-flag) changes */
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
h = ctx->hdrs[i];
{
/* L10N: The plural is choosen by the last %d, i.e. the total number */
mutt_message(ngettext("Saving changed message... [%d/%d]",
- "Saving changed messages... [%d/%d]", ctx->msgcount),
- i + 1, ctx->msgcount);
+ "Saving changed messages... [%d/%d]", ctx->mailbox->msg_count),
+ i + 1, ctx->mailbox->msg_count);
if (!appendctx)
appendctx = mx_mbox_open(ctx->mailbox->path, MUTT_APPEND | MUTT_QUIET);
if (!appendctx)
if (Sort != SORT_ORDER)
{
hdrs = ctx->hdrs;
- ctx->hdrs = mutt_mem_malloc(ctx->msgcount * sizeof(struct Header *));
- memcpy(ctx->hdrs, hdrs, ctx->msgcount * sizeof(struct Header *));
+ ctx->hdrs = mutt_mem_malloc(ctx->mailbox->msg_count * sizeof(struct Header *));
+ memcpy(ctx->hdrs, hdrs, ctx->mailbox->msg_count * sizeof(struct Header *));
Sort = SORT_ORDER;
- qsort(ctx->hdrs, ctx->msgcount, sizeof(struct Header *), mutt_get_sort_func(SORT_ORDER));
+ qsort(ctx->hdrs, ctx->mailbox->msg_count, sizeof(struct Header *), mutt_get_sort_func(SORT_ORDER));
}
rc = sync_helper(idata, MUTT_ACL_DELETE, MUTT_DELETED, "\\Deleted");
/* Update local record of server state to reflect the synchronization just
* completed. imap_read_headers always overwrites hcache-origin flags, so
* there is no need to mutate the hcache after flag-only changes. */
- for (int i = 0; i < ctx->msgcount; i++)
+ 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;
char buf[LONG_STRING];
struct Context *ctx = idata->ctx;
- int idx = ctx->msgcount;
+ int idx = ctx->mailbox->msg_count;
/* L10N:
Comparing the cached data with the IMAP server's data */
STAILQ_INIT(&ctx->hdrs[idx]->tags);
driver_tags_replace(&ctx->hdrs[idx]->tags, mutt_str_strdup(h.data->flags_remote));
- ctx->msgcount++;
+ ctx->mailbox->msg_count++;
ctx->size += ctx->hdrs[idx]->content->length;
/* If this is the first time we are fetching, we need to
idata->max_msn = MAX(idata->max_msn, msn);
idata->msn_index[msn - 1] = h;
- if (ctx->msgcount >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->hdrmax)
mx_alloc_memory(ctx);
struct ImapHeaderData *ihd = mutt_mem_calloc(1, sizeof(struct ImapHeaderData));
h->data = ihd;
- h->index = ctx->msgcount;
+ h->index = ctx->mailbox->msg_count;
h->active = true;
h->changed = false;
ihd->read = h->read;
mutt_hash_int_insert(idata->uid_hash, uid, h);
ctx->size += h->content->length;
- ctx->hdrs[ctx->msgcount++] = h;
+ ctx->hdrs[ctx->mailbox->msg_count++] = h;
msn++;
}
"X-ORIGINAL-TO";
struct Context *ctx = idata->ctx;
- int idx = ctx->msgcount;
+ int idx = ctx->mailbox->msg_count;
if (mutt_bit_isset(idata->capabilities, IMAP4REV1))
{
imap_hcache_put(idata, ctx->hdrs[idx]);
#endif /* USE_HCACHE */
- ctx->msgcount++;
+ ctx->mailbox->msg_count++;
h.data = NULL;
idx++;
alloc_msn_index(idata, msn_end);
imap_alloc_uid_hash(idata, msn_end);
- oldmsgcount = ctx->msgcount;
+ oldmsgcount = ctx->mailbox->msg_count;
idata->reopen &= ~(IMAP_REOPEN_ALLOW | IMAP_NEWMAIL_PENDING);
idata->new_mail_count = 0;
}
#endif /* USE_HCACHE */
- if (ctx->msgcount > oldmsgcount)
+ if (ctx->mailbox->msg_count > oldmsgcount)
{
/* TODO: it's not clear to me why we are calling mx_alloc_memory
* yet again. */
mx_alloc_memory(ctx);
- mx_update_context(ctx, ctx->msgcount - oldmsgcount);
+ mx_update_context(ctx, ctx->mailbox->msg_count - oldmsgcount);
}
idata->reopen |= IMAP_REOPEN_ALLOW;
/* if any messages have attachments to delete, fall through to FETCH
* and APPEND. TODO: Copy what we can with COPY, fall through for the
* remainder. */
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!message_is_tagged(ctx, i))
continue;
{
if (!h)
{
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!message_is_tagged(ctx, i))
continue;
if (!Context)
return;
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
Context->hdrs[i]->recip_valid = false;
}
if (!Context)
return;
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
Context->hdrs[i]->attach_valid = false;
}
if (!Context)
return;
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
FREE(&Context->hdrs[i]->env->disp_subj);
}
mx_mbox_open(mailbox->path, MUTT_READONLY | MUTT_QUIET | MUTT_NOSORT | MUTT_PEEK);
if (ctx)
{
- mailbox->msg_count = ctx->msgcount;
+ mailbox->msg_count = ctx->mailbox->msg_count;
mailbox->msg_unread = ctx->unread;
mailbox->msg_flagged = ctx->flagged;
mailbox->stats_last_checked = ctx->mtime;
mutt_file_fclose(&ofp);
/* now, update our unseen, flagged, and replied sequences */
- for (l = 0; l < ctx->msgcount; l++)
+ for (l = 0; l < ctx->mailbox->msg_count; l++)
{
if (ctx->hdrs[l]->deleted)
continue;
*/
static bool maildir_add_to_context(struct Context *ctx, struct Maildir *md)
{
- int oldmsgcount = ctx->msgcount;
+ int oldmsgcount = ctx->mailbox->msg_count;
while (md)
{
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->msgcount == ctx->hdrmax)
+ if (ctx->mailbox->msg_count == ctx->hdrmax)
mx_alloc_memory(ctx);
- ctx->hdrs[ctx->msgcount] = md->h;
- ctx->hdrs[ctx->msgcount]->index = ctx->msgcount;
+ ctx->hdrs[ctx->mailbox->msg_count] = md->h;
+ ctx->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;
md->h = NULL;
- ctx->msgcount++;
+ ctx->mailbox->msg_count++;
}
md = md->next;
}
- if (ctx->msgcount > oldmsgcount)
+ if (ctx->mailbox->msg_count > oldmsgcount)
{
- mx_update_context(ctx, ctx->msgcount - oldmsgcount);
+ mx_update_context(ctx, ctx->mailbox->msg_count - oldmsgcount);
return true;
}
return false;
Sort = old_sort;
}
- const int old_count = ctx->msgcount;
+ 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)
}
/* check for modifications and adjust flags */
- for (int i = 0; i < ctx->msgcount; i++)
+ 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));
mutt_hash_insert(fnames, p->canon_fname, p);
}
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
ctx->hdrs[i]->active = false;
if (!ctx->quiet)
{
snprintf(msgbuf, sizeof(msgbuf), _("Writing %s..."), ctx->mailbox->path);
- mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc, ctx->msgcount);
+ mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc, ctx->mailbox->msg_count);
}
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!ctx->quiet)
mutt_progress_update(&progress, i, -1);
if (ctx->deleted)
{
- for (i = 0, j = 0; i < ctx->msgcount; i++)
+ for (i = 0, j = 0; i < ctx->mailbox->msg_count; i++)
{
if (!ctx->hdrs[i]->deleted || (ctx->magic == MUTT_MAILDIR && MaildirTrash))
ctx->hdrs[i]->index = j++;
{
char buf[HUGE_STRING];
char return_path[LONG_STRING];
- int count = 0, oldmsgcount = ctx->msgcount;
+ int count = 0, oldmsgcount = ctx->mailbox->msg_count;
int lines;
time_t t;
LOFF_T loc, tmploc;
if (!ctx->quiet)
mutt_progress_update(&progress, count, (int) (loc / (ctx->size / 100 + 1)));
- if (ctx->msgcount == ctx->hdrmax)
+ if (ctx->mailbox->msg_count == ctx->hdrmax)
mx_alloc_memory(ctx);
hdr = mutt_header_new();
- ctx->hdrs[ctx->msgcount] = hdr;
+ ctx->hdrs[ctx->mailbox->msg_count] = hdr;
hdr->offset = loc;
- hdr->index = ctx->msgcount;
+ hdr->index = ctx->mailbox->msg_count;
if (!fgets(buf, sizeof(buf) - 1, ctx->fp))
{
if (!hdr->env->from)
hdr->env->from = mutt_addr_copy_list(hdr->env->return_path, false);
- ctx->msgcount++;
+ ctx->mailbox->msg_count++;
}
else
{
}
}
- if (ctx->msgcount > oldmsgcount)
- mx_update_context(ctx, ctx->msgcount - oldmsgcount);
+ if (ctx->mailbox->msg_count > oldmsgcount)
+ mx_update_context(ctx, ctx->mailbox->msg_count - oldmsgcount);
if (SigInt == 1)
{
/* Save the Content-Length of the previous message */
if (count > 0)
{
- struct Header *h = ctx->hdrs[ctx->msgcount - 1];
+ struct Header *h = ctx->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->msgcount == ctx->hdrmax)
+ if (ctx->mailbox->msg_count == ctx->hdrmax)
mx_alloc_memory(ctx);
- ctx->hdrs[ctx->msgcount] = mutt_header_new();
- curhdr = ctx->hdrs[ctx->msgcount];
+ ctx->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
+ curhdr = ctx->hdrs[ctx->mailbox->msg_count];
curhdr->received = t - mutt_date_local_tz(t);
curhdr->offset = loc;
- curhdr->index = ctx->msgcount;
+ curhdr->index = ctx->mailbox->msg_count;
curhdr->env = mutt_rfc822_read_header(ctx->fp, curhdr, false, false);
}
}
- ctx->msgcount++;
+ ctx->mailbox->msg_count++;
if (!curhdr->env->return_path && return_path[0])
{
*/
if (count > 0)
{
- struct Header *h = ctx->hdrs[ctx->msgcount - 1];
+ struct Header *h = ctx->hdrs[ctx->mailbox->msg_count - 1];
if (h->content->length < 0)
{
h->content->length = ftello(ctx->fp) - h->content->offset - 1;
FREE(&ctx->v2r);
if (ctx->readonly)
{
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
mutt_header_free(&(ctx->hdrs[i])); /* nothing to do! */
FREE(&ctx->hdrs);
}
else
{
/* save the old headers */
- old_msgcount = ctx->msgcount;
+ old_msgcount = ctx->mailbox->msg_count;
old_hdrs = ctx->hdrs;
ctx->hdrs = NULL;
}
ctx->hdrmax = 0; /* force allocation of new headers */
- ctx->msgcount = 0;
+ ctx->mailbox->msg_count = 0;
ctx->vcount = 0;
ctx->vsize = 0;
ctx->tagged = 0;
if (!ctx->readonly)
{
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
bool found = false;
*/
static bool mbox_has_new(struct Context *ctx)
{
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
if (!ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read && !ctx->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->msgcount) && !ctx->hdrs[i]->deleted &&
+ for (i = 0; (i < ctx->mailbox->msg_count) && !ctx->hdrs[i]->deleted &&
!ctx->hdrs[i]->changed && !ctx->hdrs[i]->attach_del;
i++)
{
}
- if (i == ctx->msgcount)
+ if (i == ctx->mailbox->msg_count)
{
/* this means ctx->changed or ctx->deleted was set, but no
* messages were found to be changed or deleted. This should
offset -= (sizeof(MMDF_SEP) - 1);
/* allocate space for the new offsets */
- new_offset = mutt_mem_calloc(ctx->msgcount - first, sizeof(struct MUpdate));
- old_offset = mutt_mem_calloc(ctx->msgcount - first, sizeof(struct MUpdate));
+ new_offset = mutt_mem_calloc(ctx->mailbox->msg_count - first, sizeof(struct MUpdate));
+ old_offset = mutt_mem_calloc(ctx->mailbox->msg_count - first, sizeof(struct MUpdate));
if (!ctx->quiet)
{
snprintf(msgbuf, sizeof(msgbuf), _("Writing %s..."), ctx->mailbox->path);
- mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc, ctx->msgcount);
+ mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc, ctx->mailbox->msg_count);
}
- for (i = first, j = 0; i < ctx->msgcount; i++)
+ for (i = first, j = 0; i < ctx->mailbox->msg_count; i++)
{
if (!ctx->quiet)
mutt_progress_update(&progress, i, (int) (ftello(ctx->fp) / (ctx->size / 100 + 1)));
}
/* update the offsets of the rewritten messages */
- for (i = first, j = first; i < ctx->msgcount; i++)
+ for (i = first, j = first; i < ctx->mailbox->msg_count; i++)
{
if (!ctx->hdrs[i]->deleted)
{
/* restore offsets, as far as they are valid */
if (first >= 0 && old_offset)
{
- for (i = first; (i < ctx->msgcount) && old_offset[i - first].valid; i++)
+ 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;
#include "curs_lib.h"
#include "curs_main.h"
#include "globals.h"
+#include "mailbox.h"
#include "muttlib.h"
#include "ncrypt/ncrypt.h"
#include "options.h"
}
else
{
- for (int i = 0; i < Context->msgcount; ++i)
+ for (int i = 0; i < Context->mailbox->msg_count; ++i)
{
if (!message_is_tagged(Context, i))
continue;
#include "mutt_thread.h"
#include "context.h"
#include "curs_lib.h"
+#include "mailbox.h"
#include "mx.h"
#include "protos.h"
#include "sort.h"
static void linearize_tree(struct Context *ctx)
{
struct MuttThread *tree = ctx->tree;
- struct Header **array = ctx->hdrs + ((Sort & SORT_REVERSE) ? ctx->msgcount - 1 : 0);
+ struct Header **array = ctx->hdrs + ((Sort & SORT_REVERSE) ? ctx->mailbox->msg_count - 1 : 0);
while (tree)
{
*/
static struct Hash *make_subj_hash(struct Context *ctx)
{
- struct Hash *hash = mutt_hash_create(ctx->msgcount * 2, MUTT_HASH_ALLOW_DUPS);
+ struct Hash *hash = mutt_hash_create(ctx->mailbox->msg_count * 2, MUTT_HASH_ALLOW_DUPS);
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
struct Header *hdr = ctx->hdrs[i];
if (hdr->env->real_subj)
*/
void mutt_clear_threads(struct Context *ctx)
{
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
/* mailbox may have been only partially read */
if (ctx->hdrs[i])
{
struct Header *cur = NULL;
struct MuttThread *tmp = NULL;
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
cur = ctx->hdrs[i];
if (cur->thread->check_subject)
if (init)
{
- ctx->thread_hash = mutt_hash_create(ctx->msgcount * 2, MUTT_HASH_ALLOW_DUPS);
+ ctx->thread_hash = mutt_hash_create(ctx->mailbox->msg_count * 2, MUTT_HASH_ALLOW_DUPS);
mutt_hash_set_destructor(ctx->thread_hash, thread_hash_destructor, 0);
}
* exists. otherwise, if there is a MuttThread that already has a message, thread
* new message as an identical child. if we didn't attach the message to a
* MuttThread, make a new one for it. */
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
cur = ctx->hdrs[i];
}
/* thread by references */
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
cur = ctx->hdrs[i];
if (cur->threaded)
ctx->vsize = 0;
int padding = mx_msg_padding_size(ctx);
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
cur = ctx->hdrs[i];
if (cur->virtual >= 0)
rc = threads[0]->message->msgno - (threads[1] ? threads[1]->message->msgno : -1);
else
{
- rc = (threads[1] ? threads[1]->message->msgno : ctx->msgcount) -
+ rc = (threads[1] ? threads[1]->message->msgno : ctx->mailbox->msg_count) -
threads[0]->message->msgno;
}
*/
struct Hash *mutt_make_id_hash(struct Context *ctx)
{
- struct Hash *hash = mutt_hash_create(ctx->msgcount * 2, 0);
+ struct Hash *hash = mutt_hash_create(ctx->mailbox->msg_count * 2, 0);
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
struct Header *hdr = ctx->hdrs[i];
if (hdr->env->message_id)
if (!last)
{
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
if (message_is_tagged(ctx, i))
changed |= link_threads(cur, ctx->hdrs[i], ctx);
}
mutt_hash_destroy(&ctx->id_hash);
mutt_hash_destroy(&ctx->label_hash);
mutt_clear_threads(ctx);
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
mutt_header_free(&ctx->hdrs[i]);
FREE(&ctx->hdrs);
FREE(&ctx->v2r);
int delmsgcount = 0;
int first_del = -1;
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (ctx->hdrs[i]->deleted && (!ctx->hdrs[i]->purge))
{
if (ctx_trash)
{
/* continue from initial scan above */
- for (i = first_del; i < ctx->msgcount; i++)
+ for (i = first_del; i < ctx->mailbox->msg_count; i++)
{
if (ctx->hdrs[i]->deleted && (!ctx->hdrs[i]->purge))
{
}
#endif
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read && !(ctx->hdrs[i]->flagged && KeepFlagged))
{
if (MarkOld)
{
- for (i = 0; i < ctx->msgcount; i++)
+ 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->magic == MUTT_IMAP) && (imap_path_probe(mbox, NULL) == MUTT_IMAP))
{
/* tag messages for moving, and clear old tags, if any */
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (ctx->hdrs[i]->read && !ctx->hdrs[i]->deleted &&
!(ctx->hdrs[i]->flagged && KeepFlagged))
return -1;
}
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (ctx->hdrs[i]->read && !ctx->hdrs[i]->deleted &&
!(ctx->hdrs[i]->flagged && KeepFlagged))
{
if (!purge)
{
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
ctx->hdrs[i]->deleted = false;
ctx->hdrs[i]->purge = false;
if (move_messages)
{
mutt_message(_("%d kept, %d moved, %d deleted"),
- ctx->msgcount - ctx->deleted, read_msgs, ctx->deleted);
+ ctx->mailbox->msg_count - ctx->deleted, read_msgs, ctx->deleted);
}
else
- mutt_message(_("%d kept, %d deleted"), ctx->msgcount - ctx->deleted, ctx->deleted);
+ mutt_message(_("%d kept, %d deleted"), ctx->mailbox->msg_count - ctx->deleted, ctx->deleted);
}
- if (ctx->msgcount == ctx->deleted && (ctx->magic == MUTT_MMDF || ctx->magic == MUTT_MBOX) &&
+ if (ctx->mailbox->msg_count == ctx->deleted && (ctx->magic == MUTT_MMDF || ctx->magic == MUTT_MBOX) &&
!mutt_is_spool(ctx->mailbox->path) && !SaveEmpty)
{
mutt_file_unlink_empty(ctx->mailbox->path);
#ifdef USE_SIDEBAR
if (purge && ctx->deleted)
{
- int orig_msgcount = ctx->msgcount;
+ int orig_msgcount = ctx->mailbox->msg_count;
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read)
ctx->unread--;
if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged)
ctx->flagged--;
}
- ctx->msgcount -= ctx->deleted;
+ ctx->mailbox->msg_count -= ctx->deleted;
mutt_sb_set_mailbox_stats(ctx);
- ctx->msgcount = orig_msgcount;
+ ctx->mailbox->msg_count = orig_msgcount;
}
#endif
ctx->changed = false;
ctx->flagged = 0;
padding = mx_msg_padding_size(ctx);
- for (i = 0, j = 0; i < ctx->msgcount; i++)
+ for (i = 0, j = 0; i < ctx->mailbox->msg_count; i++)
{
if (!ctx->hdrs[i]->quasi_deleted &&
((committing && (!ctx->hdrs[i]->deleted || (ctx->magic == MUTT_MAILDIR && MaildirTrash))) ||
mutt_header_free(&ctx->hdrs[i]);
}
}
- ctx->msgcount = j;
+ ctx->mailbox->msg_count = j;
}
/**
/* let IMAP servers hold on to D flags */
if (ctx->magic != MUTT_IMAP)
{
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
ctx->hdrs[i]->deleted = false;
ctx->hdrs[i]->purge = false;
/* really only for IMAP - imap_sync_mailbox results in a call to
* mx_update_tables, so ctx->deleted is 0 when it comes back */
- msgcount = ctx->msgcount;
+ msgcount = ctx->mailbox->msg_count;
deleted = ctx->deleted;
if (purge && ctx->deleted && (mutt_str_strcmp(ctx->mailbox->path, Trash) != 0))
mutt_sleep(0);
- if (ctx->msgcount == ctx->deleted && (ctx->magic == MUTT_MBOX || ctx->magic == MUTT_MMDF) &&
+ if (ctx->mailbox->msg_count == ctx->deleted && (ctx->magic == MUTT_MBOX || ctx->magic == MUTT_MMDF) &&
!mutt_is_spool(ctx->mailbox->path) && !SaveEmpty)
{
unlink(ctx->mailbox->path);
ctx->hdrs = mutt_mem_calloc((ctx->hdrmax += 25), sizeof(struct Header *));
ctx->v2r = mutt_mem_calloc(ctx->hdrmax, sizeof(int));
}
- for (int i = ctx->msgcount; i < ctx->hdrmax; i++)
+ for (int i = ctx->mailbox->msg_count; i < ctx->hdrmax; i++)
{
ctx->hdrs[i] = NULL;
ctx->v2r[i] = -1;
void mx_update_context(struct Context *ctx, int new_messages)
{
struct Header *h = NULL;
- for (int msgno = ctx->msgcount - new_messages; msgno < ctx->msgcount; msgno++)
+ for (int msgno = ctx->mailbox->msg_count - new_messages; msgno < ctx->mailbox->msg_count; msgno++)
{
h = ctx->hdrs[msgno];
#include "curs_lib.h"
#include "globals.h"
#include "handler.h"
+#include "mailbox.h"
#include "mutt_curses.h"
#include "mutt_parse.h"
#include "muttlib.h"
if (!h)
{
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
if (!message_is_tagged(Context, i))
continue;
#include "context.h"
#include "format_flags.h"
#include "globals.h"
+#include "mailbox.h"
#include "mutt_account.h"
#include "mutt_logging.h"
#include "mutt_socket.h"
* first article in our list */
nntp_data->newsrc_len = 0;
series = true;
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
/* search for first unread */
if (series)
nntp_data->unread = 0;
if (Context && Context->data == nntp_data)
{
- for (unsigned int i = 0; i < Context->msgcount; i++)
+ for (unsigned int i = 0; i < Context->mailbox->msg_count; i++)
mutt_set_flag(Context, Context->hdrs[i], MUTT_READ, 1);
}
return nntp_data;
}
if (Context && Context->data == nntp_data)
{
- nntp_data->unread = Context->msgcount;
- for (unsigned int i = 0; i < Context->msgcount; i++)
+ 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);
}
else
{
unsigned int unread = 0;
- for (unsigned int j = 0; j < Context->msgcount; j++)
+ for (unsigned int j = 0; j < Context->mailbox->msg_count; j++)
if (!Context->hdrs[j]->read && !Context->hdrs[j]->deleted)
unread++;
if (!unread)
rewind(fp);
/* allocate memory for headers */
- if (ctx->msgcount >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->hdrmax)
mx_alloc_memory(ctx);
/* parse header */
- ctx->hdrs[ctx->msgcount] = mutt_header_new();
- hdr = ctx->hdrs[ctx->msgcount];
+ ctx->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
+ hdr = ctx->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->msgcount] = hdr;
+ ctx->hdrs[ctx->mailbox->msg_count] = hdr;
mutt_hcache_free(fc->hc, &hdata);
hdr->data = NULL;
hdr->read = false;
if (save)
{
- hdr->index = ctx->msgcount++;
+ hdr->index = ctx->mailbox->msg_count++;
hdr->read = false;
hdr->old = false;
hdr->deleted = false;
struct Header *hdr = NULL;
char buf[HUGE_STRING];
int rc = 0;
- int oldmsgcount = ctx->msgcount;
+ int oldmsgcount = ctx->mailbox->msg_count;
anum_t current;
anum_t first_over = first;
#ifdef USE_HCACHE
continue;
/* allocate memory for headers */
- if (ctx->msgcount >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->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->msgcount] = hdr;
+ ctx->hdrs[ctx->mailbox->msg_count] = hdr;
mutt_hcache_free(fc.hc, &hdata);
hdr->data = NULL;
}
/* parse header */
- ctx->hdrs[ctx->msgcount] = mutt_header_new();
- hdr = ctx->hdrs[ctx->msgcount];
+ ctx->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
+ hdr = ctx->hdrs[ctx->mailbox->msg_count];
hdr->env = mutt_rfc822_read_header(fp, hdr, false, false);
hdr->received = hdr->date_sent;
mutt_file_fclose(&fp);
}
/* save header in context */
- hdr->index = ctx->msgcount++;
+ hdr->index = ctx->mailbox->msg_count++;
hdr->read = false;
hdr->old = false;
hdr->deleted = false;
}
}
- if (ctx->msgcount > oldmsgcount)
- mx_update_context(ctx, ctx->msgcount - oldmsgcount);
+ if (ctx->mailbox->msg_count > oldmsgcount)
+ mx_update_context(ctx, ctx->mailbox->msg_count - oldmsgcount);
FREE(&fc.messages);
if (rc != 0)
/* articles have been renumbered, remove all headers */
if (nntp_data->last_message < nntp_data->last_loaded)
{
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
mutt_header_free(&ctx->hdrs[i]);
- ctx->msgcount = 0;
+ ctx->mailbox->msg_count = 0;
ctx->tagged = 0;
if (nntp_data->last_message < nntp_data->last_loaded)
/* update flags according to .newsrc */
int j = 0;
anum_t anum;
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
bool flagged = false;
anum = NHDR(ctx->hdrs[i])->article_num;
}
#ifdef USE_HCACHE
- ctx->msgcount = j;
+ ctx->mailbox->msg_count = j;
/* restore headers without "deleted" flag */
for (anum = first; anum <= nntp_data->last_loaded; anum++)
if (hdata)
{
mutt_debug(2, "#2 mutt_hcache_fetch %s\n", buf);
- if (ctx->msgcount >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->hdrmax)
mx_alloc_memory(ctx);
hdr = mutt_hcache_restore(hdata);
- ctx->hdrs[ctx->msgcount] = hdr;
+ ctx->hdrs[ctx->mailbox->msg_count] = hdr;
mutt_hcache_free(hc, &hdata);
hdr->data = NULL;
if (hdr->deleted)
continue;
}
- ctx->msgcount++;
+ ctx->mailbox->msg_count++;
hdr->read = false;
hdr->old = false;
hdr->data = mutt_mem_calloc(1, sizeof(struct NntpHeaderData));
ctx->changed = false;
ctx->id_hash = NULL;
ctx->subj_hash = NULL;
- mx_update_context(ctx, ctx->msgcount);
+ mx_update_context(ctx, ctx->mailbox->msg_count);
}
/* fetch headers of new articles */
if (nntp_data->last_message > nntp_data->last_loaded)
{
- int oldmsgcount = ctx->msgcount;
+ int oldmsgcount = ctx->mailbox->msg_count;
bool quiet = ctx->quiet;
ctx->quiet = true;
#ifdef USE_HCACHE
ctx->quiet = quiet;
if (rc >= 0)
nntp_data->last_loaded = nntp_data->last_message;
- if (ret == 0 && ctx->msgcount > oldmsgcount)
+ if (ret == 0 && ctx->mailbox->msg_count > oldmsgcount)
ret = MUTT_NEW_MAIL;
}
hc = nntp_hcache_open(nntp_data);
#endif
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
struct Header *hdr = ctx->hdrs[i];
char buf[16];
}
/* parse header */
- if (ctx->msgcount == ctx->hdrmax)
+ if (ctx->mailbox->msg_count == ctx->hdrmax)
mx_alloc_memory(ctx);
- ctx->hdrs[ctx->msgcount] = mutt_header_new();
- struct Header *hdr = ctx->hdrs[ctx->msgcount];
+ ctx->hdrs[ctx->mailbox->msg_count] = mutt_header_new();
+ struct Header *hdr = ctx->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);
hdr->deleted = false;
hdr->changed = true;
hdr->received = hdr->date_sent;
- hdr->index = ctx->msgcount++;
+ hdr->index = ctx->mailbox->msg_count++;
mx_update_context(ctx, 1);
return 0;
}
if (!line || sscanf(line, ANUM, &anum) != 1)
return 0;
- for (unsigned int i = 0; i < cc->ctx->msgcount; i++)
+ for (unsigned int i = 0; i < cc->ctx->mailbox->msg_count; i++)
if (NHDR(cc->ctx->hdrs[i])->article_num == anum)
return 0;
if (cc->num >= cc->max)
return;
memset(&data->progress, 0, sizeof(data->progress));
- data->oldmsgcount = ctx->msgcount;
+ data->oldmsgcount = ctx->mailbox->msg_count;
data->ignmsgcount = 0;
data->noprogress = false;
data->progress_ready = false;
if (data->progress_ready)
{
mutt_progress_update(&data->progress,
- ctx->msgcount + data->ignmsgcount - data->oldmsgcount, -1);
+ ctx->mailbox->msg_count + data->ignmsgcount - data->oldmsgcount, -1);
}
}
if (!path)
return;
- mutt_debug(2, "nm: appending message, i=%d, id=%s, path=%s\n", ctx->msgcount,
+ 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->msgcount >= ctx->hdrmax)
+ if (ctx->mailbox->msg_count >= ctx->hdrmax)
{
mutt_debug(2, "nm: allocate mx memory\n");
mx_alloc_memory(ctx);
}
h->active = true;
- h->index = ctx->msgcount;
+ h->index = ctx->mailbox->msg_count;
ctx->size += h->content->length + h->content->offset - h->content->hdr_offset;
- ctx->hdrs[ctx->msgcount] = h;
- ctx->msgcount++;
+ ctx->hdrs[ctx->mailbox->msg_count] = h;
+ ctx->mailbox->msg_count++;
if (newpath)
{
msgs = notmuch_query_search_messages(q);
#endif
- for (; notmuch_messages_valid(msgs) && ((limit == 0) || (ctx->msgcount < limit));
+ for (; notmuch_messages_valid(msgs) && ((limit == 0) || (ctx->mailbox->msg_count < limit));
notmuch_messages_move_to_next(msgs))
{
if (SigInt == 1)
threads = notmuch_query_search_threads(q);
#endif
- for (; notmuch_threads_valid(threads) && ((limit == 0) || (ctx->msgcount < limit));
+ for (; notmuch_threads_valid(threads) && ((limit == 0) || (ctx->mailbox->msg_count < limit));
notmuch_threads_move_to_next(threads))
{
if (SigInt == 1)
if (!(db = get_db(data, false)) || !(msg = get_nm_message(db, h)))
goto done;
- mutt_debug(1, "nm: reading entire-thread messages...[current count=%d]\n", ctx->msgcount);
+ mutt_debug(1, "nm: reading entire-thread messages...[current count=%d]\n", ctx->mailbox->msg_count);
progress_reset(ctx);
id = notmuch_message_get_thread_id(msg);
ctx->mtime.tv_nsec = 0;
rc = 0;
- if (ctx->msgcount > data->oldmsgcount)
- mx_update_context(ctx, ctx->msgcount - data->oldmsgcount);
+ if (ctx->mailbox->msg_count > data->oldmsgcount)
+ mx_update_context(ctx, ctx->mailbox->msg_count - data->oldmsgcount);
done:
if (q)
notmuch_query_destroy(q);
if (!is_longrun(data))
release_db(data);
- if (ctx->msgcount == data->oldmsgcount)
+ if (ctx->mailbox->msg_count == data->oldmsgcount)
mutt_message(_("No more messages in the thread"));
data->oldmsgcount = 0;
mutt_debug(1, "nm: reading entire-thread messages... done [rc=%d, count=%d]\n",
- rc, ctx->msgcount);
+ rc, ctx->mailbox->msg_count);
return rc;
}
if (!data)
return -1;
- mutt_debug(1, "nm: reading messages...[current count=%d]\n", ctx->msgcount);
+ mutt_debug(1, "nm: reading messages...[current count=%d]\n", ctx->mailbox->msg_count);
progress_reset(ctx);
ctx->mtime.tv_sec = time(NULL);
ctx->mtime.tv_nsec = 0;
- mx_update_context(ctx, ctx->msgcount);
+ mx_update_context(ctx, ctx->mailbox->msg_count);
data->oldmsgcount = 0;
- mutt_debug(1, "nm: reading messages... done [rc=%d, count=%d]\n", rc, ctx->msgcount);
+ mutt_debug(1, "nm: reading messages... done [rc=%d, count=%d]\n", rc, ctx->mailbox->msg_count);
return rc;
}
if (!ctx || (ctx->magic != MUTT_NOTMUCH))
return -1;
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
struct Header *h = ctx->hdrs[i];
if (h)
if (!q)
goto done;
- mutt_debug(1, "nm: start checking (count=%d)\n", ctx->msgcount);
- data->oldmsgcount = ctx->msgcount;
+ mutt_debug(1, "nm: start checking (count=%d)\n", ctx->mailbox->msg_count);
+ data->oldmsgcount = ctx->mailbox->msg_count;
data->noprogress = true;
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
ctx->hdrs[i]->active = false;
limit = get_limit(data);
notmuch_message_destroy(m);
}
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!ctx->hdrs[i]->active)
{
}
}
- if (ctx->msgcount > data->oldmsgcount)
- mx_update_context(ctx, ctx->msgcount - data->oldmsgcount);
+ if (ctx->mailbox->msg_count > data->oldmsgcount)
+ mx_update_context(ctx, ctx->mailbox->msg_count - data->oldmsgcount);
done:
if (q)
notmuch_query_destroy(q);
ctx->mtime.tv_nsec = 0;
mutt_debug(1, "nm: ... check done [count=%d, new_flags=%d, occult=%d]\n",
- ctx->msgcount, new_flags, occult);
+ ctx->mailbox->msg_count, new_flags, occult);
return occult ? MUTT_REOPENED :
- (ctx->msgcount > data->oldmsgcount) ? MUTT_NEW_MAIL :
+ (ctx->mailbox->msg_count > data->oldmsgcount) ? MUTT_NEW_MAIL :
new_flags ? MUTT_FLAGS : 0;
}
/* all is in this function so we don't use data->progress here */
char msgbuf[PATH_MAX + 64];
snprintf(msgbuf, sizeof(msgbuf), _("Writing %s..."), ctx->mailbox->path);
- mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc, ctx->msgcount);
+ mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc, ctx->mailbox->msg_count);
}
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
char old[PATH_MAX], new[PATH_MAX];
struct Header *h = ctx->hdrs[i];
if (Context && !OptAttachMsg)
{
- oldcount = Context ? Context->msgcount : 0;
+ oldcount = Context ? Context->mailbox->msg_count : 0;
/* check for new mail */
check = mx_mbox_check(Context, &index_hint);
if (check < 0)
/* notify user of newly arrived mail */
if (check == MUTT_NEW_MAIL)
{
- for (i = oldcount; i < Context->msgcount; i++)
+ for (i = oldcount; i < Context->mailbox->msg_count; i++)
{
struct Header *h = Context->hdrs[i];
{
/* After the mailbox has been updated,
* rd.index->current might be invalid */
- rd.index->current = MIN(rd.index->current, (Context->msgcount - 1));
+ rd.index->current = MIN(rd.index->current, (Context->mailbox->msg_count - 1));
index_hint = Context->hdrs[Context->v2r[rd.index->current]]->index;
bool q = Context->quiet;
#include "group.h"
#include "handler.h"
#include "hdrline.h"
+#include "mailbox.h"
#include "menu.h"
#include "mutt_logging.h"
#include "mutt_parse.h"
if (side == RANGE_S_LEFT)
return 1;
else if (side == RANGE_S_RIGHT)
- return Context->msgcount;
+ return Context->mailbox->msg_count;
}
/* We have something, so determine what */
c = (unsigned char) (s->dptr[pmatch[grp].rm_so]);
case RANGE_CIRCUM:
return 1;
case RANGE_DOLLAR:
- return Context->msgcount;
+ return Context->mailbox->msg_count;
case RANGE_DOT:
return CTX_MSGNO(Context);
case RANGE_LT:
Context->vsize = 0;
Context->collapsed = false;
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
Context->hdrs[i]->virtual = -1;
Context->hdrs[i]->limited = false;
mutt_progress_init(&progress, _("Executing command on matching messages..."),
MUTT_PROGRESS_MSG, ReadInc,
- (op == MUTT_LIMIT) ? Context->msgcount : Context->vcount);
+ (op == MUTT_LIMIT) ? Context->mailbox->msg_count : Context->vcount);
if (op == MUTT_LIMIT)
{
Context->collapsed = false;
padding = mx_msg_padding_size(Context);
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
{
mutt_progress_update(&progress, i, -1);
/* new limit pattern implicitly uncollapses all threads */
if (Context->limit_pattern)
mutt_pattern_free(&Context->limit_pattern);
- if (Context->msgcount && !Context->vcount)
+ if (Context->mailbox->msg_count && !Context->vcount)
mutt_error(_("No messages matched criteria"));
/* record new limit pattern, unless match all */
if (OptSearchInvalid)
{
- for (int i = 0; i < Context->msgcount; i++)
+ for (int i = 0; i < Context->mailbox->msg_count; i++)
Context->hdrs[i]->searched = false;
#ifdef USE_IMAP
if (Context->magic == MUTT_IMAP && imap_search(Context, SearchPattern) < 0)
if (strlen(line) == 0)
return -1;
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
if (mutt_str_strcmp(line, ctx->hdrs[i]->data) == 0)
break;
- if (i == ctx->msgcount)
+ if (i == ctx->mailbox->msg_count)
{
mutt_debug(1, "new header %d %s\n", index, line);
if (i >= ctx->hdrmax)
mx_alloc_memory(ctx);
- ctx->msgcount++;
+ ctx->mailbox->msg_count++;
ctx->hdrs[i] = mutt_header_new();
ctx->hdrs[i]->data = mutt_str_strdup(line);
}
return 0;
#endif
- for (int i = 0; i < ctx->msgcount; i++)
+ 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))
time(&pop_data->check_time);
pop_data->clear_cache = false;
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
ctx->hdrs[i]->refno = -1;
- const int old_count = ctx->msgcount;
+ const int old_count = ctx->mailbox->msg_count;
int ret = pop_fetch_data(pop_data, "UIDL\r\n", NULL, fetch_uidl, ctx);
- const int new_count = ctx->msgcount;
- ctx->msgcount = old_count;
+ const int new_count = ctx->mailbox->msg_count;
+ ctx->mailbox->msg_count = old_count;
if (pop_data->cmd_uidl == 2)
{
ctx->hdrs[i]->read = true;
}
- ctx->msgcount++;
+ ctx->mailbox->msg_count++;
}
if (i > old_count)
if (ret < 0)
{
- for (int i = ctx->msgcount; i < new_count; i++)
+ for (int i = ctx->mailbox->msg_count; i < new_count; i++)
mutt_header_free(&ctx->hdrs[i]);
return ret;
}
hc = pop_hcache_open(pop_data, ctx->mailbox->path);
#endif
- for (i = 0, j = 0, ret = 0; ret == 0 && i < ctx->msgcount; i++)
+ 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)
{
#include "mutt.h"
#include "context.h"
#include "globals.h"
+#include "mailbox.h"
#include "mutt_account.h"
#include "mutt_logging.h"
#include "mutt_socket.h"
endp++;
memmove(line, endp, strlen(endp) + 1);
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
if (mutt_str_strcmp(ctx->hdrs[i]->data, line) == 0)
{
mutt_progress_init(&progressbar, _("Verifying message indexes..."),
MUTT_PROGRESS_SIZE, NetInc, 0);
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
ctx->hdrs[i]->refno = -1;
ret = pop_fetch_data(pop_data, "UIDL\r\n", &progressbar, check_uidl, ctx);
if (!ctx)
PostCount = 0;
else
- PostCount = ctx->msgcount;
+ PostCount = ctx->mailbox->msg_count;
mx_fastclose_mailbox(ctx);
mutt_context_free(&ctx);
#ifdef USE_NNTP
struct Menu *menu = mutt_menu_new(MENU_POST);
menu->make_entry = post_entry;
- menu->max = PostContext->msgcount;
+ menu->max = PostContext->mailbox->msg_count;
menu->title = _("Postponed Messages");
menu->data = PostContext;
menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_POST, PostponeHelp);
/* should deleted draft messages be saved in the trash folder? */
mutt_set_flag(PostContext, PostContext->hdrs[menu->current],
MUTT_DELETE, (i == OP_DELETE) ? 1 : 0);
- PostCount = PostContext->msgcount - PostContext->deleted;
+ PostCount = PostContext->mailbox->msg_count - PostContext->deleted;
if (Resolve && menu->current < menu->max - 1)
{
menu->oldcurrent = menu->current;
return -1;
}
- if (!PostContext->msgcount)
+ if (!PostContext->mailbox->msg_count)
{
PostCount = 0;
mx_mbox_close(&PostContext, NULL);
return -1;
}
- if (PostContext->msgcount == 1)
+ if (PostContext->mailbox->msg_count == 1)
{
/* only one message, so just use that one. */
h = PostContext->hdrs[0];
mutt_set_flag(PostContext, h, MUTT_PURGE, 1);
/* update the count for the status display */
- PostCount = PostContext->msgcount - PostContext->deleted;
+ PostCount = PostContext->mailbox->msg_count - PostContext->deleted;
/* avoid the "purge deleted messages" prompt */
opt_delete = Delete;
#include "context.h"
#include "globals.h"
#include "keymap.h"
+#include "mailbox.h"
#include "menu.h"
#include "options.h"
#include "pattern.h"
mutt_menu_set_redraw_full(MENU_MAIN);
mutt_menu_set_redraw_full(MENU_PAGER);
- for (int i = 0; ctx && i < ctx->msgcount; i++)
+ for (int i = 0; ctx && i < ctx->mailbox->msg_count; i++)
{
mutt_score_message(ctx, ctx->hdrs[i], true);
ctx->hdrs[i]->pair = 0;
#include "globals.h"
#include "hdrline.h"
#include "hook.h"
+#include "mailbox.h"
#include "mutt_attach.h"
#include "mutt_header.h"
#include "mutt_logging.h"
if (!curenv)
{
- for (int i = 0; i < ctx->msgcount; i++)
+ 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);
if (!cur)
{
tag = true;
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!message_is_tagged(ctx, i))
continue;
#endif
if (tag)
{
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!message_is_tagged(ctx, i))
continue;
mutt_message(_("Including quoted message..."));
if (!cur)
{
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!message_is_tagged(ctx, i))
continue;
}
else
{
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (!message_is_tagged(ctx, i))
continue;
include_forward(ctx, cur, tempfp);
else
{
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (message_is_tagged(ctx, i))
include_forward(ctx, ctx->hdrs[i], tempfp);
mutt_set_flag(ctx, cur, MUTT_REPLIED, is_reply(cur, msg));
else if (!(flags & SEND_POSTPONED) && ctx && ctx->tagged)
{
- for (i = 0; i < ctx->msgcount; i++)
+ for (i = 0; i < ctx->mailbox->msg_count; i++)
{
if (message_is_tagged(ctx, i))
{
if (!h)
{
/* Try to bounce each message out, aborting if we get any failures. */
- for (int i = 0; i < Context->msgcount; i++)
+ 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);
return rc;
#endif
{
b->msg_unread = Context->unread;
- b->msg_count = Context->msgcount;
+ b->msg_count = Context->mailbox->msg_count;
}
b->msg_flagged = Context->flagged;
}
if (mutt_str_strcmp(np->b->realpath, ctx->mailbox->realpath) == 0)
{
np->b->msg_unread = ctx->unread;
- np->b->msg_count = ctx->msgcount;
+ np->b->msg_count = ctx->mailbox->msg_count;
np->b->msg_flagged = ctx->flagged;
break;
}
#include "alias.h"
#include "context.h"
#include "globals.h"
+#include "mailbox.h"
#include "mutt_logging.h"
#include "mutt_thread.h"
#include "options.h"
if (!ctx)
return;
- if (!ctx->msgcount)
+ if (!ctx->mailbox->msg_count)
{
/* this function gets called by mutt_sync_mailbox(), which may have just
* deleted all the messages. the virtual message numbers are not updated
if (OptNeedRescore && Score)
{
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
mutt_score_message(ctx, ctx->hdrs[i], true);
}
OptNeedRescore = false;
return;
}
else
- qsort((void *) ctx->hdrs, ctx->msgcount, sizeof(struct Header *), sortfunc);
+ qsort((void *) ctx->hdrs, ctx->mailbox->msg_count, sizeof(struct Header *), sortfunc);
/* adjust the virtual message numbers */
ctx->vcount = 0;
- for (int i = 0; i < ctx->msgcount; i++)
+ for (int i = 0; i < ctx->mailbox->msg_count; i++)
{
struct Header *cur = ctx->hdrs[i];
if (cur->virtual != -1 || (cur->collapsed && (!ctx->pattern || cur->limited)))
if (!optional)
{
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, Context ? Context->msgcount : 0);
+ snprintf(buf, buflen, fmt, Context ? Context->mailbox->msg_count : 0);
}
- else if (!Context || !Context->msgcount)
+ else if (!Context || !Context->mailbox->msg_count)
optional = 0;
break;
case 'R':
{
- int read = Context ? Context->msgcount - Context->unread : 0;
+ int read = Context ? Context->mailbox->msg_count - Context->unread : 0;
if (!optional)
{