summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/include/config.h4
-rw-r--r--pttbbs/mbbsd/bbs.c35
-rw-r--r--pttbbs/mbbsd/syspost.c4
3 files changed, 24 insertions, 19 deletions
diff --git a/pttbbs/include/config.h b/pttbbs/include/config.h
index 64112b3f..437c19d7 100644
--- a/pttbbs/include/config.h
+++ b/pttbbs/include/config.h
@@ -165,6 +165,10 @@
#define BN_JUNK "junk"
#endif
+#ifndef BN_POLICELOG
+#define BN_POLICELOG "PoliceLog"
+#endif
+
#ifndef BN_UNANONYMOUS
#define BN_UNANONYMOUS "UnAnonymous"
#endif
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index f2bfab2b..b67526ad 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -3605,7 +3605,16 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
if (vans("�n�N�峹��w��(y/N)?") != 'y')
return FULLUPDATE;
+
setbfile(fn1, currboard, fhdr->filename);
+ snprintf(genbuf, sizeof(genbuf), "%s �O�D��w�峹 - %s", currboard,
+ fhdr->title);
+
+ for (i = 0; i < MAX_BMs && SHM->BMcache[currbid-1][i] > 0; i++)
+ mail_id(SHM->userid[SHM->BMcache[currbid-1][i] - 1], genbuf, fn1,
+ "[�t�γq��]");
+
+ post_policelog2(currboard, fhdr->title, "���", genbuf, 1, fn1);
// Rename the file to be secure, introducing new X-dot file here.
// We can not use L-dot prefix since there may be some code that
@@ -3613,12 +3622,8 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
fhdr->filename[0] = 'X';
setbfile(fnx, currboard, fhdr->filename);
Rename(fn1, fnx);
-
fhdr->filename[0] = 'L';
- syncnow();
- bp->SRexpire = now;
- }
- else if (fhdr->filename[0]=='L') {
+ } else if (fhdr->filename[0]=='L') {
if (vans("�n�N�峹��w�Ѱ���(y/N)?") != 'y')
return FULLUPDATE;
fhdr->filename[0] = 'X';
@@ -3627,21 +3632,17 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
setbfile(fn1, currboard, fhdr->filename);
// Rename it back, no check for errors because old locked files
// are not renamed.
- Rename(fnx, fn1);
- syncnow();
- bp->SRexpire = now;
+ if (access(fnx, 0) == 0)
+ Rename(fnx, fn1);
+ post_policelog(currboard, fhdr->title, "���", genbuf, 0);
+ } else {
+ vmsg("�L�k�i����w�θѰ��C");
+ return FULLUPDATE;
}
// TODO fix race condition here.
substitute_ref_record(direct, fhdr, ent);
- post_policelog(currboard, fhdr->title, "���", genbuf, fhdr->filename[0] == 'L' ? 1 : 0);
- if (fhdr->filename[0] == 'L') {
- fhdr->filename[0] = 'M';
- do_crosspost("PoliceLog", fhdr, fn1);
- fhdr->filename[0] = 'L';
- snprintf(genbuf, sizeof(genbuf), "%s �O�D��w�峹 - %s", currboard, fhdr->title);
- for (i = 0; i < MAX_BMs && SHM->BMcache[currbid-1][i] != -1; i++)
- mail_id(SHM->userid[SHM->BMcache[currbid-1][i] - 1], genbuf, fn1, "[�t��]");
- }
+ syncnow();
+ bp->SRexpire = now;
return FULLUPDATE;
}
diff --git a/pttbbs/mbbsd/syspost.c b/pttbbs/mbbsd/syspost.c
index 824fb625..168bd0e4 100644
--- a/pttbbs/mbbsd/syspost.c
+++ b/pttbbs/mbbsd/syspost.c
@@ -123,7 +123,7 @@ post_violatelaw2(const char *crime, const char *police, const char *reason, cons
police, crime, reason, result, memo ? memo : "");
if (!strstr(police, "ĵ��")) {
- post_msg("PoliceLog", title, msg, "[" BBSMNAME "�k�|]");
+ post_msg(BN_POLICELOG, title, msg, "[" BBSMNAME "�k�|]");
snprintf(msg, sizeof(msg),
ANSI_COLOR(1;32) "%s" ANSI_RESET "�P�M�G\n"
@@ -164,7 +164,7 @@ post_policelog2(const char *bname, const char *atitle, const char *action,
cuser.userid, fromhost, toggle ? "�}��" : "����", bname, action,
reason, atitle ? "�峹���D : " : "", atitle ? atitle : "");
- if (post_msg2("PoliceLog", title, genbuf, "[�t��]", msg_file) == 0) {
+ if (post_msg2(BN_POLICELOG, title, genbuf, "[�t��]", msg_file) == 0) {
if (attach_file)
AppendTail(attach_file, msg_file, 0);
}