summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-08 13:07:02 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-08 13:07:02 +0800
commit40a656b7ab01bfa140380c7a46b7f88d3ec7b961 (patch)
treecffbc8d5e4f8891dd710014aea9e25ed633fa9e7 /mbbsd
parenta6c96a359610b40fc64738b812d93340439f7f6b (diff)
downloadpttbbs-40a656b7ab01bfa140380c7a46b7f88d3ec7b961.tar
pttbbs-40a656b7ab01bfa140380c7a46b7f88d3ec7b961.tar.gz
pttbbs-40a656b7ab01bfa140380c7a46b7f88d3ec7b961.tar.bz2
pttbbs-40a656b7ab01bfa140380c7a46b7f88d3ec7b961.tar.lz
pttbbs-40a656b7ab01bfa140380c7a46b7f88d3ec7b961.tar.xz
pttbbs-40a656b7ab01bfa140380c7a46b7f88d3ec7b961.tar.zst
pttbbs-40a656b7ab01bfa140380c7a46b7f88d3ec7b961.zip
push bottom
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1729 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbs.c7
-rw-r--r--mbbsd/cache.c28
-rw-r--r--mbbsd/read.c28
3 files changed, 46 insertions, 17 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 413e1520..d6a6152f 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -2325,7 +2325,10 @@ push_bottom(int ent, fileheader_t * fhdr, char *direct)
char buf[256];
if ((currmode & MODE_DIGEST) || !(currmode & MODE_BOARD))
return DONOTHING;
- setbfile(buf, currboard, ".BOTTOM");
+ if(strstr(direct, ".bottom"))
+ strcpy(buf, direct);
+ else
+ sprintf(buf, "%s.%s", direct, ".bottom");
num = get_num_records(buf, sizeof(fileheader_t));
if(getans(fhdr->filemode & FILE_BOTTOM ?
"¨ú®ø¸m©³¤½½§i?(y/N)":
@@ -2353,8 +2356,8 @@ push_bottom(int ent, fileheader_t * fhdr, char *direct)
}
}
setbottomtotal(currbid);
- substitute_record(direct, fhdr, sizeof(fileheader_t), ent);
touchdircache(currbid);
+ load_fileheader_bottom_cache(currbid, direct);
return DIRCHANGED;
}
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index 494f3f27..6124d361 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -518,7 +518,7 @@ touchdircache(int bid)
#if DIRCACHESIZE
void
-load_fileheader_cache(int bid, char *direct)
+load_fileheader_bottom_cache(int bid, char *direct)
{
int num = getbtotal(bid), n_bottom = getbottomtotal(bid);
int n = num - DIRCACHESIZE + n_bottom + 1;
@@ -528,15 +528,27 @@ load_fileheader_cache(int bid, char *direct)
n=1;
dirsize=num;
}
- if (SHM->Bbusystate != 1 && COMMON_TIME - SHM->busystate_b[bid - 1] >= 10) {
- SHM->busystate_b[bid - 1] = COMMON_TIME;
- if(n_bottom)
- {
+ if(n_bottom)
+ {
char path[256];
- setbfile(path, currboard, ".BOTTOM");
+ sprintf(path, "%s.%s", direct, ".bottom");
get_records(path, &SHM->dircache[bid - 1][dirsize],
sizeof(fileheader_t), 1, n_bottom);
- }
+ }
+}
+void
+load_fileheader_cache(int bid, char *direct)
+{
+ int num = getbtotal(bid), n_bottom = getbottomtotal(bid);
+ int n = num - DIRCACHESIZE + n_bottom + 1;
+ int dirsize = DIRCACHESIZE-n_bottom;
+ if (n<1)
+ {
+ n=1;
+ dirsize=num;
+ }
+ if (SHM->Bbusystate != 1 && COMMON_TIME - SHM->busystate_b[bid - 1] >= 10) {
+ SHM->busystate_b[bid - 1] = COMMON_TIME;
get_records(direct, SHM->dircache[bid - 1],
sizeof(fileheader_t), n, dirsize);
SHM->busystate_b[bid - 1] = 0;
@@ -551,7 +563,7 @@ get_fileheader_cache(int bid, char *direct, fileheader_t * headers,
{
int ret, n, num;
- num = getbtotal(bid);
+ num = getbtotal(bid)+getbottomtotal(bid);
ret = num - recbase + 1,
n = (num - DIRCACHESIZE + 1);
diff --git a/mbbsd/read.c b/mbbsd/read.c
index e294b091..ede71f6a 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -2,7 +2,7 @@
#include "bbs.h"
static fileheader_t *headers = NULL;
-static int last_line;
+static int last_line; // PTT: last_line ´å¼Ð¥i«üªº³Ì«á¤@­Ó
static int hit_thread;
#include <sys/mman.h>
@@ -584,7 +584,7 @@ select_read(keeploc_t * locmem, int sr_mode)
}
static int
-i_read_key(onekey_t * rcmdlist, keeploc_t * locmem, int ch, int bid)
+i_read_key(onekey_t * rcmdlist, keeploc_t * locmem, int ch, int bid, char* direct)
{
int mode = DONOTHING;
@@ -782,7 +782,7 @@ i_read_key(onekey_t * rcmdlist, keeploc_t * locmem, int ch, int bid)
if (ch > 0 && ch <= onekey_size) {
int (*func)() = rcmdlist[ch - 1];
if (func != NULL)
- mode = (*func)(locmem->crs_ln, &headers[locmem->crs_ln - locmem->top_ln], currdirect);
+ mode = (*func)(locmem->crs_ln, &headers[locmem->crs_ln - locmem->top_ln], direct);
break;
}
}
@@ -798,8 +798,9 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey
int i;
int jump = 0;
char genbuf[4];
- char currdirect0[64];
+ char currdirect0[64], directbottom[64];
int last_line0 = last_line;
+ int bottom_line = 0;
int hit_thread0 = hit_thread;
fileheader_t *headers0 = headers;
@@ -820,12 +821,15 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey
if( (last_line = getbtotal(currbid)) == 0 ){
setbtotal(currbid);
setbottomtotal(currbid);
+ load_fileheader_bottom_cache(currbid, currdirect);
last_line = get_num_records(currdirect, FHSZ);
}
+ sprintf(directbottom, "%s.bottom", direct);
+ bottom_line = last_line;
last_line += (n_bottom = getbottomtotal(currbid));
}
else
- last_line = get_num_records(currdirect, FHSZ);
+ bottom_line = last_line = get_num_records(currdirect, FHSZ);
if (mode == NEWDIRECT) {
if (last_line == 0) {
@@ -955,7 +959,12 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey
mode = cursor_pos(locmem, i + 1, 10);
} else {
if (!jump)
- mode = i_read_key(rcmdlist, locmem, ch, currbid);
+ {
+ if(locmem->crs_ln>bottom_line)
+ mode = i_read_key(rcmdlist, locmem, ch, currbid, directbottom);
+ else
+ mode = i_read_key(rcmdlist, locmem, ch, currbid, currdirect);
+ }
while (mode == READ_NEXT || mode == READ_PREV ||
mode == RELATE_FIRST || mode == RELATE_NEXT ||
mode == RELATE_PREV || mode == THREAD_NEXT ||
@@ -992,7 +1001,12 @@ i_read(int cmdmode, char *direct, void (*dotitle) (), void (*doentry) (), onekey
}
num = locmem->crs_ln - locmem->top_ln;
if (headers[num].owner[0] != '-')
- mode = i_read_key(rcmdlist, locmem, ch, bidcache);
+ {
+ if(locmem->crs_ln>bottom_line)
+ mode = i_read_key(rcmdlist, locmem, ch, currbid, directbottom);
+ else
+ mode = i_read_key(rcmdlist, locmem, ch, bidcache, currdirect);
+ }
}
}
} while (mode != DOQUIT);