summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-28 09:48:35 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-07-28 09:48:35 +0800
commit63db1fa55aa27cb2db9105a311444c832239427a (patch)
tree9f8fc6845cbb07356a761de925ef1cacb1a637dd
parent2ccc79d4439d6b1ad6071f4ac4bf1199ba747adc (diff)
downloadpttbbs-63db1fa55aa27cb2db9105a311444c832239427a.tar
pttbbs-63db1fa55aa27cb2db9105a311444c832239427a.tar.gz
pttbbs-63db1fa55aa27cb2db9105a311444c832239427a.tar.bz2
pttbbs-63db1fa55aa27cb2db9105a311444c832239427a.tar.lz
pttbbs-63db1fa55aa27cb2db9105a311444c832239427a.tar.xz
pttbbs-63db1fa55aa27cb2db9105a311444c832239427a.tar.zst
pttbbs-63db1fa55aa27cb2db9105a311444c832239427a.zip
some users complained about restricting fast recommendation
will make them not able to recommend different articles. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2968 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/bbs.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 3c12308f..e8314879 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1847,6 +1847,8 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
int type, maxlength;
boardheader_t *bp;
static time4_t lastrecommend = 0;
+ static int lastrecommend_bid = -1;
+ static char lastrecommend_fname[FNLEN] = "";
bp = getbcache(currbid);
if (bp->brdattr & BRD_NORECOMMEND ||
@@ -1858,12 +1860,26 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
vmsg("您權限不足, 無法推薦!");
return FULLUPDATE;
}
- if ( (bp->brdattr & BRD_NOFASTRECMD) &&
- (now - lastrecommend < FASTRECMD_LIMIT))
+
+ if (bp->brdattr & BRD_NOFASTRECMD)
{
- vmsg("本板禁止快速連續推文,請再等 %d 秒",
- (FASTRECMD_LIMIT - now+lastrecommend));
- return FULLUPDATE;
+ 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 = "";
+ }
+
+ if (d > 0)
+ {
+ vmsg("本板禁止快速連續推文,%s請再等 %d 秒", s, d);
+ return FULLUPDATE;
+ }
}
#ifdef SAFE_ARTICLE_DELETE
if (fhdr->filename[0] == '.') {
@@ -1971,6 +1987,8 @@ recommend(int ent, fileheader_t * fhdr, const char *direct)
inc_goodpost(fhdr->owner, 1);
#endif
lastrecommend = now;
+ lastrecommend_bid = currbid;
+ strncpy(lastrecommend_fname, fhdr->filename, FNLEN);
return FULLUPDATE;
}