summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-27 10:48:17 +0800
committerptt <ptt@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-27 10:48:17 +0800
commit661092f8bac808fd4e4e8e7b19880dfeefaa57bd (patch)
tree4c80841a38f124540eaade53bc7743a933eeef52
parentf788131a8786a16da470d31f8e2f454d905dfc84 (diff)
downloadpttbbs-661092f8bac808fd4e4e8e7b19880dfeefaa57bd.tar
pttbbs-661092f8bac808fd4e4e8e7b19880dfeefaa57bd.tar.gz
pttbbs-661092f8bac808fd4e4e8e7b19880dfeefaa57bd.tar.bz2
pttbbs-661092f8bac808fd4e4e8e7b19880dfeefaa57bd.tar.lz
pttbbs-661092f8bac808fd4e4e8e7b19880dfeefaa57bd.tar.xz
pttbbs-661092f8bac808fd4e4e8e7b19880dfeefaa57bd.tar.zst
pttbbs-661092f8bac808fd4e4e8e7b19880dfeefaa57bd.zip
slight change for select_read
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1868 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/read.c47
1 files changed, 17 insertions, 30 deletions
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 4c55d9b0..df408485 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -332,44 +332,33 @@ select_read(keeploc_t * locmem, int sr_mode)
#define READSIZE 64 // 8192 / sizeof(fileheader_t)
fileheader_t fhs[READSIZE];
char newdirect[MAXPATHLEN];
- static int _mode=0;
- static char title[TTLEN + 1] = "";
- static char author[IDLEN + 1] = "";
+ char keyword[TTLEN + 1] = "";
char genbuf[MAXPATHLEN], *p;
int len, fd, fr, i, count=0, reference = 0;
fileheader_t *fh = &headers[locmem->crs_ln - locmem->top_ln];
- if(! sr_mode)
+ if(sr_mode & RS_AUTHOR)
{
- _mode=0;
- return READ_REDRAW;
- }
- else if(sr_mode & RS_AUTHOR)
- {
- if(!author[0]) strcpy(author, fh->owner);
- if(!getdata_buf(b_lines, 0,
+ if(!getdata_str(b_lines, 0,
currmode & MODE_SELECT ? "增加條件 作者:":"搜尋作者:",
- author, IDLEN+1, LCECHO))
+ keyword, IDLEN+1, LCECHO, fh->owner))
return READ_REDRAW;
}
else if(sr_mode & RS_KEYWORD)
{
- if(!title[0]) strcpy(author, subject(fh->title));
- if(!getdata_buf(b_lines, 0,
+ if(!getdata_str(b_lines, 0,
currmode & MODE_SELECT ? "增加條件 標題:":"搜尋標題:",
- title, TTLEN, DOECHO))
+ keyword, TTLEN, DOECHO, fh->title))
return READ_REDRAW;
}
else if(sr_mode & RS_TITLE)
- strcpy(title, subject(fh->title));
-
- _mode |= sr_mode;
+ strcpy(keyword, subject(fh->title));
p = strstr(currdirect, "SR");
- snprintf(genbuf, sizeof(genbuf), "%s.%X.%X.%X",
+ snprintf(genbuf, sizeof(genbuf), "%s.%X.%X",
p ? p : "SR",
- _mode, StringHash(title), StringHash(author));
+ sr_mode, StringHash(keyword));
if(strlen(genbuf)>MAXPATHLEN-50) return READ_REDRAW; // avoid overflow
if (currstat == RMAIL)
@@ -385,16 +374,16 @@ select_read(keeploc_t * locmem, int sr_mode)
len /= sizeof(fileheader_t);
for( i = 0 ; i < len ; ++i ){
reference++;
- if(_mode & RS_MARK &&
+ if(sr_mode & RS_MARK &&
!(fhs[i].filemode & FILE_MARKED)) continue;
- if(_mode & RS_NEWPOST &&
+ else if(sr_mode & RS_NEWPOST &&
!strncmp(fhs[i].title, "Re:", 3)) continue;
- if(_mode & RS_AUTHOR &&
- strcasecmp(fhs[i].owner, author)) continue;
- if(_mode & RS_KEYWORD &&
- !strcasestr(fhs[i].title, title)) continue;
- if(_mode & RS_TITLE &&
- strcmp(subject(fhs[i].title), title))
+ else if(sr_mode & RS_AUTHOR &&
+ strcasestr(fhs[i].owner, keyword)) continue;
+ else if(sr_mode & RS_KEYWORD &&
+ !strcasestr(fhs[i].title, keyword)) continue;
+ else if(sr_mode & RS_TITLE &&
+ strcmp(subject(fhs[i].title), keyword))
continue;
count ++;
fhs[i].money = reference | FHR_REFERENCE;
@@ -415,7 +404,6 @@ select_read(keeploc_t * locmem, int sr_mode)
return READ_REDRAW;
}
-#define select_read_mode(m) select_read(locmem, m) ? NEWDIRECT:READ_REDRAW
static int
i_read_key(onekey_t * rcmdlist, keeploc_t * locmem,
int bid, int bottom_line)
@@ -453,7 +441,6 @@ i_read_key(onekey_t * rcmdlist, keeploc_t * locmem,
if(currmode & MODE_SELECT){
char genbuf[256];
fileheader_t *fhdr = &headers[locmem->crs_ln - locmem->top_ln];
- select_read(locmem, 0);
board_select();
setbdir(genbuf, currboard);
locmem = getkeep(genbuf, 0, 1);