From 046577e6a108e9651367b1cbd8900af12db41ba5 Mon Sep 17 00:00:00 2001 From: piaip Date: Sat, 15 Dec 2007 03:39:20 +0000 Subject: - crosspost: better logic to anti crosspost spammers git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3681 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 123 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 90 insertions(+), 33 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 593efa07..28a0365b 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1589,7 +1589,7 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) char inputbuf[10], genbuf[200], genbuf2[4]; fileheader_t xfile; FILE *xptr; - int author; + int author, xbid, hashPost; boardheader_t *bp; move(2, 0); @@ -1597,9 +1597,31 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) move(1, 0); assert(0<=currbid-1 && currbid-1brdattr & BRD_VOTEBOARD) ) return FULLUPDATE; +#if 0 // def USE_AUTOCPLOG + // anti-crosspost spammers + // + // some spammers try to cross-post to other boards without + // restriction (see pakkei0712* events on 2007/12) + // for (1) increase numpost (2) flood target board + // (3) flood original post + // You must have post permission on current board + // + // Hoever, some announce boards does not allow post and user + // may want to cross-post. So let's make it "each login can + // only cross-post without post permission once". + // + if( (bp->brdattr & BRD_CPLOG) && + (!CheckPostPerm() || !CheckPostRestriction(currbid))) + { + vmsg("由本板轉錄文章需有發文權限(可按大寫 I 查看限制)"); + return FULLUPDATE; + } +#endif // USE_AUTOCPLOG + CompleteBoard("轉錄本文章於看板:", xboard); if (*xboard == '\0') return FULLUPDATE; @@ -1610,31 +1632,49 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) return FULLUPDATE; } - /* 借用變數 */ - ent = StringHash(fhdr->title); - author = getbnum(xboard); - assert(0<=author-1 && author-1 MAX_CROSSNUM) - anticrosspost(); - } else { - postrecord.times = 0; - postrecord.last_bid = author; - postrecord.checksum[0] = ent; - } + // XXX cross-posting a series of articles should not be cross-post? + // so let's use filename instead of title. + // hashPost = StringHash(fhdr->title); // why use title? + hashPost = StringHash(fhdr->filename); // let's try filename + xbid = getbnum(xboard); + assert(0<=xbid-1 && xbid-1= MAX_CROSSNUM) + { + anticrosspost(); + return FULLUPDATE; + } + } + #ifdef USE_COOLDOWN - if(check_cooldown(getbcache(author))) - return FULLUPDATE; + if(check_cooldown(getbcache(xbid))) + { + msg("該看板現在無法轉錄。"); + return FULLUPDATE; + } #endif ent = 1; @@ -1660,7 +1700,9 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) if (getdata_str(2, 0, "標題:", genbuf, TTLEN, DOECHO, xtitle)) strlcpy(xtitle, genbuf, sizeof(xtitle)); } + getdata(2, 0, "(S)存檔 (L)站內 (Q)取消?[Q] ", genbuf, 3, LCECHO); + if (genbuf[0] == 'l' || genbuf[0] == 's') { int currmode0 = currmode; const char *save_currboard; @@ -1713,14 +1755,6 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) bp = getbcache(bid); if ((bp->brdattr & BRD_HIDE) && (bp->brdattr & BRD_POSTMASK)) { - /* mosaic it */ - /* - // mosaic method 1 - char *pbname = bname; - while(*pbname) - *pbname++ = '?'; - */ - // mosaic method 2 strcpy(bname, "某隱形看板"); } else { sprintf(bname, "看板 %s", xboard); @@ -1752,14 +1786,14 @@ cross_post(int ent, fileheader_t * fhdr, const char *direct) } else #endif { - int bid = getbnum(xboard); - assert(0<=bid-1 && bid-1