From 71ac041cfd6cba21c46b9d328df7346e1c8b0c0b Mon Sep 17 00:00:00 2001 From: piaip Date: Sat, 27 Jun 2009 14:50:15 +0000 Subject: * provide message when file was already removed (which implies no badpost can be assigned) git-svn-id: http://opensvn.csie.org/pttbbs/trunk@4703 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- pttbbs/mbbsd/bbs.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c index 17a4c3ab..019f16bf 100644 --- a/pttbbs/mbbsd/bbs.c +++ b/pttbbs/mbbsd/bbs.c @@ -3213,6 +3213,9 @@ del_post(int ent, fileheader_t * fhdr, char *direct) (bp->nuser > 30 && !(currmode & MODE_DIGEST) && !safe_article_delete(ent, fhdr, direct)) || #endif + // XXX TODO delete_record is really really dangerous - + // we should verify the header (maybe by filename) is the same. + // currently race condition is easily cause by 2 BMs !delete_record(direct, sizeof(fileheader_t), ent) ) { @@ -3221,8 +3224,22 @@ del_post(int ent, fileheader_t * fhdr, char *direct) #ifdef ASSESS #define SIZE sizeof(badpost_reason) / sizeof(char *) - // TODO not_owned 時也要改變 numpost? - if (del_ok && not_owned && tusernum > 0 && !(currmode & MODE_DIGEST)) { + // case one, owned or digest - should not give bad posts + if (!not_owned || tusernum <= 0 || (currmode & MODE_DIGEST) ) + { + // do nothing + } + // case 2, not owned but cannot delete (also skip badpost) + else if (!del_ok) + { + move(1, 40); clrtoeol(); + outs("由於此檔已被別人刪除,禁止再次給予劣文。"); + pressanykey(); + } + // case 3, not owned and deleted, can assign badpost + else + { + // TODO not_owned 時也要改變 numpost? if (now - atoi(fhdr->filename + 2) > 7 * 24 * 60 * 60) /* post older than a week */ genbuf[0] = 'n'; -- cgit v1.2.3