summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-08-06 15:19:10 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-08-06 15:19:10 +0800
commit1f6dede4cd2f7f35a2a768ec4c1f75aba51b71dd (patch)
tree98ceb21b715bce54541771c954e0bda179e8fd9a /mbbsd
parent84eb7263b74d4a83a3ab4636557e1584675841bb (diff)
downloadpttbbs-1f6dede4cd2f7f35a2a768ec4c1f75aba51b71dd.tar
pttbbs-1f6dede4cd2f7f35a2a768ec4c1f75aba51b71dd.tar.gz
pttbbs-1f6dede4cd2f7f35a2a768ec4c1f75aba51b71dd.tar.bz2
pttbbs-1f6dede4cd2f7f35a2a768ec4c1f75aba51b71dd.tar.lz
pttbbs-1f6dede4cd2f7f35a2a768ec4c1f75aba51b71dd.tar.xz
pttbbs-1f6dede4cd2f7f35a2a768ec4c1f75aba51b71dd.tar.zst
pttbbs-1f6dede4cd2f7f35a2a768ec4c1f75aba51b71dd.zip
article money system upgrade again
now fully works(hope so). git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2999 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbs.c11
-rw-r--r--mbbsd/read.c30
-rw-r--r--mbbsd/var.c1
3 files changed, 20 insertions, 22 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index d11d0856..89524b16 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -40,7 +40,7 @@ query_file_money(const fileheader_t *pfh)
pfh = &hdr;
}
- if(pfh->filemode & INVALIDMONEY_MODES)
+ if(pfh->filemode & INVALIDMONEY_MODES || pfh->multi.money > MAX_POST_MONEY)
return -1;
return pfh->multi.money;
@@ -57,6 +57,10 @@ static char *listmode_desc[] = {
};
static int currlistmode = LISTMODE_DATE;
+#define IS_LISTING_MONEY \
+ (currlistmode == LISTMODE_MONEY || \
+ ((currmode & MODE_SELECT) && (currsrmode & RS_MONEY)))
+
void
anticrosspost(void)
{
@@ -271,7 +275,7 @@ readtitle(void)
showtitle(currBM, brd_title);
outs("[←]離開 [→]閱\讀 [^P]發表文章 [b]備忘錄 [d]刪除 [z]精華區 [TAB]文摘 [h]說明\n");
prints(ANSI_COLOR(7) " 編號 %s 作 者 文 章 標 題",
- listmode_desc[currlistmode]);
+ IS_LISTING_MONEY ? listmode_desc[LISTMODE_MONEY] : listmode_desc[currlistmode]);
#ifdef USE_COOLDOWN
if ( bp->brdattr & BRD_COOLDOWN &&
@@ -373,7 +377,7 @@ readdoent(int num, fileheader_t * ent)
prints(" %c\033[1;3%4.4s" ANSI_RESET, type, recom);
- if(currlistmode == LISTMODE_MONEY)
+ if(IS_LISTING_MONEY)
{
int m = query_file_money(ent);
if(m < 0)
@@ -2562,6 +2566,7 @@ board_select(void)
char genbuf[100];
currmode &= ~MODE_SELECT;
+ currsrmode = 0;
snprintf(fpath, sizeof(fpath), "SR.%s", cuser.userid);
setbfile(genbuf, currboard, fpath);
unlink(genbuf);
diff --git a/mbbsd/read.c b/mbbsd/read.c
index 3f3046ad..70579d49 100644
--- a/mbbsd/read.c
+++ b/mbbsd/read.c
@@ -418,7 +418,7 @@ select_read(const keeploc_t * locmem, int sr_mode)
fileheader_t fhs[READSIZE];
char newdirect[MAXPATHLEN];
char keyword[TTLEN + 1] = "";
- char genbuf[MAXPATHLEN], *p = strstr(currdirect, "SR.");
+ char genbuf[MAXPATHLEN], *p = strstr(currdirect, "SR.");
static int _mode = 0;
int len, fd, fr, i, count=0, reference = 0, n_recommend = 0,
n_money=0;
@@ -461,21 +461,9 @@ select_read(const keeploc_t * locmem, int sr_mode)
}
else if (sr_mode & RS_MONEY)
{
- /* 增加條件應該不會動?
- Ptt: still happens.
- piaip: this does NOT work. multi is occupied by ref unless
- we do recursive ref search.
- */
-#if 0
- if (currmode & MODE_SELECT)
- {
- vmsg("請先離開目前的選擇/搜尋模式再搜尋文章價格");
- return READ_REDRAW;
- }
-#endif
if(currstat == RMAIL || (
!getdata(b_lines, 0,
- (currmode & MODE_SELECT) ? // 先留著吧,雖然應該不用
+ (currmode & MODE_SELECT) ?
"增加條件 文章價格: ":"搜尋價格高於多少的文章: ",
keyword, 7, LCECHO) || (n_money = atoi(keyword)) <= 0 ))
return READ_REDRAW;
@@ -534,6 +522,9 @@ select_read(const keeploc_t * locmem, int sr_mode)
}
}
+#ifdef DEBUG
+ vmsgf("search: %s", currdirect);
+#endif
while( (len = read(fr, fhs, sizeof(fhs))) > 0 ){
len /= sizeof(fileheader_t);
for( i = 0 ; i < len ; ++i ){
@@ -559,17 +550,17 @@ select_read(const keeploc_t * locmem, int sr_mode)
else if ((sr_mode & RS_RECOMMEND) &&
fhs[i].recommend < n_recommend )
continue;
- else if ((sr_mode & RS_MONEY) &&
- // see view_postmoney
- ((fhs[i].filemode & (FILE_BOTTOM|FILE_ANONYMOUS)) ||
- (fhs[i].multi.money < n_money)))
+ /* please put money test in last */
+ else if ((sr_mode & RS_MONEY) &&
+ query_file_money(fhs+i) < n_money)
continue;
- ++count;
+
if(p == NULL)
{
fhs[i].multi.refer.flag = 1;
fhs[i].multi.refer.ref = reference;
}
+ ++count;
write(fd, &fhs[i], sizeof(fileheader_t));
}
} // end while
@@ -582,6 +573,7 @@ select_read(const keeploc_t * locmem, int sr_mode)
if(count) {
strlcpy(currdirect, newdirect, sizeof(currdirect));
currmode |= MODE_SELECT;
+ currsrmode |= sr_mode;
return NEWDIRECT;
}
return READ_REDRAW;
diff --git a/mbbsd/var.c b/mbbsd/var.c
index 2cf0ff0f..11a77017 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -86,6 +86,7 @@ const char * const str_permboard[] = {
int usernum;
int currmode = 0;
+int currsrmode = 0;
int curredit = 0;
int paste_level;
int currbid;