mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Mail counter fixes.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@604 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
1e7d7490f6
commit
1e88ec7dcd
@ -593,17 +593,24 @@ static int get_mail_count(void)
|
|||||||
int count;
|
int count;
|
||||||
|
|
||||||
fname = g_getenv("MAIL");
|
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;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (statbuf.st_mtime == mail_last_mtime ||
|
if (statbuf.st_mtime == mail_last_mtime &&
|
||||||
statbuf.st_size == mail_last_size)
|
statbuf.st_size == mail_last_size)
|
||||||
return mail_last_count;
|
return mail_last_count;
|
||||||
mail_last_mtime = statbuf.st_mtime;
|
mail_last_mtime = statbuf.st_mtime;
|
||||||
mail_last_size = statbuf.st_size;
|
mail_last_size = statbuf.st_size;
|
||||||
|
|
||||||
f = fopen(fname, "r");
|
f = fopen(fname, "r");
|
||||||
if (f == NULL) return 0;
|
if (f == NULL) {
|
||||||
|
mail_last_count = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
while (fgets(str, sizeof(str), f) != NULL) {
|
while (fgets(str, sizeof(str), f) != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user