diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-19 13:44:39 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-19 13:44:39 +0800 |
commit | 4aa5a81572225029bfda73bef3c9cdf071ecc8ac (patch) | |
tree | 75886f9594066dcd80fab89035b9ecd403478a56 /common/bbs | |
parent | ddbda5df68e67de56740ee1294d6c0566a931830 (diff) | |
download | pttbbs-4aa5a81572225029bfda73bef3c9cdf071ecc8ac.tar pttbbs-4aa5a81572225029bfda73bef3c9cdf071ecc8ac.tar.gz pttbbs-4aa5a81572225029bfda73bef3c9cdf071ecc8ac.tar.bz2 pttbbs-4aa5a81572225029bfda73bef3c9cdf071ecc8ac.tar.lz pttbbs-4aa5a81572225029bfda73bef3c9cdf071ecc8ac.tar.xz pttbbs-4aa5a81572225029bfda73bef3c9cdf071ecc8ac.tar.zst pttbbs-4aa5a81572225029bfda73bef3c9cdf071ecc8ac.zip |
* fix ordersong directory detection
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4858 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'common/bbs')
-rw-r--r-- | common/bbs/cache.c | 16 |
1 files changed, 11 insertions, 5 deletions
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); |