break;
}
- if (np && Context && (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0))
+ if (np && Context &&
+ (mutt_str_strcmp(np->b->realpath, Context->mailbox->realpath) == 0))
{
np->b->msg_count = Context->mailbox->msg_count;
np->b->msg_unread = Context->mailbox->msg_unread;
}
}
- const bool need_mailbox_cleanup =
- ((savectx->mailbox->magic == MUTT_MBOX) || (savectx->mailbox->magic == MUTT_MMDF));
+ const bool need_mailbox_cleanup = ((savectx->mailbox->magic == MUTT_MBOX) ||
+ (savectx->mailbox->magic == MUTT_MMDF));
mx_mbox_close(&savectx, NULL);
char tmppath[PATH_MAX];
/* Setup the right paths */
- mutt_str_strfcpy(ctx->mailbox->realpath, ctx->mailbox->path, sizeof(ctx->mailbox->realpath));
+ mutt_str_strfcpy(ctx->mailbox->realpath, ctx->mailbox->path,
+ sizeof(ctx->mailbox->realpath));
/* We will uncompress to /tmp */
mutt_mktemp(tmppath, sizeof(tmppath));
/* To append we need an append-hook or a close-hook */
if (!ci->append && !ci->close)
{
- mutt_error(_("Cannot append without an append-hook or close-hook : %s"), ctx->mailbox->path);
+ mutt_error(_("Cannot append without an append-hook or close-hook : %s"),
+ ctx->mailbox->path);
goto oa_fail1;
}
if (ci->append || ci->close)
return true;
- mutt_error(_("Cannot append without an append-hook or close-hook : %s"), ctx->mailbox->path);
+ mutt_error(_("Cannot append without an append-hook or close-hook : %s"),
+ ctx->mailbox->path);
return false;
}
r = -1;
#ifdef USE_NOTMUCH
- if (msg->committed_path && dest->mailbox->magic == MUTT_MAILDIR && src->mailbox->magic == MUTT_NOTMUCH)
+ if (msg->committed_path && dest->mailbox->magic == MUTT_MAILDIR &&
+ src->mailbox->magic == MUTT_NOTMUCH)
nm_update_filename(src, NULL, msg->committed_path, hdr);
#endif
mutt_error(_(No_mailbox_is_open)); \
break; \
} \
- else if (!Context->mailbox->msg_count) \
+ else if (!Context->mailbox->msg_count) \
{ \
mutt_flushinp(); \
mutt_error(_(There_are_no_messages)); \
menu->make_entry = index_make_entry;
menu->color = index_color;
menu->current = ci_first_message();
- menu->help =
- mutt_compile_help(helpstr, sizeof(helpstr), MENU_MAIN,
+ menu->help = mutt_compile_help(helpstr, sizeof(helpstr), MENU_MAIN,
#ifdef USE_NNTP
- (Context && (Context->mailbox->magic == MUTT_NNTP)) ? IndexNewsHelp :
+ (Context && (Context->mailbox->magic == MUTT_NNTP)) ?
+ IndexNewsHelp :
#endif
- IndexHelp);
+ IndexHelp);
menu->custom_menu_redraw = index_menu_redraw;
mutt_menu_push_current(menu);
}
const int chflags =
- CH_NOLEN | ((ctx->mailbox->magic == MUTT_MBOX || ctx->mailbox->magic == MUTT_MMDF) ? 0 : CH_NOSTATUS);
+ CH_NOLEN |
+ ((ctx->mailbox->magic == MUTT_MBOX || ctx->mailbox->magic == MUTT_MMDF) ? 0 : CH_NOSTATUS);
rc = mutt_append_message(tmpctx, ctx, cur, 0, chflags);
oerrno = errno;
}
of = 0;
- cf = (((tmpctx->mailbox->magic == MUTT_MBOX) || (tmpctx->mailbox->magic == MUTT_MMDF)) ? 0 : CH_NOSTATUS);
+ cf = (((tmpctx->mailbox->magic == MUTT_MBOX) || (tmpctx->mailbox->magic == MUTT_MMDF)) ?
+ 0 :
+ CH_NOSTATUS);
if (fgets(buf, sizeof(buf), fp) && is_from(buf, NULL, 0, NULL))
{
bool started = false;
struct Header **hdrs = idata->ctx->hdrs;
- for (n = *pos; n < idata->ctx->mailbox->msg_count && 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 */
if (Sort != SORT_ORDER)
{
hdrs = idata->ctx->hdrs;
- idata->ctx->hdrs = mutt_mem_malloc(idata->ctx->mailbox->msg_count * 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->mailbox->msg_count, sizeof(struct Header *),
- mutt_get_sort_func(SORT_ORDER));
+ qsort(idata->ctx->hdrs, idata->ctx->mailbox->msg_count,
+ sizeof(struct Header *), mutt_get_sort_func(SORT_ORDER));
}
pos = 0;
imap_qualify_path(buf, sizeof(buf), &mx, idata->mailbox);
mutt_str_strfcpy(ctx->mailbox->path, buf, sizeof(ctx->mailbox->path));
- mutt_str_strfcpy(ctx->mailbox->realpath, ctx->mailbox->path, sizeof(ctx->mailbox->realpath));
+ mutt_str_strfcpy(ctx->mailbox->realpath, ctx->mailbox->path,
+ sizeof(ctx->mailbox->realpath));
idata->ctx = ctx;
memcpy(ctx->hdrs, hdrs, ctx->mailbox->msg_count * sizeof(struct Header *));
Sort = SORT_ORDER;
- qsort(ctx->hdrs, ctx->mailbox->msg_count, 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");
mailbox_free(&(*ctx)->mailbox);
FREE(ctx);
}
-
omask = umask(mh_umask(ctx));
while (true)
{
- snprintf(path, sizeof(path), "%s/tmp/%s.%lld.R%" PRIu64 ".%s%s", ctx->mailbox->path, subdir,
- (long long) time(NULL), mutt_rand64(), NONULL(ShortHostname), suffix);
+ snprintf(path, sizeof(path), "%s/tmp/%s.%lld.R%" PRIu64 ".%s%s",
+ ctx->mailbox->path, subdir, (long long) time(NULL), mutt_rand64(),
+ NONULL(ShortHostname), suffix);
mutt_debug(2, "Trying %s.\n", path);
if (!ctx->quiet)
{
snprintf(msgbuf, sizeof(msgbuf), _("Writing %s..."), ctx->mailbox->path);
- mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc, ctx->mailbox->msg_count);
+ mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc,
+ ctx->mailbox->msg_count);
}
for (i = 0; i < ctx->mailbox->msg_count; i++)
if (!ctx->fp)
rc = -1;
else
- rc = ((ctx->mailbox->magic == MUTT_MBOX) ? mbox_parse_mailbox : mmdf_parse_mailbox)(ctx);
+ rc = ((ctx->mailbox->magic == MUTT_MBOX) ? mbox_parse_mailbox :
+ mmdf_parse_mailbox)(ctx);
break;
default:
if (!ctx->quiet)
{
snprintf(msgbuf, sizeof(msgbuf), _("Writing %s..."), ctx->mailbox->path);
- mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc, ctx->mailbox->msg_count);
+ mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc,
+ ctx->mailbox->msg_count);
}
for (i = first, j = 0; i < ctx->mailbox->msg_count; i++)
static void linearize_tree(struct Context *ctx)
{
struct MuttThread *tree = ctx->tree;
- struct Header **array = ctx->hdrs + ((Sort & SORT_REVERSE) ? ctx->mailbox->msg_count - 1 : 0);
+ struct Header **array =
+ ctx->hdrs + ((Sort & SORT_REVERSE) ? ctx->mailbox->msg_count - 1 : 0);
while (tree)
{
mutt_str_strfcpy(ctx->mailbox->path, path, sizeof(ctx->mailbox->path));
if (!realpath(ctx->mailbox->path, ctx->mailbox->realpath))
- mutt_str_strfcpy(ctx->mailbox->realpath, ctx->mailbox->path, sizeof(ctx->mailbox->realpath));
+ mutt_str_strfcpy(ctx->mailbox->realpath, ctx->mailbox->path,
+ sizeof(ctx->mailbox->realpath));
ctx->msgnotreadyet = -1;
ctx->collapsed = false;
ctx->mailbox->magic = mx_path_probe(path, NULL);
ctx->mx_ops = mx_get_ops(ctx->mailbox->magic);
- if ((ctx->mailbox->magic == MUTT_UNKNOWN) || (ctx->mailbox->magic == MUTT_MAILBOX_ERROR) || !ctx->mx_ops)
+ if ((ctx->mailbox->magic == MUTT_UNKNOWN) ||
+ (ctx->mailbox->magic == MUTT_MAILBOX_ERROR) || !ctx->mx_ops)
{
if (ctx->mailbox->magic == MUTT_MAILBOX_ERROR)
mutt_perror(path);
return;
/* fix up the times so mailbox won't get confused */
- if (ctx->peekonly && ctx->mailbox->path && (mutt_timespec_compare(&ctx->mtime, &ctx->atime) > 0))
+ if (ctx->peekonly && ctx->mailbox->path &&
+ (mutt_timespec_compare(&ctx->mtime, &ctx->atime) > 0))
{
#ifdef HAVE_UTIMENSAT
struct timespec ts[2];
ctx->mailbox->msg_count - ctx->deleted, read_msgs, ctx->deleted);
}
else
- mutt_message(_("%d kept, %d deleted"), ctx->mailbox->msg_count - ctx->deleted, ctx->deleted);
+ mutt_message(_("%d kept, %d deleted"),
+ ctx->mailbox->msg_count - ctx->deleted, ctx->deleted);
}
- if (ctx->mailbox->msg_count == ctx->deleted && (ctx->mailbox->magic == MUTT_MMDF || ctx->mailbox->magic == MUTT_MBOX) &&
+ if (ctx->mailbox->msg_count == ctx->deleted &&
+ (ctx->mailbox->magic == MUTT_MMDF || ctx->mailbox->magic == MUTT_MBOX) &&
!mutt_is_spool(ctx->mailbox->path) && !SaveEmpty)
{
mutt_file_unlink_empty(ctx->mailbox->path);
for (i = 0, j = 0; i < ctx->mailbox->msg_count; i++)
{
if (!ctx->hdrs[i]->quasi_deleted &&
- ((committing && (!ctx->hdrs[i]->deleted || (ctx->mailbox->magic == MUTT_MAILDIR && MaildirTrash))) ||
+ ((committing && (!ctx->hdrs[i]->deleted ||
+ (ctx->mailbox->magic == MUTT_MAILDIR && MaildirTrash))) ||
(!committing && ctx->hdrs[i]->active)))
{
if (i != j)
mutt_sleep(0);
- if (ctx->mailbox->msg_count == ctx->deleted && (ctx->mailbox->magic == MUTT_MBOX || ctx->mailbox->magic == MUTT_MMDF) &&
+ if (ctx->mailbox->msg_count == ctx->deleted &&
+ (ctx->mailbox->magic == MUTT_MBOX || ctx->mailbox->magic == MUTT_MMDF) &&
!mutt_is_spool(ctx->mailbox->path) && !SaveEmpty)
{
unlink(ctx->mailbox->path);
if (ctx->mailbox->magic == MUTT_MMDF)
fputs(MMDF_SEP, msg->fp);
- if ((ctx->mailbox->magic == MUTT_MBOX || ctx->mailbox->magic == MUTT_MMDF) && flags & MUTT_ADD_FROM)
+ if ((ctx->mailbox->magic == MUTT_MBOX || ctx->mailbox->magic == MUTT_MMDF) &&
+ flags & MUTT_ADD_FROM)
{
if (hdr)
{
if (!ctx->mx_ops || !ctx->mx_ops->msg_open)
{
- mutt_debug(1, "function not implemented for mailbox type %d.\n", ctx->mailbox->magic);
+ mutt_debug(1, "function not implemented for mailbox type %d.\n",
+ ctx->mailbox->magic);
return NULL;
}
void mx_update_context(struct Context *ctx, int new_messages)
{
struct Header *h = NULL;
- for (int msgno = ctx->mailbox->msg_count - new_messages; msgno < ctx->mailbox->msg_count; msgno++)
+ for (int msgno = ctx->mailbox->msg_count - new_messages;
+ msgno < ctx->mailbox->msg_count; msgno++)
{
h = ctx->hdrs[msgno];
if (data->progress_ready)
{
mutt_progress_update(&data->progress,
- ctx->mailbox->msg_count + 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->mailbox->msg_count,
- notmuch_message_get_message_id(msg), path);
+ mutt_debug(2, "nm: appending message, i=%d, id=%s, path=%s\n",
+ ctx->mailbox->msg_count, notmuch_message_get_message_id(msg), path);
if (ctx->mailbox->msg_count >= ctx->hdrmax)
{
threads = notmuch_query_search_threads(q);
#endif
- for (; notmuch_threads_valid(threads) && ((limit == 0) || (ctx->mailbox->msg_count < 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->mailbox->msg_count);
+ 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);
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->mailbox->msg_count);
+ mutt_debug(1, "nm: reading messages... done [rc=%d, count=%d]\n", rc,
+ ctx->mailbox->msg_count);
return rc;
}
ctx->mailbox->msg_count, new_flags, occult);
return occult ? MUTT_REOPENED :
- (ctx->mailbox->msg_count > data->oldmsgcount) ? MUTT_NEW_MAIL :
- new_flags ? MUTT_FLAGS : 0;
+ (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->mailbox->msg_count);
+ mutt_progress_init(&progress, msgbuf, MUTT_PROGRESS_MSG, WriteInc,
+ ctx->mailbox->msg_count);
}
for (int i = 0; i < ctx->mailbox->msg_count; i++)
mutt_str_strfcpy(tmphelp, helpstr, sizeof(tmphelp));
mutt_compile_help(buffer, sizeof(buffer), MENU_PAGER,
#ifdef USE_NNTP
- (Context && (Context->mailbox->magic == MUTT_NNTP)) ? PagerNewsHelpExtra :
+ (Context && (Context->mailbox->magic == MUTT_NNTP)) ?
+ PagerNewsHelpExtra :
#endif
- PagerHelpExtra);
+ PagerHelpExtra);
snprintf(helpstr, sizeof(helpstr), "%s %s", tmphelp, buffer);
}
if (!InHelp)
{
/* After the mailbox has been updated,
* rd.index->current might be invalid */
- rd.index->current = MIN(rd.index->current, (Context->mailbox->msg_count - 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;
return -1;
mutt_str_strfcpy(ctx->mailbox->path, buf, sizeof(ctx->mailbox->path));
- mutt_str_strfcpy(ctx->mailbox->realpath, ctx->mailbox->path, sizeof(ctx->mailbox->realpath));
+ mutt_str_strfcpy(ctx->mailbox->realpath, ctx->mailbox->path,
+ sizeof(ctx->mailbox->realpath));
pop_data = mutt_mem_calloc(1, sizeof(struct PopData));
pop_data->conn = conn;
* @param decrypted True if attachment has been decrypted
*/
static void mutt_generate_recvattach_list(struct AttachCtx *actx, struct Header *hdr,
- struct Body *m, FILE *fp,
- int parent_type, int level, bool decrypted)
+ struct Body *m, FILE *fp, int parent_type,
+ int level, bool decrypted)
{
struct AttachPtr *new = NULL;
struct Body *new_body = NULL;
mutt_fix_reply_recipients(msg->env);
#ifdef USE_NNTP
- if ((flags & SEND_NEWS) && ctx && ctx->mailbox->magic == MUTT_NNTP && !msg->env->newsgroups)
+ if ((flags & SEND_NEWS) && ctx && ctx->mailbox->magic == MUTT_NNTP &&
+ !msg->env->newsgroups)
msg->env->newsgroups = mutt_str_strdup(((struct NntpData *) ctx->data)->group);
#endif
TopIndex = EntryCount;
if (BotIndex < 0)
BotIndex = EntryCount;
- if ((OpnIndex < 0) && Context && (mutt_str_strcmp(b->realpath, Context->mailbox->realpath) == 0))
+ if ((OpnIndex < 0) && Context &&
+ (mutt_str_strcmp(b->realpath, Context->mailbox->realpath) == 0))
OpnIndex = EntryCount;
EntryCount++;
{
#ifdef USE_NOTMUCH
char *p = NULL;
- if (Context && Context->mailbox->magic == MUTT_NOTMUCH && (p = nm_get_description(Context)))
+ if (Context && Context->mailbox->magic == MUTT_NOTMUCH &&
+ (p = nm_get_description(Context)))
mutt_str_strfcpy(tmp, p, sizeof(tmp));
else
#endif
if (!optional)
{
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, Context ? Context->mailbox->msg_unread - Context->new : 0);
+ snprintf(buf, buflen, fmt,
+ Context ? Context->mailbox->msg_unread - Context->new : 0);
}
else if (!Context || !(Context->mailbox->msg_unread - Context->new))
optional = 0;
if (Context)
{
- i = OptAttachMsg ? 3 :
- ((Context->readonly || Context->dontwrite) ?
- 2 :
- (Context->changed ||
- /* deleted doesn't necessarily mean changed in IMAP */
- (Context->mailbox->magic != MUTT_IMAP && Context->deleted)) ?
- 1 :
- 0);
+ i = OptAttachMsg ?
+ 3 :
+ ((Context->readonly || Context->dontwrite) ?
+ 2 :
+ (Context->changed ||
+ /* deleted doesn't necessarily mean changed in IMAP */
+ (Context->mailbox->magic != MUTT_IMAP && Context->deleted)) ?
+ 1 :
+ 0);
}
if (!StatusChars || !StatusChars->len)