summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/include/proto.h4
-rw-r--r--pttbbs/mbbsd/bbs.c8
-rw-r--r--pttbbs/mbbsd/record.c19
3 files changed, 24 insertions, 7 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index 9afcbe71..a4ea2aa5 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -496,6 +496,10 @@ int rotate_bin_logfile(const char *filename, off_t record_size,
int delete_file_content(const char *direct, const fileheader_t *fh,
const char *backup_direct,
char *newpath, size_t sznewpath);
+int delete_file_content2(const char *direct, const fileheader_t *fh,
+ const char *backup_direct,
+ char *newpath, size_t sznewpath,
+ const char *reason);
#define DELETE_FILE_CONTENT_SUCCESS (0)
#define DELETE_FILE_CONTENT_FAILED (-1)
#define DELETE_FILE_CONTENT_BACKUP_FAILED (1)
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index b96752ab..b764ff94 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -829,7 +829,8 @@ innd_cancel_post(const fileheader_t *fh, const char *fpath, const char *userid)
static int
cancelpost(const char *direct, const fileheader_t *fh,
- int not_owned, char *newpath, size_t sznewpath) {
+ int not_owned, char *newpath, size_t sznewpath,
+ const char *reason) {
int ret = 0;
char bakdir[PATHLEN];
@@ -840,7 +841,7 @@ cancelpost(const char *direct, const fileheader_t *fh,
setbdir(bakdir, brd);
#endif
- ret = delete_file_content(direct, fh, bakdir, newpath, sznewpath);
+ ret = delete_file_content2(direct, fh, bakdir, newpath, sznewpath, reason);
if (!IS_DELETE_FILE_CONTENT_OK(ret))
return ret;
@@ -3461,7 +3462,8 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
// was closed.
setbtotal(currbid);
- del_ret = cancelpost(direct, fhdr, not_owned, newpath, sizeof(newpath));
+ del_ret = cancelpost(direct, fhdr, not_owned,
+ newpath, sizeof(newpath), reason);
deleteCrossPost(fhdr, bp->brdname);
move(b_lines - 10, 0); clrtobot();
diff --git a/pttbbs/mbbsd/record.c b/pttbbs/mbbsd/record.c
index 014b6bab..007f9a93 100644
--- a/pttbbs/mbbsd/record.c
+++ b/pttbbs/mbbsd/record.c
@@ -338,9 +338,10 @@ safe_article_delete_range(const char *direct, int from, int to)
// Return -1 if cannot delete file, 0 for success,
// 1 if delete success but backup failed.
int
-delete_file_content(const char *direct, const fileheader_t *fh,
- const char *backup_direct,
- char *backup_path, size_t sz_backup_path) {
+delete_file_content2(const char *direct, const fileheader_t *fh,
+ const char *backup_direct,
+ char *backup_path, size_t sz_backup_path,
+ const char *reason) {
char fpath[PATHLEN];
fileheader_t backup = { {0} };
int backup_failed = DELETE_FILE_CONTENT_SUCCESS;
@@ -377,8 +378,10 @@ delete_file_content(const char *direct, const fileheader_t *fh,
// FIXME maybe for non-board files we should do this by simply touching
// file instead of full log.
+ if (reason && *reason)
+ log_filef(fpath, LOG_CREAT, "\n¡° §R°£­ì¦]: %s", reason);
log_filef(fpath, LOG_CREAT, "\n¡° Deleted by: %s (%s) %s\n",
- cuser.userid, fromhost, Cdatelite(&now));
+ cuser.userid, fromhost, Cdatelite(&now));
// TODO or only memcpy(&backup, fh, sizeof(backup)); ?
strlcpy(backup.owner, fh->owner, sizeof(backup.owner));
@@ -434,6 +437,14 @@ delete_file_content(const char *direct, const fileheader_t *fh,
return backup_failed;
}
+int
+delete_file_content(const char *direct, const fileheader_t *fh,
+ const char *backup_direct,
+ char *backup_path, size_t sz_backup_path) {
+ return delete_file_content2(direct, fh, backup_direct,
+ backup_path, sz_backup_path, NULL);
+}
+
// XXX announce(man) directory uses a smaller range of file names.
// TODO merge with common/bbs/fhdr_stamp.c
int