contex_sb.st_ino=0;
}
+#ifdef USE_SIDEBAR
+ int should_refresh = sb_should_refresh();
+#endif
for (tmp = Incoming; tmp; tmp = tmp->next)
{
if (tmp->magic != M_IMAP)
case M_MBOX:
case M_MMDF:
#ifdef USE_SIDEBAR
- if (sb_should_refresh()) {
+ if (should_refresh)
buffy_mbox_update (tmp, &sb);
- sb_set_update_time();
- }
#endif
if (buffy_mbox_hasnew (tmp, &sb) > 0)
BuffyCount++;
case M_MAILDIR:
#ifdef USE_SIDEBAR
- if (sb_should_refresh()) {
+ if (should_refresh)
buffy_maildir_update (tmp);
- sb_set_update_time();
- }
#endif
if (buffy_maildir_hasnew (tmp) > 0)
BuffyCount++;
else if (!tmp->notified)
BuffyNotify++;
}
+#ifdef USE_SIDEBAR
+ if (should_refresh)
+ sb_set_update_time();
+#endif
BuffyDoneTime = BuffyTime;
return (BuffyCount);
WHERE short SidebarWidth;
#ifdef USE_SIDEBAR
WHERE struct buffy_t *CurBuffy INITVAL(0);
-WHERE short SidebarLastRefresh;
WHERE short SidebarRefresh;
WHERE LIST *SidebarWhitelist INITVAL(0);
#endif
static BUFFY *TopBuffy;
static BUFFY *BottomBuffy;
+static time_t LastRefresh;
static int known_lines;
/**
saveSidebarWidth = SidebarWidth;
if (!option (OPTSIDEBAR))
SidebarWidth = 0;
- SidebarLastRefresh = time (NULL);
+ LastRefresh = time (NULL);
initialized = true;
}
int
sb_should_refresh (void)
{
- if (option (OPTSIDEBAR) && (SidebarRefresh > 0)) {
- if ((time (NULL) - SidebarLastRefresh) >= SidebarRefresh) {
- return 1;
- }
- }
- return 0;
+ if (!option (OPTSIDEBAR))
+ return 0;
+
+ if (SidebarRefresh == 0)
+ return 0;
+
+ time_t diff = (time (NULL) - LastRefresh);
+
+ return (diff >= SidebarRefresh);
}
/**
{
/* XXX - should this be public? */
- SidebarLastRefresh = time (NULL);
+ LastRefresh = time (NULL);
}