diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-08-23 13:36:03 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-08-23 13:36:03 +0800 |
commit | 566c210f2b2f650e15569dc263b113710636eec9 (patch) | |
tree | 57c86c9a158d38b151748aa7e5a19c6d4ce5e710 /mbbsd/record.c | |
parent | 256c65c5b93d4213540676a42c81744b0ffeb7d8 (diff) | |
download | pttbbs-566c210f2b2f650e15569dc263b113710636eec9.tar pttbbs-566c210f2b2f650e15569dc263b113710636eec9.tar.gz pttbbs-566c210f2b2f650e15569dc263b113710636eec9.tar.bz2 pttbbs-566c210f2b2f650e15569dc263b113710636eec9.tar.lz pttbbs-566c210f2b2f650e15569dc263b113710636eec9.tar.xz pttbbs-566c210f2b2f650e15569dc263b113710636eec9.tar.zst pttbbs-566c210f2b2f650e15569dc263b113710636eec9.zip |
* use SAFE_ARTICLE_DELETE even if nuser < 30
* because we can make rich UI to allow leaving delete reasons in this mode
* also because it's stupid to determine by magic 30
* changed board name UnAnonymous to macro in config.h
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4762 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/record.c')
-rw-r--r-- | mbbsd/record.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/mbbsd/record.c b/mbbsd/record.c index 348c4d8d..bd0f9ab7 100644 --- a/mbbsd/record.c +++ b/mbbsd/record.c @@ -165,7 +165,7 @@ void safe_delete_range(const char *fpath, int id1, int id2) (fhdr.filemode & FILE_DIGEST) || /* ¤åºK */ (id1 && (i < id1 || i > id2)) || /* range */ (!id1 && Tagger(atoi(t + 2), i, TAG_NIN)))) /* TagList */ - safe_article_delete(i, &fhdr, fpath); + safe_article_delete(i, &fhdr, fpath, NULL); } close(fd); } @@ -245,9 +245,14 @@ delete_range(const char *fpath, int id1, int id2) #endif // _BBS_UTIL_C_ void -set_safedel_fhdr(fileheader_t *fhdr) +set_safedel_fhdr(fileheader_t *fhdr, const char *newtitle) { - if (fhdr->filemode & FILE_ANONYMOUS || + if (newtitle && *newtitle) + { + snprintf(fhdr->title, sizeof(fhdr->title), + "%s", newtitle); + } + else if (fhdr->filemode & FILE_ANONYMOUS || !fhdr->owner[0] || (fhdr->owner[0] == '-' && fhdr->owner[1] == 0) ) { @@ -275,11 +280,11 @@ set_safedel_fhdr(fileheader_t *fhdr) #ifdef SAFE_ARTICLE_DELETE int -safe_article_delete(int ent, const fileheader_t *fhdr, const char *direct) +safe_article_delete(int ent, const fileheader_t *fhdr, const char *direct, const char *newtitle) { fileheader_t newfhdr; memcpy(&newfhdr, fhdr, sizeof(fileheader_t)); - set_safedel_fhdr(&newfhdr); + set_safedel_fhdr(&newfhdr, newtitle); substitute_record(direct, &newfhdr, sizeof(newfhdr), ent); return 0; } @@ -309,7 +314,7 @@ safe_article_delete_range(const char *direct, int from, int to) strlcpy(ptr, newfhdr.filename, sizeof(newfhdr.filename)); unlink(fn); - set_safedel_fhdr(&newfhdr); + set_safedel_fhdr(&newfhdr, NULL); // because off_t is unsigned, we could NOT seek backward. lseek(fd, sizeof(fileheader_t) * (from - 1), SEEK_SET); write(fd, &newfhdr, sizeof(fileheader_t)); |