diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-07-26 00:10:18 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2005-07-26 00:10:18 +0800 |
commit | fe85c2da76306d6875a4bcae37c7afee3e9e6eac (patch) | |
tree | 4e93dbb3aa7b3122a895c37451b4aa53aa9ff5fc /mbbsd | |
parent | 31a7ad7d2f3b4dcdf73844dc62f33b168c1f23ec (diff) | |
download | pttbbs-fe85c2da76306d6875a4bcae37c7afee3e9e6eac.tar pttbbs-fe85c2da76306d6875a4bcae37c7afee3e9e6eac.tar.gz pttbbs-fe85c2da76306d6875a4bcae37c7afee3e9e6eac.tar.bz2 pttbbs-fe85c2da76306d6875a4bcae37c7afee3e9e6eac.tar.lz pttbbs-fe85c2da76306d6875a4bcae37c7afee3e9e6eac.tar.xz pttbbs-fe85c2da76306d6875a4bcae37c7afee3e9e6eac.tar.zst pttbbs-fe85c2da76306d6875a4bcae37c7afee3e9e6eac.zip |
- restrict fast recommendation
- release large memory buffer for CopyBuffer(announce.c)
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2961 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/announce.c | 16 | ||||
-rw-r--r-- | mbbsd/bbs.c | 20 | ||||
-rw-r--r-- | mbbsd/var.c | 2 |
3 files changed, 34 insertions, 4 deletions
diff --git a/mbbsd/announce.c b/mbbsd/announce.c index 6d52212f..f8332c02 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -2,12 +2,18 @@ #include "bbs.h" /* copy temp queue operation -------------------------------------- */ + +/* TODO + * change this to char* instead of char[] + */ typedef struct { char copyfile[PATHLEN]; char copytitle[TTLEN + 1]; char copyowner[IDLEN + 2]; } CopyQueue ; +#define COPYQUEUE_COMMON_SIZE (10) + static CopyQueue *copyqueue; static int allocated_copyqueue = 0, used_copyqueue = 0, head_copyqueue = 0; @@ -34,13 +40,21 @@ int copyqueue_append(CopyQueue *pcq) if(head_copyqueue == used_copyqueue) { // empty queue, happy happy reset + if(allocated_copyqueue > COPYQUEUE_COMMON_SIZE) + { + // let's reduce it + allocated_copyqueue = COPYQUEUE_COMMON_SIZE; + copyqueue = (CopyQueue*)realloc( copyqueue, + allocated_copyqueue * sizeof(CopyQueue)); + } head_copyqueue = used_copyqueue = 0; } used_copyqueue ++; if(used_copyqueue > allocated_copyqueue) { - allocated_copyqueue = used_copyqueue + 10; // half page + allocated_copyqueue = + used_copyqueue + COPYQUEUE_COMMON_SIZE; // half page copyqueue = (CopyQueue*) realloc (copyqueue, sizeof(CopyQueue) * allocated_copyqueue); if(!copyqueue) diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 52c71923..3c12308f 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -1858,6 +1858,13 @@ recommend(int ent, fileheader_t * fhdr, const char *direct) vmsg("您權限不足, 無法推薦!"); return FULLUPDATE; } + if ( (bp->brdattr & BRD_NOFASTRECMD) && + (now - lastrecommend < FASTRECMD_LIMIT)) + { + vmsg("本板禁止快速連續推文,請再等 %d 秒", + (FASTRECMD_LIMIT - now+lastrecommend)); + return FULLUPDATE; + } #ifdef SAFE_ARTICLE_DELETE if (fhdr->filename[0] == '.') { vmsg("本文已刪除"); @@ -2560,7 +2567,7 @@ b_changerecommend(int ent, const fileheader_t * fhdr, const char *direct) bp = getbcache(currbid); while(!finished) { - move(b_lines - 6, 0); clrtobot(); + move(b_lines - 7, 0); clrtobot(); outs(MSG_SEPERATOR); outs("\n目前看板設定:\n"); prints( " " ANSI_COLOR(1;36) "h" ANSI_RESET @@ -2579,6 +2586,11 @@ 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)"不可":"可以"); #ifdef USE_AUTOCPLOG prints( " " ANSI_COLOR(1;36) "x" ANSI_RESET " - 轉錄文章時 %s " ANSI_RESET "自動記錄\n", @@ -2594,7 +2606,7 @@ b_changerecommend(int ent, const fileheader_t * fhdr, const char *direct) return FULLUPDATE; } - switch(tolower(getans("請按 h/r%s%s 改變設定,其它鍵結束: ", + switch(tolower(getans("請按 h/r%s/f%s 改變設定,其它鍵結束: ", optCmds[0], optCmds[1]))) { #ifdef USE_AUTOCPLOG @@ -2618,6 +2630,10 @@ b_changerecommend(int ent, const fileheader_t * fhdr, const char *direct) bp->brdattr ^= BRD_NORECOMMEND; touched = 1; break; + case 'f': + bp->brdattr ^= BRD_NOFASTRECMD; + touched = 1; + break; #ifndef OLDRECOMMEND case 'b': if(bp->brdattr & BRD_NORECOMMEND) diff --git a/mbbsd/var.c b/mbbsd/var.c index fb6c707c..9c917204 100644 --- a/mbbsd/var.c +++ b/mbbsd/var.c @@ -72,7 +72,7 @@ const char * const str_permboard[] = { #else "轉錄記錄(本站無效)", /* BRD_CPLOG */ #endif - "沒想到", + "禁止快速推文", /* BRD_NOFASTRCMD */ "沒想到", "沒想到", "沒想到", |