From: Pierre Habouzit Date: Tue, 14 Aug 2007 17:56:57 +0000 (+0200) Subject: Simplifications. X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=391e6a700bb5447ab9d628fa9b909b919e8228f2 Simplifications. Signed-off-by: Pierre Habouzit --- diff --git a/buffy.cpkg b/buffy.cpkg index 078c2f5..c549b83 100644 --- a/buffy.cpkg +++ b/buffy.cpkg @@ -121,7 +121,7 @@ int buffy_check(int force) struct stat contex_sb; time_t now, last1, last2; CONTEXT *ctx; - int i = 0, local = 0, count = 0; + int i = 0, local = 0; /* update postponed count as well, on force */ if (force == 1) @@ -145,8 +145,6 @@ int buffy_check(int force) BuffyCount = 0; BuffyNotify = 0; - count = sidebar_need_count(); - if (!Context || !Context->path || (mx_is_local (Context->magic-1) && stat (Context->path, &contex_sb) != 0)) { /* check device ID and serial number instead of comparing paths */ @@ -175,7 +173,7 @@ int buffy_check(int force) case M_MBOX: /* only check on force or $mail_check reached */ if (force == 1 || (now - last1 >= mod_buffy.mail_check)) { - if (!count) { + if (!sidebar_w) { if (STAT_CHECK) { BuffyCount++; tmp->new = 1; @@ -221,7 +219,7 @@ int buffy_check(int force) /* one new and undeleted message is enough */ if (tmp->new == 0) { BuffyCount++; - if (!count) { + if (!sidebar_w) { /* if sidebar invisible -> done */ tmp->new = 1; break; @@ -234,7 +232,7 @@ int buffy_check(int force) } closedir (dirp); - if (count) { + if (sidebar_w) { /* only count total mail if sidebar visible */ snprintf (path, sizeof (path), "%s/cur", tmp->path); if ((dirp = opendir (path)) == NULL) { @@ -266,7 +264,7 @@ int buffy_check(int force) if (force == 1 || (now - last1 >= mod_buffy.mail_check)) { if ((tmp->new = mh_buffy (tmp->path)) > 0) BuffyCount++; - if (count) { + if (sidebar_w) { DIR *dp; if ((dp = opendir (path)) == NULL) diff --git a/lib-ui/sidebar.c b/lib-ui/sidebar.c index abf76d7..180e0c3 100644 --- a/lib-ui/sidebar.c +++ b/lib-ui/sidebar.c @@ -173,11 +173,6 @@ sidebar_number_format(char* dest, ssize_t destlen, return src; } -int sidebar_need_count(void) -{ - return sidebar_w && !m_strisempty(SidebarNumberFormat); -} - /* print single item * returns: * 0 item was not printed ('cause of $sidebar_newmail_only) diff --git a/lib-ui/sidebar.h b/lib-ui/sidebar.h index b56f2bc..11a5873 100644 --- a/lib-ui/sidebar.h +++ b/lib-ui/sidebar.h @@ -13,12 +13,10 @@ #include "mutt.h" /* because of CONTEXT :| */ -int sidebar_draw (void); -void sidebar_scroll (int); -void sidebar_set_buffystats (CONTEXT *); -const char* sidebar_get_current (void); -void sidebar_set_current (const char*); -/* returns one if buff_check should thorougly count */ -int sidebar_need_count (void); +int sidebar_draw(void); +void sidebar_scroll(int); +void sidebar_set_buffystats(CONTEXT *); +const char *sidebar_get_current(void); +void sidebar_set_current(const char *); #endif /* _SIDEBAR_H */