return -1;
}
- mutt_buffy_check(false);
+ mutt_buffy_check(0);
dp = opendir(d);
if (!dp)
if (!tmp)
return -1;
- mutt_buffy_check(false);
+ mutt_buffy_check(0);
init_state(state, menu);
if (!Incoming)
return -1;
- mutt_buffy_check(false);
+ mutt_buffy_check(0);
do
{
if (buffy)
{
menu->is_mailbox_list = 1;
- snprintf(title, titlelen, _("Mailboxes [%d]"), mutt_buffy_check(false));
+ snprintf(title, titlelen, _("Mailboxes [%d]"), mutt_buffy_check(0));
}
else
{
/**
* mutt_buffy_check - Check all Incoming for new mail
- * @param force If true, ignore MailCheck and check for new mail anyway
+ * @param force Force flags, see below
* @retval num Number of mailboxes with new mail
*
+ * The force argument may be any combination of the following values:
+ * - MUTT_BUFFY_CHECK_FORCE ignore BuffyTimeout and check for new mail
+ * - MUTT_BUFFY_CHECK_FORCE_STATS ignore BuffyTimeout and calculate statistics
+ *
* Check all Incoming for new mail and total/new/flagged messages
*/
-int mutt_buffy_check(bool force)
+int mutt_buffy_check(int force)
{
struct stat contex_sb;
time_t t;
#ifdef USE_IMAP
/* update postponed count as well, on force */
- if (force)
+ if (force & MUTT_BUFFY_CHECK_FORCE)
mutt_update_num_postponed();
#endif
if (!force && (t - BuffyTime < MailCheck))
return BuffyCount;
- if (MailCheckStats && (t - BuffyStatsTime >= MailCheckStatsInterval))
+ if ((force & MUTT_BUFFY_CHECK_FORCE_STATS) ||
+ (MailCheckStats && ((t - BuffyStatsTime) >= MailCheckStatsInterval)))
{
check_stats = true;
BuffyStatsTime = t;
*/
bool mutt_buffy_notify(void)
{
- if (mutt_buffy_check(false) && BuffyNotify)
+ if (mutt_buffy_check(0) && BuffyNotify)
{
return mutt_buffy_list();
}
{
mutt_expand_path(s, slen);
- if (mutt_buffy_check(false))
+ if (mutt_buffy_check(0))
{
int found = 0;
for (int pass = 0; pass < 2; pass++)
}
}
- mutt_buffy_check(true); /* buffy was wrong - resync things */
+ mutt_buffy_check(MUTT_BUFFY_CHECK_FORCE); /* buffy was wrong - resync things */
}
/* no folders with new mail */
*/
void mutt_buffy_vfolder(char *buf, size_t buflen)
{
- if (mutt_buffy_check(false))
+ if (mutt_buffy_check(0))
{
bool found = false;
for (int pass = 0; pass < 2; pass++)
}
}
- mutt_buffy_check(true); /* buffy was wrong - resync things */
+ mutt_buffy_check(MUTT_BUFFY_CHECK_FORCE); /* buffy was wrong - resync things */
}
/* no folders with new mail */
bool mh_buffy(struct Buffy *mailbox, bool check_stats);
+/* force flags passed to mutt_buffy_check() */
+#define MUTT_BUFFY_CHECK_FORCE (1 << 0)
+#define MUTT_BUFFY_CHECK_FORCE_STATS (1 << 1)
+
/* These variables are backing for config items */
WHERE short MailCheck;
WHERE short MailCheckStatsInterval;
if ((rc != 0) || WaitKey)
mutt_any_key_to_continue(NULL);
- mutt_buffy_check(true);
+ mutt_buffy_check(MUTT_BUFFY_CHECK_FORCE);
}
/**
}
return rc;
}
+
+void mutt_check_stats(void)
+{
+ mutt_buffy_check(MUTT_BUFFY_CHECK_FORCE | MUTT_BUFFY_CHECK_FORCE_STATS);
+}
#endif
mutt_clear_error();
- mutt_buffy_check(true); /* force the buffy check after we have changed the folder */
+ mutt_buffy_check(MUTT_BUFFY_CHECK_FORCE); /* force the buffy check after we have changed the folder */
menu->redraw = REDRAW_FULL;
OptSearchInvalid = true;
mutt_menu_push_current(menu);
if (!attach_msg)
- mutt_buffy_check(true); /* force the buffy check after we enter the folder */
+ {
+ /* force the buffy check after we enter the folder */
+ mutt_buffy_check(MUTT_BUFFY_CHECK_FORCE);
+ }
if (((Sort & SORT_MASK) == SORT_THREADS) && CollapseAll)
{
{
/* check for new mail in the incoming folders */
oldcount = newcount;
- newcount = mutt_buffy_check(false);
+ newcount = mutt_buffy_check(0);
if (newcount != oldcount)
menu->redraw |= REDRAW_STATUS;
if (do_buffy_notify)
case OP_MAIN_CHANGE_VFOLDER:
#endif
+ case OP_CHECK_STATS:
+ mutt_check_stats();
+ break;
+
#ifdef USE_SIDEBAR
case OP_SIDEBAR_OPEN:
#endif
<emphasis>pager</emphasis> menus have these interesting functions:
</para>
<variablelist>
+ <varlistentry>
+ <term>
+ <literal><check-stats></literal>
+ <anchor id="check-stats" />
+ </term>
+ <listitem>
+ <para>
+ Calculate statistics for all monitored mailboxes declared using
+ the <command>mailboxes</command>command. It will calculate
+ statistics despite <link linkend="mail-check-stats">$mail_check_stats</link>
+ being unset.
+ </para>
+ </listitem>
+ </varlistentry>
<varlistentry>
<term>
<literal><create-alias></literal> (default: a)
** </para>
*/
{ "bottom-page", OP_BOTTOM_PAGE, "L" },
+ { "check-stats", OP_CHECK_STATS, NULL },
{ "current-bottom", OP_CURRENT_BOTTOM, NULL },
{ "current-middle", OP_CURRENT_MIDDLE, NULL },
{ "current-top", OP_CURRENT_TOP, NULL },
#ifdef USE_NOTMUCH
{ "change-vfolder", OP_MAIN_CHANGE_VFOLDER, NULL },
#endif
+ { "check-stats", OP_CHECK_STATS, NULL },
{ "check-traditional-pgp", OP_CHECK_TRADITIONAL, "\033P" },
{ "clear-flag", OP_MAIN_CLEAR_FLAG, "W" },
{ "compose-to-sender", OP_COMPOSE_TO_SENDER, NULL },
** this operation is more performance intensive, it defaults to
** \fIunset\fP, and has a separate option, $$mail_check_stats_interval, to
** control how often to update these counts.
+ ** .pp
+ ** Message statistics can also be explicitly calculated by invoking the
+ ** \fC<check-stats>\fP function.
*/
{ "mail_check_stats_interval", DT_NUMBER, R_NONE, &MailCheckStatsInterval, 60 },
/*
{
if (flags & MUTT_BUFFY)
{
- if (mutt_buffy_check(false) == 0)
+ if (mutt_buffy_check(0) == 0)
{
mutt_message(_("No mailbox with new mail."));
goto main_curses; // TEST37: neomutt -Z (no new mail)
mutt_what_key();
break;
+ case OP_CHECK_STATS:
+ mutt_check_stats();
+ break;
+
case OP_REDRAW:
clearok(stdscr, true);
menu->redraw = REDRAW_FULL;
_fmt(OP_CATCHUP, N_("mark all articles in newsgroup as read")) \
_fmt(OP_CHANGE_DIRECTORY, N_("change directories")) \
_fmt(OP_CHECK_NEW, N_("check mailboxes for new mail")) \
+ _fmt(OP_CHECK_STATS, N_("calculate message statistics for all mailboxes")) \
_fmt(OP_COMPOSE_ATTACH_FILE, N_("attach files to this message")) \
_fmt(OP_COMPOSE_ATTACH_MESSAGE, N_("attach messages to this message")) \
_fmt(OP_COMPOSE_ATTACH_NEWS_MESSAGE, N_("attach news articles to this message")) \
mutt_what_key();
break;
+ case OP_CHECK_STATS:
+ mutt_check_stats();
+ break;
+
#ifdef USE_SIDEBAR
case OP_SIDEBAR_NEXT:
case OP_SIDEBAR_NEXT_NEW:
int mutt_bounce_message(FILE *fp, struct Header *h, struct Address *to);
void mutt_buffy(char *s, size_t slen);
bool mutt_buffy_list(void);
+void mutt_check_stats(void);
int mutt_count_body_parts(struct Context *ctx, struct Header *hdr);
void mutt_check_rescore(struct Context *ctx);
void mutt_clear_error(void);
int mutt_alloc_color(int fg, int bg);
int mutt_combine_color(int fg_attr, int bg_attr);
int mutt_any_key_to_continue(const char *s);
-int mutt_buffy_check(bool force);
+int mutt_buffy_check(int force);
bool mutt_buffy_notify(void);
int mutt_builtin_editor(const char *path, struct Header *msg, struct Header *cur);
int mutt_change_flag(struct Header *h, int bf);
if (!optional)
{
snprintf(fmt, sizeof(fmt), "%%%sd", prec);
- snprintf(buf, buflen, fmt, mutt_buffy_check(false));
+ snprintf(buf, buflen, fmt, mutt_buffy_check(0));
}
- else if (mutt_buffy_check(false) == 0)
+ else if (mutt_buffy_check(0) == 0)
optional = 0;
break;