summaryrefslogtreecommitdiff
path: root/src/fe-text
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-08-13 22:02:32 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-08-13 22:02:32 +0000
commit1e88ec7dcd2b89656bcb37013f3aead484192643 (patch)
tree24424a45ec70f86f47e96f3f1f116b4879b76aeb /src/fe-text
parent1e7d7490f6ce3ef3d5ee5949c8c6b217629f7d22 (diff)
downloadirssi-1e88ec7dcd2b89656bcb37013f3aead484192643.zip
Mail counter fixes.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@604 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text')
-rw-r--r--src/fe-text/statusbar-items.c13
1 files changed, 10 insertions, 3 deletions
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) {