This used to copy stats from the Context to the Mailbox.
Now, the Context points to the Mailbox.
#ifdef USE_SIDEBAR
if (menu->redraw & REDRAW_SIDEBAR)
- {
- mutt_sb_set_mailbox_stats(Context);
menu_redraw_sidebar(menu);
- }
#endif
if (Context && Context->mailbox->hdrs && !(menu->current >= Context->mailbox->vcount))
* @note Headers must be in SORT_ORDER. See imap_exec_msgset() for args.
* Pos is an opaque pointer a la strtok(). It should be 0 at first call.
*/
-static int make_msg_set(struct ImapMboxData *mdata, struct Buffer *buf, int flag,
- bool changed, bool invert, int *pos)
+static int make_msg_set(struct ImapMboxData *mdata, struct Buffer *buf,
+ int flag, bool changed, bool invert, int *pos)
{
int count = 0; /* number of messages in message set */
unsigned int setstart = 0; /* start of current message range */
* Prepares commands for all messages matching conditions
* (must be flushed with imap_exec)
*/
-int imap_exec_msgset(struct ImapMboxData *mdata, const char *pre, const char *post,
- int flag, bool changed, bool invert)
+int imap_exec_msgset(struct ImapMboxData *mdata, const char *pre,
+ const char *post, int flag, bool changed, bool invert)
{
struct Email **emails = NULL;
short oldsort;
if (ctx->mailbox->hdrs[i]->deleted && ctx->mailbox->hdrs[i]->flagged)
ctx->mailbox->msg_flagged--;
}
- ctx->mailbox->msg_count -= ctx->deleted;
- mutt_sb_set_mailbox_stats(ctx);
ctx->mailbox->msg_count = orig_msgcount;
}
#endif
buflen *= 2;
mutt_mem_realloc(&buf, buflen);
}
- snprintf(buf + off, buflen - off, "%s%c ", mdata->group,
- mdata->subscribed ? ':' : '!');
+ snprintf(buf + off, buflen - off, "%s%c ", mdata->group, mdata->subscribed ? ':' : '!');
off += strlen(buf + off);
/* write entries */
snprintf(buf + off, buflen - off, "%u", mdata->newsrc_ent[j].first);
else if (mdata->newsrc_ent[j].first < mdata->newsrc_ent[j].last)
{
- snprintf(buf + off, buflen - off, "%u-%u",
- mdata->newsrc_ent[j].first, mdata->newsrc_ent[j].last);
+ snprintf(buf + off, buflen - off, "%u-%u", mdata->newsrc_ent[j].first,
+ mdata->newsrc_ent[j].last);
}
off += strlen(buf + off);
}
mutt_mem_realloc(&buf, buflen);
}
snprintf(buf + off, buflen - off, "%s %u %u %c%s%s\n", mdata->group,
- mdata->last_message, mdata->first_message,
- mdata->allowed ? 'y' : 'n', mdata->desc ? " " : "",
- mdata->desc ? mdata->desc : "");
+ mdata->last_message, mdata->first_message, mdata->allowed ? 'y' : 'n',
+ mdata->desc ? " " : "", mdata->desc ? mdata->desc : "");
off += strlen(buf + off);
}
struct Url url;
char file[PATH_MAX];
- if (!mdata->nserv || !mdata->nserv->cacheable ||
- !mdata->nserv->conn || !mdata->group ||
- !(mdata->newsrc_ent || mdata->subscribed || SaveUnsubscribed))
+ if (!mdata->nserv || !mdata->nserv->cacheable || !mdata->nserv->conn ||
+ !mdata->group || !(mdata->newsrc_ent || mdata->subscribed || SaveUnsubscribed))
{
return NULL;
}
for (unsigned int i = 0; i < mdata->newsrc_len; i++)
{
- if ((anum >= mdata->newsrc_ent[i].first) &&
- (anum <= mdata->newsrc_ent[i].last))
+ if ((anum >= mdata->newsrc_ent[i].first) && (anum <= mdata->newsrc_ent[i].last))
{
/* can't use mutt_set_flag() because mx_update_context()
didn't get called yet */
* @retval NULL Error
*/
struct NntpMboxData *mutt_newsgroup_catchup(struct Context *ctx,
- struct NntpServer *nserv, char *group)
+ struct NntpServer *nserv, char *group)
{
struct NntpMboxData *mdata = NULL;
* @retval NULL Error
*/
struct NntpMboxData *mutt_newsgroup_uncatchup(struct Context *ctx,
- struct NntpServer *nserv, char *group)
+ struct NntpServer *nserv, char *group)
{
struct NntpMboxData *mdata = NULL;
while (true)
{
char *p = NULL;
- int chunk = mutt_socket_readln_d(buf, sizeof(buf), mdata->nserv->conn,
- MUTT_SOCK_LOG_HDR);
+ int chunk = mutt_socket_readln_d(buf, sizeof(buf), mdata->nserv->conn, MUTT_SOCK_LOG_HDR);
if (chunk < 0)
{
mdata->nserv->status = NNTP_NONE;
len++;
buf[len] = '\0';
}
- if (mutt_socket_send_d(mdata->nserv->conn,
- buf[1] == '.' ? buf : buf + 1, MUTT_SOCK_LOG_HDR) < 0)
+ if (mutt_socket_send_d(mdata->nserv->conn, buf[1] == '.' ? buf : buf + 1,
+ MUTT_SOCK_LOG_HDR) < 0)
{
mutt_file_fclose(&fp);
return nntp_connect_error(mdata->nserv);
/* fetch message to cache file */
snprintf(buf, sizeof(buf), "ARTICLE %s\r\n",
NNTP_EDATA(e)->article_num ? article : e->env->message_id);
- const int rc = nntp_fetch_lines(mdata, buf, sizeof(buf), fetch_msg,
- fetch_tempfile, msg->fp);
+ const int rc =
+ nntp_fetch_lines(mdata, buf, sizeof(buf), fetch_msg, fetch_tempfile, msg->fp);
if (rc)
{
mutt_file_fclose(&msg->fp);
mailbox->hdrs[i]->data = new_emaildata(line);
mailbox->hdrs[i]->free_data = free_emaildata;
-
}
else if (mailbox->hdrs[i]->index != index - 1)
mdata->clear_cache = true;
* - if we also have a body: read
* - if we don't have a body: new
*/
- const bool bcached = (mutt_bcache_exists(mdata->bcache, cache_id(edata->uid)) == 0);
+ const bool bcached =
+ (mutt_bcache_exists(mdata->bcache, cache_id(edata->uid)) == 0);
ctx->mailbox->hdrs[i]->old = false;
ctx->mailbox->hdrs[i]->read = false;
if (hcached)
while (true)
{
- const int chunk =
- mutt_socket_readln_d(buf, sizeof(buf), mdata->conn, MUTT_SOCK_LOG_HDR);
+ const int chunk = mutt_socket_readln_d(buf, sizeof(buf), mdata->conn, MUTT_SOCK_LOG_HDR);
if (chunk < 0)
{
mdata->status = POP_DISCONNECTED;
mutt_menu_set_current_redraw(REDRAW_SIDEBAR);
}
-/**
- * mutt_sb_set_mailbox_stats - Update the Mailbox's message counts from the Context
- * @param ctx A mailbox Context
- *
- * Given a mailbox Context, find a matching mailbox Mailbox and copy the message
- * counts into it.
- */
-void mutt_sb_set_mailbox_stats(const struct Context *ctx)
-{
- if (!ctx)
- return;
-
- /* Even if the sidebar's hidden, we should take note of the new data. */
- struct MailboxNode *np = NULL;
- STAILQ_FOREACH(np, &AllMailboxes, entries)
- {
- if (mutt_str_strcmp(np->m->realpath, ctx->mailbox->realpath) == 0)
- {
- np->m->msg_unread = ctx->mailbox->msg_unread;
- np->m->msg_count = ctx->mailbox->msg_count;
- np->m->msg_flagged = ctx->mailbox->msg_flagged;
- break;
- }
- }
-}
-
/**
* mutt_sb_get_highlight - Get the Mailbox that's highlighted in the sidebar
* @retval ptr Mailbox path
void mutt_sb_draw(void);
const char *mutt_sb_get_highlight(void);
void mutt_sb_notify_mailbox(struct Mailbox *m, bool created);
-void mutt_sb_set_mailbox_stats(const struct Context *ctx);
void mutt_sb_set_open_mailbox(void);
void mutt_sb_toggle_virtual(void);