else if (excl == 0)
{
mutt_file_fclose(&ci->lockfp);
- ctx->readonly = true;
+ ctx->mailbox->readonly = true;
return 1;
}
if (!ctx || !command || !progress)
return 0;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
mutt_message(progress, ctx->mailbox->realpath);
}
/* If there's no close-hook, or the file isn't writable */
if (!ci->close || (access(ctx->mailbox->path, W_OK) != 0))
- ctx->readonly = true;
+ ctx->mailbox->readonly = true;
if (setup_paths(ctx) != 0)
goto or_fail;
FILE *fp;
struct timespec atime;
struct timespec mtime;
- off_t size;
off_t vsize;
char *pattern; /**< limit pattern string */
struct Pattern *limit_pattern; /**< compiled limit pattern */
unsigned char rights[(RIGHTSMAX + 7) / 8]; /**< ACL bits */
bool locked : 1; /**< is the mailbox locked? */
- bool changed : 1; /**< mailbox has been modified */
- bool readonly : 1; /**< don't allow changes to the mailbox */
bool dontwrite : 1; /**< don't write the mailbox on close */
bool append : 1; /**< mailbox is opened in append mode */
- bool quiet : 1; /**< inhibit status messages? */
bool collapsed : 1; /**< are all threads collapsed? */
- bool closing : 1; /**< mailbox is being closed */
bool peekonly : 1; /**< just taking a glance, revert atime */
#ifdef USE_COMPRESSED
body->offset = new_offset;
/* update the total size of the mailbox to reflect this deletion */
- Context->size -= body->length - new_length;
+ Context->mailbox->size -= body->length - new_length;
/* if the message is visible, update the visible size of the mailbox as well. */
if (Context->v2r[hdr->msgno] != -1)
Context->vsize -= body->length - new_length;
}
#define CHECK_READONLY \
- if (Context->readonly) \
+ if (Context->mailbox->readonly) \
{ \
mutt_flushinp(); \
mutt_error(_(Mailbox_is_read_only)); \
if (!ctx)
return -1;
- if (ctx->readonly)
+ if (ctx->mailbox->readonly)
{
mutt_error(_("Cannot toggle write on a readonly mailbox"));
return -1;
/* avoid the message being overwritten by mailbox */
do_mailbox_notify = false;
- bool q = Context->quiet;
- Context->quiet = true;
+ bool q = Context->mailbox->quiet;
+ Context->mailbox->quiet = true;
update_index(menu, Context, check, oldcount, index_hint);
- Context->quiet = q;
+ Context->mailbox->quiet = q;
menu->redraw = REDRAW_FULL;
menu->max = Context->vcount;
{
struct Header *oldcur = CURHDR;
struct Header *hdr = NULL;
- bool quiet = Context->quiet;
+ bool quiet = Context->mailbox->quiet;
if (rc2 < 0)
- Context->quiet = true;
+ Context->mailbox->quiet = true;
mutt_sort_headers(Context, (op == OP_RECONSTRUCT_THREAD));
- Context->quiet = quiet;
+ Context->mailbox->quiet = quiet;
/* Similar to OP_MAIN_ENTIRE_THREAD, keep displaying the old message, but
update the index */
break;
}
- log_queue_save(fp);
+ // log_queue_save(fp);
+
+ fprintf(fp, "path: %s\n", Context->mailbox->path);
+ // fprintf(fp, "realpath: %s\n", Context->realpath);
+ fprintf(fp, "mailbox->size: %ld\n", Context->mailbox->size);
+ fprintf(fp, "vsize: %ld\n", Context->vsize);
+ fprintf(fp, "\n");
+
+ struct MailboxNode *np = NULL;
+ STAILQ_FOREACH(np, &AllMailboxes, entries)
+ {
+ fprintf(fp, "path: %s\n", np->b->path);
+ fprintf(fp, "size: %ld\n", np->b->size);
+ // fprintf(fp, "realpath: %s\n", np->b->realpath);
+ // fprintf(fp, "desc: %s\n", np->b->desc);
+ fprintf(fp, "\n");
+ }
+
mutt_file_fclose(&fp);
mutt_do_pager("messages", tempfile, MUTT_PAGER_LOGS, NULL);
if (message_is_tagged(Context, j))
{
Context->mailbox->hdrs[j]->quasi_deleted = true;
- Context->changed = true;
+ Context->mailbox->changed = true;
}
}
}
else
{
CURHDR->quasi_deleted = true;
- Context->changed = true;
+ Context->mailbox->changed = true;
}
break;
struct Progress progress;
int px;
- if (!Context->quiet)
+ if (!Context->mailbox->quiet)
{
char msgbuf[STRING];
snprintf(msgbuf, sizeof(msgbuf), _("Update tags..."));
if (!message_is_tagged(Context, j))
continue;
- if (!Context->quiet)
+ if (!Context->mailbox->quiet)
mutt_progress_update(&progress, ++px, -1);
mx_tags_commit(Context, Context->mailbox->hdrs[j], buf);
if (op == OP_MAIN_MODIFY_TAGS_THEN_HIDE)
nm_message_is_still_queried(Context, Context->mailbox->hdrs[j]);
#endif
Context->mailbox->hdrs[j]->quasi_deleted = !still_queried;
- Context->changed = true;
+ Context->mailbox->changed = true;
}
}
#ifdef USE_NOTMUCH
still_queried = nm_message_is_still_queried(Context, CURHDR);
#endif
CURHDR->quasi_deleted = !still_queried;
- Context->changed = true;
+ Context->mailbox->changed = true;
}
if (menu->menu == MENU_PAGER)
{
menu->current = oldcur->virtual;
}
- Context->changed = true;
+ Context->mailbox->changed = true;
mutt_message(_("Thread broken"));
if (menu->menu == MENU_PAGER)
mutt_sort_headers(Context, true);
menu->current = oldcur->virtual;
- Context->changed = true;
+ Context->mailbox->changed = true;
mutt_message(_("Threads linked"));
}
else
edit = true;
}
else if (op == OP_EDIT_OR_VIEW_RAW_MESSAGE)
- edit = !Context->readonly && mutt_bit_isset(Context->rights, MUTT_ACL_INSERT);
+ edit = !Context->mailbox->readonly &&
+ mutt_bit_isset(Context->rights, MUTT_ACL_INSERT);
else
edit = false;
rc = mutt_label_message(tag ? NULL : CURHDR);
if (rc > 0)
{
- Context->changed = true;
+ Context->mailbox->changed = true;
menu->redraw = REDRAW_FULL;
/* L10N: This is displayed when the x-label on one or more
* messages is edited. */
CHECK_VISIBLE;
mutt_view_attachments(CURHDR);
if (Context && CURHDR->attach_del)
- Context->changed = true;
+ Context->mailbox->changed = true;
menu->redraw = REDRAW_FULL;
break;
int mailbox = ctx->mailbox->msg_flagged;
int update = false;
- if (ctx->readonly && flag != MUTT_TAG)
+ if (ctx->mailbox->readonly && flag != MUTT_TAG)
return; /* don't modify anything if we are read-only */
switch (flag)
if (bf)
{
- if (!h->deleted && !ctx->readonly && (!h->flagged || !FlagSafe))
+ if (!h->deleted && !ctx->mailbox->readonly && (!h->flagged || !FlagSafe))
{
h->deleted = true;
update = true;
{
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
#endif
}
{
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
#endif
/* If the user undeletes a message which is marked as
* driver.
*/
if (ctx->mailbox->magic == MUTT_MAILDIR && upd_ctx && h->trash)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
break;
if (bf)
{
- if (!h->purge && !ctx->readonly)
+ if (!h->purge && !ctx->mailbox->readonly)
h->purge = true;
}
else if (h->purge)
}
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
}
else if (!h->read)
ctx->mailbox->msg_unread--;
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
break;
ctx->new --;
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
}
else if (h->old)
ctx->new ++;
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
break;
ctx->new --;
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
}
else if (h->read)
ctx->new ++;
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
break;
}
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
}
else if (h->replied)
h->replied = false;
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
break;
ctx->mailbox->msg_flagged++;
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
}
else if (h->flagged)
ctx->mailbox->msg_flagged--;
h->changed = true;
if (upd_ctx)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
}
break;
return;
}
- if (!(idata->state >= IMAP_SELECTED) || idata->ctx->closing)
+ if (!(idata->state >= IMAP_SELECTED) || idata->ctx->mailbox->closing)
return;
if (idata->reopen & IMAP_REOPEN_ALLOW)
mutt_debug(2, "Expunging message UID %u.\n", HEADER_DATA(h)->uid);
h->active = false;
- idata->ctx->size -= h->content->length;
+ idata->ctx->mailbox->size -= h->content->length;
imap_cache_del(idata, h);
#ifdef USE_HCACHE
condstore = "";
snprintf(bufout, sizeof(bufout), "%s %s%s",
- ctx->readonly ? "EXAMINE" : "SELECT", buf, condstore);
+ ctx->mailbox->readonly ? "EXAMINE" : "SELECT", buf, condstore);
idata->state = IMAP_SELECTED;
!mutt_bit_isset(idata->capabilities, ACL))
{
mutt_debug(2, "Mailbox is read-only.\n");
- ctx->readonly = true;
+ ctx->mailbox->readonly = true;
}
/* dump the mailbox flags we've found */
mutt_bit_isset(idata->ctx->rights, MUTT_ACL_WRITE) ||
mutt_bit_isset(idata->ctx->rights, MUTT_ACL_INSERT)))
{
- ctx->readonly = true;
+ ctx->mailbox->readonly = true;
}
ctx->mailbox->hdrmax = count;
if (rc < 0)
{
- if (ctx->closing)
+ if (ctx->mailbox->closing)
{
if (mutt_yesorno(_("Error saving flags. Close anyway?"), 0) == MUTT_YES)
{
HEADER_DATA(ctx->mailbox->hdrs[i])->replied = ctx->mailbox->hdrs[i]->replied;
ctx->mailbox->hdrs[i]->changed = false;
}
- ctx->changed = false;
+ ctx->mailbox->changed = false;
/* We must send an EXPUNGE command if we're not closing. */
- if (expunge && !(ctx->closing) && mutt_bit_isset(ctx->rights, MUTT_ACL_DELETE))
+ if (expunge && !(ctx->mailbox->closing) && mutt_bit_isset(ctx->rights, MUTT_ACL_DELETE))
{
mutt_message(_("Expunging messages from server..."));
/* Set expunge bit so we don't get spurious reopened messages */
idata->reopen &= ~IMAP_EXPUNGE_EXPECTED;
}
- if (expunge && ctx->closing)
+ if (expunge && ctx->mailbox->closing)
{
imap_exec(idata, "CLOSE", IMAP_CMD_QUEUE);
idata->state = IMAP_AUTHENTICATED;
mutt_str_strdup(h.data->flags_remote));
ctx->mailbox->msg_count++;
- ctx->size += ctx->mailbox->hdrs[idx]->content->length;
+ ctx->mailbox->size += ctx->mailbox->hdrs[idx]->content->length;
/* If this is the first time we are fetching, we need to
* store the current state of flags back into the header cache */
ihd->uid = uid;
mutt_hash_int_insert(idata->uid_hash, uid, h);
- ctx->size += h->content->length;
+ ctx->mailbox->size += h->content->length;
ctx->mailbox->hdrs[ctx->mailbox->msg_count++] = h;
msn++;
/* The IMAP flag setting as part of cmd_parse_fetch() ends up
* flipping these on. */
idata->check_status &= ~IMAP_FLAGS_PENDING;
- ctx->changed = false;
+ ctx->mailbox->changed = false;
/* VANISHED handling: we need to empty out the messages */
if (idata->reopen & IMAP_EXPUNGE_PENDING)
mutt_rfc822_read_header(fp, ctx->mailbox->hdrs[idx], false, false);
/* content built as a side-effect of mutt_rfc822_read_header */
ctx->mailbox->hdrs[idx]->content->length = h.content_length;
- ctx->size += h.content_length;
+ ctx->mailbox->size += h.content_length;
#ifdef USE_HCACHE
imap_hcache_put(idata, ctx->mailbox->hdrs[idx]);
* read-write even if it's read-only, so *server* updates of
* flags can be processed by mutt_set_flag. ctx->changed must
* be restored afterwards */
- readonly = ctx->readonly;
- ctx->readonly = false;
+ readonly = ctx->mailbox->readonly;
+ ctx->mailbox->readonly = false;
/* This is redundant with the following two checks. Removing:
* mutt_set_flag (ctx, h, MUTT_NEW, !(hd->read || hd->old));
* marks things changed as a side-effect) */
if (!local_changes)
h->changed = false;
- ctx->changed &= !readonly;
- ctx->readonly = readonly;
+ ctx->mailbox->changed &= !readonly;
+ ctx->mailbox->readonly = readonly;
return s;
}
void *data; /**< driver specific data */
const struct MxOps *mx_ops;
+ bool changed : 1; /**< mailbox has been modified */
+ bool readonly : 1; /**< don't allow changes to the mailbox */
+ bool quiet : 1; /**< inhibit status messages? */
+ bool closing : 1; /**< mailbox is being closed */
+
int flags; /**< e.g. #MB_NORMAL */
};
if (count)
{
(*count)++;
- if (!ctx->quiet && progress)
+ if (!ctx->mailbox->quiet && progress)
mutt_progress_update(progress, *count, -1);
}
ctx->mailbox->hdrs[ctx->mailbox->msg_count] = md->h;
ctx->mailbox->hdrs[ctx->mailbox->msg_count]->index = ctx->mailbox->msg_count;
- ctx->size += md->h->content->length + md->h->content->offset -
- md->h->content->hdr_offset;
+ ctx->mailbox->size += md->h->content->length + md->h->content->offset -
+ md->h->content->hdr_offset;
md->h = NULL;
ctx->mailbox->msg_count++;
continue;
}
- if (!ctx->quiet && progress)
+ if (!ctx->mailbox->quiet && progress)
mutt_progress_update(progress, count, -1);
if (!sort)
char msgbuf[STRING];
struct Progress progress;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
snprintf(msgbuf, sizeof(msgbuf), _("Scanning %s..."), ctx->mailbox->path);
mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, ReadInc, 0);
if (maildir_parse_dir(ctx, &last, subdir, &count, &progress) == -1)
return -1;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
snprintf(msgbuf, sizeof(msgbuf), _("Reading %s..."), ctx->mailbox->path);
mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, ReadInc, count);
hc = mutt_hcache_open(HeaderCache, ctx->mailbox->path, NULL);
#endif
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
snprintf(msgbuf, sizeof(msgbuf), _("Writing %s..."), ctx->mailbox->path);
mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc,
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_progress_update(&progress, i, -1);
#ifdef USE_HCACHE
/* save the global state here so we can reset it at the
* end of list block if required.
*/
- bool context_changed = ctx->changed;
+ bool context_changed = ctx->mailbox->changed;
bool header_changed;
/* user didn't modify this message. alter the flags to match the
* be synchronized.
*/
if (!context_changed)
- ctx->changed = false;
+ ctx->mailbox->changed = false;
return header_changed;
}
ctx->locked = true;
else if (retry && !excl)
{
- ctx->readonly = true;
+ ctx->mailbox->readonly = true;
return 0;
}
}
mutt_get_stat_timespec(&ctx->atime, &sb, MUTT_STAT_ATIME);
mutt_get_stat_timespec(&ctx->mtime, &sb, MUTT_STAT_MTIME);
- ctx->size = sb.st_size;
+ ctx->mailbox->size = sb.st_size;
buf[sizeof(buf) - 1] = '\0';
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
char msgbuf[STRING];
snprintf(msgbuf, sizeof(msgbuf), _("Reading %s..."), ctx->mailbox->path);
return -1;
count++;
- if (!ctx->quiet)
- mutt_progress_update(&progress, count, (int) (loc / (ctx->size / 100 + 1)));
+ if (!ctx->mailbox->quiet)
+ mutt_progress_update(&progress, count,
+ (int) (loc / (ctx->mailbox->size / 100 + 1)));
if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax)
mx_alloc_memory(ctx);
{
tmploc = loc + hdr->content->length;
- if ((tmploc > 0) && (tmploc < ctx->size))
+ if ((tmploc > 0) && (tmploc < ctx->mailbox->size))
{
if (fseeko(ctx->fp, tmploc, SEEK_SET) != 0 ||
!fgets(buf, sizeof(buf) - 1, ctx->fp) ||
return -1;
}
- ctx->size = sb.st_size;
+ ctx->mailbox->size = sb.st_size;
mutt_get_stat_timespec(&ctx->mtime, &sb, MUTT_STAT_MTIME);
mutt_get_stat_timespec(&ctx->atime, &sb, MUTT_STAT_ATIME);
- if (!ctx->readonly)
- ctx->readonly = access(ctx->mailbox->path, W_OK) ? true : false;
+ if (!ctx->mailbox->readonly)
+ ctx->mailbox->readonly = access(ctx->mailbox->path, W_OK) ? true : false;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
char msgbuf[STRING];
snprintf(msgbuf, sizeof(msgbuf), _("Reading %s..."), ctx->mailbox->path);
count++;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
mutt_progress_update(&progress, count,
- (int) (ftello(ctx->fp) / (ctx->size / 100 + 1)));
+ (int) (ftello(ctx->fp) / (ctx->mailbox->size / 100 + 1)));
}
if (ctx->mailbox->msg_count == ctx->mailbox->hdrmax)
/* The test below avoids a potential integer overflow if the
* content-length is huge (thus necessarily invalid).
*/
- tmploc = (curhdr->content->length < ctx->size) ?
+ tmploc = (curhdr->content->length < ctx->mailbox->size) ?
(loc + curhdr->content->length + 1) :
-1;
- if ((tmploc > 0) && (tmploc < ctx->size))
+ if ((tmploc > 0) && (tmploc < ctx->mailbox->size))
{
/* check to see if the content-length looks valid. we expect to
* to see a valid message separator at this point in the stream
curhdr->content->length = -1;
}
}
- else if (tmploc != ctx->size)
+ else if (tmploc != ctx->mailbox->size)
{
/* content-length would put us past the end of the file, so it
* must be wrong
int rc = -1;
/* silent operations */
- ctx->quiet = true;
+ ctx->mailbox->quiet = true;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("Reopening mailbox..."));
/* our heuristics require the old mailbox to be unsorted */
mutt_hash_destroy(&ctx->label_hash);
mutt_clear_threads(ctx);
FREE(&ctx->v2r);
- if (ctx->readonly)
+ if (ctx->mailbox->readonly)
{
for (i = 0; i < ctx->mailbox->msg_count; i++)
mutt_header_free(&(ctx->mailbox->hdrs[i])); /* nothing to do! */
ctx->new = 0;
ctx->mailbox->msg_unread = 0;
ctx->mailbox->msg_flagged = 0;
- ctx->changed = false;
+ ctx->mailbox->changed = false;
ctx->id_hash = NULL;
ctx->subj_hash = NULL;
mutt_make_label_hash(ctx);
mutt_header_free(&(old_hdrs[j]));
FREE(&old_hdrs);
- ctx->quiet = false;
+ ctx->mailbox->quiet = false;
return -1;
}
index_hint_set = (index_hint == NULL);
- if (!ctx->readonly)
+ if (!ctx->mailbox->readonly)
{
for (i = 0; i < ctx->mailbox->msg_count; i++)
{
FREE(&old_hdrs);
}
- ctx->quiet = false;
+ ctx->mailbox->quiet = false;
- return (ctx->changed || msg_mod) ? MUTT_REOPENED : MUTT_NEW_MAIL;
+ return (ctx->mailbox->changed || msg_mod) ? MUTT_REOPENED : MUTT_NEW_MAIL;
}
/**
if (stat(ctx->mailbox->path, &st) == 0)
{
if ((mutt_stat_timespec_compare(&st, MUTT_STAT_MTIME, &ctx->mtime) == 0) &&
- st.st_size == ctx->size)
+ st.st_size == ctx->mailbox->size)
{
return 0;
}
- if (st.st_size == ctx->size)
+ if (st.st_size == ctx->mailbox->size)
{
/* the file was touched, but it is still the same length, so just exit */
mutt_get_stat_timespec(&ctx->mtime, &st, MUTT_STAT_MTIME);
return 0;
}
- if (st.st_size > ctx->size)
+ if (st.st_size > ctx->mailbox->size)
{
/* lock the file if it isn't already */
if (!ctx->locked)
* folder.
*/
char buffer[LONG_STRING];
- if (fseeko(ctx->fp, ctx->size, SEEK_SET) != 0)
+ if (fseeko(ctx->fp, ctx->mailbox->size, SEEK_SET) != 0)
mutt_debug(1, "#1 fseek() failed\n");
if (fgets(buffer, sizeof(buffer), ctx->fp))
{
if ((ctx->mailbox->magic == MUTT_MBOX && (mutt_str_strncmp("From ", buffer, 5) == 0)) ||
(ctx->mailbox->magic == MUTT_MMDF && (mutt_str_strcmp(MMDF_SEP, buffer) == 0)))
{
- if (fseeko(ctx->fp, ctx->size, SEEK_SET) != 0)
+ if (fseeko(ctx->fp, ctx->mailbox->size, SEEK_SET) != 0)
mutt_debug(1, "#2 fseek() failed\n");
if (ctx->mailbox->magic == MUTT_MBOX)
mbox_parse_mailbox(ctx);
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)
+ if (!ctx->mailbox->quiet)
{
snprintf(msgbuf, sizeof(msgbuf), _("Writing %s..."), ctx->mailbox->path);
mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc,
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)));
+ if (!ctx->mailbox->quiet)
+ mutt_progress_update(&progress, i,
+ (int) (ftello(ctx->fp) / (ctx->mailbox->size / 100 + 1)));
/* back up some information which is needed to restore offsets when
* something fails.
*/
/* copy the temp mailbox back into place starting at the first
* change/deleted message
*/
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("Committing changes..."));
i = mutt_file_copy_stream(fp, ctx->fp);
}
if (i == 0)
{
- ctx->size = ftello(ctx->fp); /* update the size of the mailbox */
- if ((ctx->size < 0) || (ftruncate(fileno(ctx->fp), ctx->size) != 0))
+ ctx->mailbox->size = ftello(ctx->fp); /* update the mailbox->size of the mailbox */
+ if ((ctx->mailbox->size < 0) || (ftruncate(fileno(ctx->fp), ctx->mailbox->size) != 0))
{
i = -1;
mutt_debug(1, "ftruncate() failed\n");
mutt_bit_set(ctx->rights, rc);
if (flags & MUTT_QUIET)
- ctx->quiet = true;
+ ctx->mailbox->quiet = true;
if (flags & MUTT_READONLY)
- ctx->readonly = true;
+ ctx->mailbox->readonly = true;
if (flags & MUTT_PEEK)
ctx->peekonly = true;
*/
OptForceRefresh = true;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("Reading %s..."), ctx->mailbox->path);
rc = ctx->mailbox->mx_ops->mbox_open(ctx);
OptNeedRescore = false;
mutt_sort_headers(ctx, true);
}
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_clear_error();
if (rc == -2)
mutt_error(_("Reading from %s interrupted..."), ctx->mailbox->path);
if (!ctx->mailbox->mx_ops || !ctx->mailbox->mx_ops->mbox_sync)
return -1;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
/* L10N: Displayed before/as a mailbox is being synced */
mutt_message(_("Writing %s..."), ctx->mailbox->path);
}
int rc = ctx->mailbox->mx_ops->mbox_sync(ctx, index_hint);
- if ((rc != 0) && !ctx->quiet)
+ if ((rc != 0) && !ctx->mailbox->quiet)
{
/* L10N: Displayed if a mailbox sync fails */
mutt_error(_("Unable to write %s"), ctx->mailbox->path);
char mbox[PATH_MAX];
char buf[PATH_MAX + 64];
- ctx->closing = true;
+ ctx->mailbox->closing = true;
- if (ctx->readonly || ctx->dontwrite || ctx->append)
+ if (ctx->mailbox->readonly || ctx->dontwrite || ctx->append)
{
mx_fastclose_mailbox(ctx);
FREE(pctx);
int rc = query_quadoption(CatchupNewsgroup, _("Mark all articles read?"));
if (rc == MUTT_ABORT)
{
- ctx->closing = false;
+ ctx->mailbox->closing = false;
return -1;
}
else if (rc == MUTT_YES)
move_messages = query_quadoption(Move, buf);
if (move_messages == MUTT_ABORT)
{
- ctx->closing = false;
+ ctx->mailbox->closing = false;
return -1;
}
}
purge = query_quadoption(Delete, buf);
if (purge == MUTT_ABORT)
{
- ctx->closing = false;
+ ctx->mailbox->closing = false;
return -1;
}
}
if (move_messages)
{
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("Moving read messages to %s..."), mbox);
#ifdef USE_IMAP
mutt_clear_error();
else if (i == -1) /* horrible error, bail */
{
- ctx->closing = false;
+ ctx->mailbox->closing = false;
return -1;
}
else /* use regular append-copy mode */
struct Context *f = mx_mbox_open(mbox, MUTT_APPEND);
if (!f)
{
- ctx->closing = false;
+ ctx->mailbox->closing = false;
return -1;
}
else
{
mx_mbox_close(&f, NULL);
- ctx->closing = false;
+ ctx->mailbox->closing = false;
return -1;
}
}
mx_mbox_close(&f, NULL);
}
}
- else if (!ctx->changed && ctx->deleted == 0)
+ else if (!ctx->mailbox->changed && ctx->deleted == 0)
{
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("Mailbox is unchanged"));
if (ctx->mailbox->magic == MUTT_MBOX || ctx->mailbox->magic == MUTT_MMDF)
mbox_reset_atime(ctx, NULL);
{
if (trash_append(ctx) != 0)
{
- ctx->closing = false;
+ ctx->mailbox->closing = false;
return -1;
}
}
int check = imap_sync_mailbox(ctx, (purge != MUTT_NO));
if (check != 0)
{
- ctx->closing = false;
+ ctx->mailbox->closing = false;
return check;
}
}
ctx->deleted = 0;
}
- if (ctx->changed || ctx->deleted)
+ if (ctx->mailbox->changed || ctx->deleted)
{
int check = sync_mailbox(ctx, index_hint);
if (check != 0)
{
- ctx->closing = false;
+ ctx->mailbox->closing = false;
return check;
}
}
}
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
if (move_messages)
{
ctx->deleted = 0;
ctx->new = 0;
ctx->mailbox->msg_unread = 0;
- ctx->changed = false;
+ ctx->mailbox->changed = false;
ctx->mailbox->msg_flagged = 0;
padding = mx_msg_padding_size(ctx);
for (i = 0, j = 0; i < ctx->mailbox->msg_count; i++)
if (committing)
ctx->mailbox->hdrs[j]->changed = false;
else if (ctx->mailbox->hdrs[j]->changed)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
if (!committing || (ctx->mailbox->magic == MUTT_MAILDIR && MaildirTrash))
{
{
if (ctx->mailbox->magic == MUTT_MH || ctx->mailbox->magic == MUTT_MAILDIR)
{
- ctx->size -= (ctx->mailbox->hdrs[i]->content->length +
- ctx->mailbox->hdrs[i]->content->offset -
- ctx->mailbox->hdrs[i]->content->hdr_offset);
+ ctx->mailbox->size -= (ctx->mailbox->hdrs[i]->content->length +
+ ctx->mailbox->hdrs[i]->content->offset -
+ ctx->mailbox->hdrs[i]->content->hdr_offset);
}
/* remove message from the hash tables */
if (ctx->subj_hash && ctx->mailbox->hdrs[i]->env->real_subj)
mutt_error(_("Mailbox is marked unwritable. %s"), tmp);
return -1;
}
- else if (ctx->readonly)
+ else if (ctx->mailbox->readonly)
{
mutt_error(_("Mailbox is read-only"));
return -1;
}
- if (!ctx->changed && !ctx->deleted)
+ if (!ctx->mailbox->changed && !ctx->deleted)
{
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("Mailbox is unchanged"));
return 0;
}
return -1;
else if (purge == MUTT_NO)
{
- if (!ctx->changed)
+ if (!ctx->mailbox->changed)
return 0; /* nothing to do! */
/* let IMAP servers hold on to D flags */
if (ctx->mailbox->magic != MUTT_IMAP)
#ifdef USE_IMAP
if (ctx->mailbox->magic == MUTT_IMAP && !purge)
{
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("Mailbox checkpointed"));
}
else
#endif
{
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("%d kept, %d deleted"), msgcount - deleted, deleted);
}
mutt_score_message(ctx, h, false);
if (h->changed)
- ctx->changed = true;
+ ctx->mailbox->changed = true;
if (h->flagged)
ctx->mailbox->msg_flagged++;
if (h->deleted)
if (!fc->messages[anum - fc->first])
{
/* progress */
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_progress_update(&fc->progress, anum - fc->first + 1, -1);
return 0;
}
mutt_header_free(&hdr);
/* progress */
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_progress_update(&fc->progress, anum - fc->first + 1, -1);
return 0;
}
/* fetch list of articles */
if (NntpListgroup && nntp_data->nserv->hasLISTGROUP && !nntp_data->deleted)
{
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("Fetching list of articles..."));
if (nntp_data->nserv->hasLISTGROUPrange)
snprintf(buf, sizeof(buf), "LISTGROUP %s %u-%u\r\n", nntp_data->group, first, last);
}
/* fetching header from cache or server, or fallback to fetch overview */
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
mutt_progress_init(&fc.progress, _("Fetching message headers..."),
MUTT_PROGRESS_MSG, ReadInc, last - first + 1);
}
for (current = first; current <= last && rc == 0; current++)
{
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_progress_update(&fc.progress, current - first + 1, -1);
#ifdef USE_HCACHE
mutt_bit_unset(ctx->rights, MUTT_ACL_INSERT);
if (!nntp_data->newsrc_ent && !nntp_data->subscribed && !SaveUnsubscribed)
- ctx->readonly = true;
+ ctx->mailbox->readonly = true;
/* select newsgroup */
mutt_message(_("Selecting %s..."), group);
ctx->new = 0;
ctx->mailbox->msg_unread = 0;
ctx->mailbox->msg_flagged = 0;
- ctx->changed = false;
+ ctx->mailbox->changed = false;
ctx->id_hash = NULL;
ctx->subj_hash = NULL;
mx_update_context(ctx, ctx->mailbox->msg_count);
if (nntp_data->last_message > nntp_data->last_loaded)
{
int oldmsgcount = ctx->mailbox->msg_count;
- bool quiet = ctx->quiet;
- ctx->quiet = true;
+ bool quiet = ctx->mailbox->quiet;
+ ctx->mailbox->quiet = true;
#ifdef USE_HCACHE
if (!hc)
{
}
#endif
rc = nntp_fetch_headers(ctx, hc, nntp_data->last_loaded + 1, nntp_data->last_message, 0);
- ctx->quiet = quiet;
+ ctx->mailbox->quiet = quiet;
if (rc >= 0)
nntp_data->last_loaded = nntp_data->last_message;
if (ret == 0 && ctx->mailbox->msg_count > oldmsgcount)
}
/* fetch all found messages */
- quiet = ctx->quiet;
- ctx->quiet = true;
+ quiet = ctx->mailbox->quiet;
+ ctx->mailbox->quiet = true;
#ifdef USE_HCACHE
hc = nntp_hcache_open(nntp_data);
#endif
#ifdef USE_HCACHE
mutt_hcache_close(hc);
#endif
- ctx->quiet = quiet;
+ ctx->mailbox->quiet = quiet;
FREE(&cc.child);
return (rc < 0) ? -1 : 0;
}
{
struct NmCtxData *data = NULL;
- if (ctx->quiet)
+ if (ctx->mailbox->quiet)
return;
data = get_ctxdata(ctx);
{
struct NmCtxData *data = get_ctxdata(ctx);
- if (ctx->quiet || !data || data->noprogress)
+ if (ctx->mailbox->quiet || !data || data->noprogress)
return;
if (!data->progress_ready && q)
h->active = true;
h->index = ctx->mailbox->msg_count;
- ctx->size += h->content->length + h->content->offset - h->content->hdr_offset;
+ ctx->mailbox->size += h->content->length + h->content->offset - h->content->hdr_offset;
ctx->mailbox->hdrs[ctx->mailbox->msg_count] = h;
ctx->mailbox->msg_count++;
mutt_debug(1, "nm: sync start ...\n");
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
/* all is in this function so we don't use data->progress here */
char msgbuf[PATH_MAX + 64];
struct Header *h = ctx->mailbox->hdrs[i];
struct NmHdrData *hd = h->data;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_progress_update(&progress, i, -1);
*old = '\0';
}
#define CHECK_READONLY \
- if (!Context || Context->readonly) \
+ if (!Context || Context->mailbox->readonly) \
{ \
mutt_flushinp(); \
mutt_error(_(Mailbox_is_read_only)); \
MIN(rd.index->current, (Context->mailbox->msg_count - 1));
index_hint = Context->mailbox->hdrs[Context->v2r[rd.index->current]]->index;
- bool q = Context->quiet;
- Context->quiet = true;
+ bool q = Context->mailbox->quiet;
+ Context->mailbox->quiet = true;
update_index(rd.index, Context, check, oldcount, index_hint);
- Context->quiet = q;
+ Context->mailbox->quiet = q;
rd.index->max = Context->vcount;
CHECK_MODE(IsHeader(extra));
mutt_view_attachments(extra->hdr);
if (Context && extra->hdr->attach_del)
- Context->changed = true;
+ Context->mailbox->changed = true;
pager_menu->redraw = REDRAW_FULL;
break;
rc = mutt_label_message(extra->hdr);
if (rc > 0)
{
- Context->changed = true;
+ Context->mailbox->changed = true;
pager_menu->redraw = REDRAW_FULL;
mutt_message(ngettext("%d label changed", "%d labels changed", rc), rc);
}
}
}
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
{
mutt_progress_init(&progress, _("Fetching message headers..."),
MUTT_PROGRESS_MSG, ReadInc, new_count - old_count);
bool hcached = false;
for (i = old_count; i < new_count; i++)
{
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_progress_update(&progress, i + 1 - old_count, -1);
#ifdef USE_HCACHE
void *data = mutt_hcache_fetch(hc, ctx->mailbox->hdrs[i]->data,
if (pop_reconnect(ctx) < 0)
return -1;
- ctx->size = pop_data->size;
+ ctx->mailbox->size = pop_data->size;
mutt_message(_("Fetching list of messages..."));
if (ctx->mailbox->hdrs[i]->deleted && ctx->mailbox->hdrs[i]->refno != -1)
{
j++;
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_progress_update(&progress, j, -1);
snprintf(buf, sizeof(buf), "DELE %d\r\n", ctx->mailbox->hdrs[i]->refno);
ret = pop_query(pop_data, buf, sizeof(buf));
if (pop_open_connection(pop_data) < 0)
return -1;
- ctx->size = pop_data->size;
+ ctx->mailbox->size = pop_data->size;
mutt_message(_("Checking for new messages..."));
char buf[LONG_STRING];
mutt_message(_("Closing connection to POP server..."));
- if (ctx->readonly)
+ if (ctx->mailbox->readonly)
{
mutt_str_strfcpy(buf, "RSET\r\n", sizeof(buf));
ret = pop_query(pop_data, buf, sizeof(buf));
static const char *Mailbox_is_read_only = N_("Mailbox is read-only");
#define CHECK_READONLY \
- if (Context->readonly) \
+ if (Context->mailbox->readonly) \
{ \
mutt_flushinp(); \
mutt_error(_(Mailbox_is_read_only)); \
return; /* nothing to do! */
}
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_message(_("Sorting mailbox..."));
if (OptNeedRescore && Score)
mutt_set_virtual(ctx);
}
- if (!ctx->quiet)
+ if (!ctx->mailbox->quiet)
mutt_clear_error();
}
if (!optional)
{
snprintf(fmt, sizeof(fmt), "%%%ss", prec);
- mutt_str_pretty_size(tmp, sizeof(tmp), Context ? Context->size : 0);
+ mutt_str_pretty_size(tmp, sizeof(tmp), Context ? Context->mailbox->size : 0);
snprintf(buf, buflen, fmt, tmp);
}
- else if (!Context || !Context->size)
+ else if (!Context || !Context->mailbox->size)
optional = 0;
break;
{
i = OptAttachMsg ?
3 :
- ((Context->readonly || Context->dontwrite) ?
+ ((Context->mailbox->readonly || Context->dontwrite) ?
2 :
- (Context->changed ||
+ (Context->mailbox->changed ||
/* deleted doesn't necessarily mean changed in IMAP */
(Context->mailbox->magic != MUTT_IMAP && Context->deleted)) ?
1 :