diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-27 22:50:15 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-06-27 22:50:15 +0800 |
commit | 71ac041cfd6cba21c46b9d328df7346e1c8b0c0b (patch) | |
tree | 8f16458d994894cffb017e61eff7b3dc412e229e | |
parent | cb5a72489e64ac8e78d0e92584e2758b22b41166 (diff) | |
download | pttbbs-71ac041cfd6cba21c46b9d328df7346e1c8b0c0b.tar pttbbs-71ac041cfd6cba21c46b9d328df7346e1c8b0c0b.tar.gz pttbbs-71ac041cfd6cba21c46b9d328df7346e1c8b0c0b.tar.bz2 pttbbs-71ac041cfd6cba21c46b9d328df7346e1c8b0c0b.tar.lz pttbbs-71ac041cfd6cba21c46b9d328df7346e1c8b0c0b.tar.xz pttbbs-71ac041cfd6cba21c46b9d328df7346e1c8b0c0b.tar.zst pttbbs-71ac041cfd6cba21c46b9d328df7346e1c8b0c0b.zip |
* 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
-rw-r--r-- | pttbbs/mbbsd/bbs.c | 21 |
1 files 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'; |