summaryrefslogtreecommitdiffstats
path: root/mbbsd/bbs.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-28 14:53:20 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-28 14:53:20 +0800
commita5255bc794fbf9a6539f2d64bee220c7eae0b540 (patch)
treed40c56d63825ae2eadccf5fd60da00663063a694 /mbbsd/bbs.c
parentecae09775be2a407d4f82c43186e7b4cc42efd17 (diff)
downloadpttbbs-a5255bc794fbf9a6539f2d64bee220c7eae0b540.tar
pttbbs-a5255bc794fbf9a6539f2d64bee220c7eae0b540.tar.gz
pttbbs-a5255bc794fbf9a6539f2d64bee220c7eae0b540.tar.bz2
pttbbs-a5255bc794fbf9a6539f2d64bee220c7eae0b540.tar.lz
pttbbs-a5255bc794fbf9a6539f2d64bee220c7eae0b540.tar.xz
pttbbs-a5255bc794fbf9a6539f2d64bee220c7eae0b540.tar.zst
pttbbs-a5255bc794fbf9a6539f2d64bee220c7eae0b540.zip
let BM decide fast recommendation duration
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2970 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/bbs.c')
-rw-r--r--mbbsd/bbs.c65
1 files changed, 47 insertions, 18 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index e8314879..d5b27122 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1863,21 +1863,10 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
if (bp->brdattr & BRD_NOFASTRECMD)
{
- int d = FASTRECMD_LIMIT - (now - lastrecommend);
- const char *s = "推薦同篇文章";
-
- if( d > 0 &&
- !(strncmp(lastrecommend_fname, fhdr->filename, FNLEN) == 0 &&
- lastrecommend_bid == currbid))
- {
- /* not same article, apply 1/10 */
- d = FASTRECMD_LIMIT/10 - (now - lastrecommend);
- s = "";
- }
-
+ int d = (int)bp->fastrecommend_pause - (now - lastrecommend);
if (d > 0)
{
- vmsg("本板禁止快速連續推文,%s請再等 %d 秒", s, d);
+ vmsg("本板禁止快速連續推文,請再等 %d 秒", d);
return FULLUPDATE;
}
}
@@ -2604,11 +2593,26 @@ b_changerecommend(int ent, const fileheader_t * fhdr, const char *direct)
#else
optCmds[0] = "";
#endif
- prints( " " ANSI_COLOR(1;36) "f" ANSI_RESET
- " - %s " ANSI_RESET "快速連推文章\n",
- ((bp->brdattr & BRD_NORECOMMEND) ||
- (bp->brdattr & BRD_NOFASTRECMD)) ?
- ANSI_COLOR(1)"不可":"可以");
+ {
+ int d = 0;
+
+ if(bp->brdattr & BRD_NORECOMMEND)
+ {
+ d = -1;
+ } else {
+ if ((bp->brdattr & BRD_NOFASTRECMD) &&
+ (bp->fastrecommend_pause > 0))
+ d = bp->fastrecommend_pause;
+ }
+
+ prints( " " ANSI_COLOR(1;36) "f" ANSI_RESET
+ " - %s " ANSI_RESET "快速連推文章",
+ d != 0 ?
+ ANSI_COLOR(1)"不可": "可以");
+ if(d > 0)
+ prints(", 限制: %d 秒", d);
+ outs("\n");
+ }
#ifdef USE_AUTOCPLOG
prints( " " ANSI_COLOR(1;36) "x" ANSI_RESET
" - 轉錄文章時 %s " ANSI_RESET "自動記錄\n",
@@ -2649,8 +2653,33 @@ b_changerecommend(int ent, const fileheader_t * fhdr, const char *direct)
touched = 1;
break;
case 'f':
+ bp->brdattr &= ~BRD_NORECOMMEND;
bp->brdattr ^= BRD_NOFASTRECMD;
touched = 1;
+
+ if(bp->brdattr & BRD_NOFASTRECMD)
+ {
+ char buf[8] = "";
+
+ if(bp->fastrecommend_pause > 0)
+ sprintf(buf, "%d", bp->fastrecommend_pause);
+ getdata_str(b_lines-1, 0,
+ "請輸入連推時間限制(單位: 秒) [5~240]: ",
+ buf, 4, ECHO, buf);
+ if(buf[0] >= '0' && buf[0] <= '9')
+ bp->fastrecommend_pause = atoi(buf);
+
+ if( bp->fastrecommend_pause < 5 ||
+ bp->fastrecommend_pause > 240)
+ {
+ if(buf[0])
+ {
+ vmsg("輸入時間無效,請使用 5~240 之間的數字。");
+ }
+ bp->fastrecommend_pause = 0;
+ bp->brdattr &= ~BRD_NOFASTRECMD;
+ }
+ }
break;
#ifndef OLDRECOMMEND
case 'b':