summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-16 00:04:18 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-11-16 00:04:18 +0800
commit606adda410e73e1e3bc69b97f7544298f886ccd2 (patch)
treebeb869017bef5668e72f5dc83b61cde5923b715d
parent7bd78c72ef419e02b455494d7f6fcc5c1dac78a7 (diff)
downloadpttbbs-606adda410e73e1e3bc69b97f7544298f886ccd2.tar
pttbbs-606adda410e73e1e3bc69b97f7544298f886ccd2.tar.gz
pttbbs-606adda410e73e1e3bc69b97f7544298f886ccd2.tar.bz2
pttbbs-606adda410e73e1e3bc69b97f7544298f886ccd2.tar.lz
pttbbs-606adda410e73e1e3bc69b97f7544298f886ccd2.tar.xz
pttbbs-606adda410e73e1e3bc69b97f7544298f886ccd2.tar.zst
pttbbs-606adda410e73e1e3bc69b97f7544298f886ccd2.zip
fix redraw problem when calling thread()
thanks ledia.bbs@ptt2 git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2325 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/read.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 5350277d..6f889855 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -262,24 +262,29 @@ cursor_pos(keeploc_t * locmem, int val, int from_top, int isshow)
return isshow ? PARTUPDATE : HEADERS_RELOAD;
}
+/* 根據 stypen 選擇上/下一篇文章 */
static int
thread(keeploc_t * locmem, int stypen)
{
fileheader_t fh;
int pos = locmem->crs_ln, jump = 200, new_ln;
- int fd = -1, step = stypen & RS_FORWARD ? 1 : -1, amatch = -1;
- char *key =
- (stypen & RS_AUTHOR ? headers[pos - locmem->top_ln].owner :
- (subject( stypen & RS_CURRENT ?
- currtitle :
- headers[pos - locmem->top_ln].title )));
+ int fd = -1, amatch = -1;
+ int step = (stypen == RS_FORWARD) ? 1 : -1;
+ char *key;
+
+ if (stypen == RS_AUTHOR)
+ key = headers[pos - locmem->top_ln].owner;
+ else if (stypen == RS_CURRENT)
+ subject(currtitle);
+ else
+ subject(headers[pos - locmem->top_ln].title );
for( new_ln = pos + step ;
new_ln > 0 && new_ln <= last_line && --jump > 0;
new_ln += step ) {
get_record_keep(currdirect, &fh, sizeof(fileheader_t), new_ln, &fd);
- if( stypen & RS_TITLE ){
- if( stypen & RS_FIRST ){
+ if( stypen == RS_TITLE ){
+ if( stypen == RS_FIRST ){
if( !strncmp(fh.title, key, PROPER_TITLE_LEN) )
break;
else if( !strncmp(&fh.title[4], key, PROPER_TITLE_LEN) )
@@ -288,7 +293,7 @@ thread(keeploc_t * locmem, int stypen)
else if( !strncmp(subject(fh.title), key, PROPER_TITLE_LEN) )
break;
}
- else if( stypen & RS_NEWPOST ){
+ else if( stypen == RS_NEWPOST ){
if( strncmp(fh.title, "Re:", 3) )
break;
}
@@ -301,10 +306,6 @@ thread(keeploc_t * locmem, int stypen)
close(fd);
if( jump <= 0 || new_ln <= 0 || new_ln > last_line )
new_ln = (amatch == -1 ? pos : amatch); //didn't find
- else{
- strncpy(currtitle, fh.title, TTLEN);
- strncpy(currtitle, fh.title, TTLEN);
- }
return new_ln;
}