From 4aa5a81572225029bfda73bef3c9cdf071ecc8ac Mon Sep 17 00:00:00 2001 From: piaip Date: Sat, 19 Sep 2009 05:44:39 +0000 Subject: * fix ordersong directory detection git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4858 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- common/bbs/cache.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'common/bbs/cache.c') diff --git a/common/bbs/cache.c b/common/bbs/cache.c index cd2b4a4a..7160cdbe 100644 --- a/common/bbs/cache.c +++ b/common/bbs/cache.c @@ -723,20 +723,25 @@ reload_pttcache(void) id = aggid = rawid = 0; // effective count, aggressive count, total (raw) count if ((fp = fopen(buf, "r"))) { + // .DIR loop while (fread(&item, sizeof(item), 1, fp)) { int chkagg = 0; // should we check aggressive? + int is_ordersong_dir = 0; if (item.title[3] != '<' || item.title[8] != '>') continue; +#define ORDERSONG_FOLDERNAME "<ÂIºq>" + if (strncmp(item.title+3, ORDERSONG_FOLDERNAME, strlen(ORDERSONG_FOLDERNAME)) == 0) + is_ordersong_dir = 1; + #ifdef BN_NOTE_AGGCHKDIR // TODO aggressive: only count '<ÂIºq>' section - if (strcmp(item.title+3, BN_NOTE_AGGCHKDIR) == 0) + if (strncmp(item.title+3, BN_NOTE_AGGCHKDIR, strlen(BN_NOTE_AGGCHKDIR)) == 0) chkagg = 1; #endif - snprintf(buf, sizeof(buf), "%s/%s/" FN_DIR, pbuf, item.filename); @@ -786,14 +791,15 @@ reload_pttcache(void) } // end of file loop fclose(fp1); + if (is_ordersong_dir) + SHM->last_usong = id - 1; + if (id >= MAX_ADBANNER) break; + } // end of .DIR loop fclose(fp); - if (strcmp(item.title+3, "ÂIºq") == 0) - SHM->last_usong = id - 1; - // decide next aggressive state if (rawid && aggid*3 >= rawid) // if aggressive exceed 1/3 set_aggressive_state(1); -- cgit v1.2.3