From 1e88ec7dcd2b89656bcb37013f3aead484192643 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 13 Aug 2000 22:02:32 +0000 Subject: Mail counter fixes. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@604 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-text/statusbar-items.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/fe-text') diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c index df1f36eb..08f46eb2 100644 --- a/src/fe-text/statusbar-items.c +++ b/src/fe-text/statusbar-items.c @@ -593,17 +593,24 @@ static int get_mail_count(void) int count; fname = g_getenv("MAIL"); - if (stat(fname, &statbuf) != 0) + if (stat(fname, &statbuf) != 0) { + mail_last_mtime = -1; + mail_last_size = -1; + mail_last_count = 0; return 0; + } - if (statbuf.st_mtime == mail_last_mtime || + if (statbuf.st_mtime == mail_last_mtime && statbuf.st_size == mail_last_size) return mail_last_count; mail_last_mtime = statbuf.st_mtime; mail_last_size = statbuf.st_size; f = fopen(fname, "r"); - if (f == NULL) return 0; + if (f == NULL) { + mail_last_count = 0; + return 0; + } count = 0; while (fgets(str, sizeof(str), f) != NULL) { -- cgit v1.2.3