summaryrefslogtreecommitdiffstats
path: root/mbbsd/record.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-09 23:35:48 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-04-09 23:35:48 +0800
commitf680ef20c2d16966a408c56608b28c1e014c2105 (patch)
treec2fcf02c6d4cb8147e9ea8f5ed219348b9264970 /mbbsd/record.c
parent2320c0c0743af362779009ae09dee8053df9738b (diff)
downloadpttbbs-f680ef20c2d16966a408c56608b28c1e014c2105.tar
pttbbs-f680ef20c2d16966a408c56608b28c1e014c2105.tar.gz
pttbbs-f680ef20c2d16966a408c56608b28c1e014c2105.tar.bz2
pttbbs-f680ef20c2d16966a408c56608b28c1e014c2105.tar.lz
pttbbs-f680ef20c2d16966a408c56608b28c1e014c2105.tar.xz
pttbbs-f680ef20c2d16966a408c56608b28c1e014c2105.tar.zst
pttbbs-f680ef20c2d16966a408c56608b28c1e014c2105.zip
- restrict VIOLATE_LAW cross-posting
- add owner/delete in SAFEDEL title as log git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4118 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/record.c')
-rw-r--r--mbbsd/record.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/mbbsd/record.c b/mbbsd/record.c
index 6b8a8af9..48c61fe2 100644
--- a/mbbsd/record.c
+++ b/mbbsd/record.c
@@ -383,6 +383,24 @@ delete_range(const char *fpath, int id1, int id2)
}
#endif
+void
+set_safedel_fhdr(fileheader_t *fhdr)
+{
+ if ( strcmp(fhdr->owner, cuser.userid) == 0 ||
+ !fhdr->owner[0] ||
+ (fhdr->owner[0] == '-' && fhdr->owner[1] == 0) )
+ {
+ // i'm the one to delete it, or if the owner is corpse.
+ snprintf(fhdr->title, sizeof(fhdr->title),
+ "%s [%s]", STR_SAFEDEL_TITLE, cuser.userid);
+ } else {
+ snprintf(fhdr->title, sizeof(fhdr->title),
+ "%s [%s/%s]", STR_SAFEDEL_TITLE, fhdr->owner, cuser.userid);
+ }
+ // snprintf(fhdr->title, sizeof(fhdr->title), "%s", STR_SAFEDEL_TITLE);
+ strcpy(fhdr->filename, FN_SAFEDEL);
+ strcpy(fhdr->owner, "-");
+}
#ifdef SAFE_ARTICLE_DELETE
int
@@ -390,9 +408,7 @@ safe_article_delete(int ent, const fileheader_t *fhdr, const char *direct)
{
fileheader_t newfhdr;
memcpy(&newfhdr, fhdr, sizeof(fileheader_t));
- sprintf(newfhdr.title, "(本文已被刪除)");
- strcpy(newfhdr.filename, ".deleted");
- strcpy(newfhdr.owner, "-");
+ set_safedel_fhdr(&newfhdr);
substitute_record(direct, &newfhdr, sizeof(newfhdr), ent);
return 0;
}
@@ -420,9 +436,7 @@ safe_article_delete_range(const char *direct, int from, int to)
strlcpy(ptr, newfhdr.filename, sizeof(newfhdr.filename));
unlink(fn);
- sprintf(newfhdr.title, "(本文已被刪除)");
- strcpy(newfhdr.filename, ".deleted");
- strcpy(newfhdr.owner, "-");
+ set_safedel_fhdr(&newfhdr);
// 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));