summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/bbs.c31
-rw-r--r--mbbsd/syspost.c14
2 files changed, 33 insertions, 12 deletions
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 9c51281f..e8d0c887 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -2673,24 +2673,31 @@ lock_post(int ent, fileheader_t * fhdr, const char *direct)
{
char fn1[MAXPATHLEN];
struct tm *ptime = localtime4(&now);
- if(!(currmode & MODE_BOARD) &&
- !HasUserPerm(PERM_SYSOP | PERM_POLICE)) return DONOTHING;
- if(fhdr->filename[0]=='M')
- {
- setbfile(fn1, currboard, fhdr->filename);
+ if (!(currmode & MODE_BOARD) && !HasUserPerm(PERM_SYSOP | PERM_POLICE))
+ return DONOTHING;
+
+ if (fhdr->filename[0]=='M') {
+ if (!HasUserPerm(PERM_SYSOP | PERM_POLICE))
+ return DONOTHING;
+
+ if (getans("要將文章鎖定嗎(y/N)?") != 'y')
+ return FULLUPDATE;
+ setbfile(fn1, currboard, r->filename);
fhdr->filename[0] = 'L';
- log_file(fn1, LOG_CREAT | LOG_VF, "\n※ Locked by: %s (%s) %d/%d",
- cuser.userid, fromhost, ptime->tm_mon + 1, ptime->tm_mday);
+ log_file(fn1, LOG_CREAT | LOG_VF, "\n※ Locked on: %d/%d",
+ ptime->tm_mon + 1, ptime->tm_mday);
}
- else if(fhdr->filename[0]=='L')
- {
+ else if (fhdr->filename[0]=='L') {
+ if (getans("要將文章鎖定解除嗎(y/N)?") != 'y')
+ return FULLUPDATE;
fhdr->filename[0] = 'M';
setbfile(fn1, currboard, fhdr->filename);
- log_file(fn1, LOG_CREAT | LOG_VF, "\n※ Unlocked by: %s (%s) %d/%d",
- cuser.userid, fromhost, ptime->tm_mon + 1, ptime->tm_mday);
+ log_file(fn1, LOG_CREAT | LOG_VF, "\n※ Unlocked by: %d/%d",
+ ptime->tm_mon + 1, ptime->tm_mday);
}
substitute_ref_record(direct, fhdr, ent);
+ post_policelog(currboard, fhdr->title, "鎖文", fhdr->filename[0] == 'L' ? 1 : 0);
return FULLUPDATE;
}
@@ -3442,7 +3449,6 @@ change_cooldown(void)
boardheader_t *bp = getbcache(currbid);
if (!(HasUserPerm(PERM_SYSOP | PERM_POLICE) ||
- (currmode & MODE_BOARD) ||
(HasUserPerm(PERM_SYSSUPERSUBOP) && GROUPOP())))
return DONOTHING;
@@ -3459,6 +3465,7 @@ change_cooldown(void)
}
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
substitute_record(fn_board, bp, sizeof(boardheader_t), currbid);
+ post_policelog(bp->brdname, NULL, "冷靜", bp->brdattr & BRD_COOLDOWN);
pressanykey();
return FULLUPDATE;
}
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c
index 447e00e3..36148543 100644
--- a/mbbsd/syspost.c
+++ b/mbbsd/syspost.c
@@ -128,3 +128,17 @@ post_newboard(const char *bgroup, const char *bname, const char *bms)
post_msg("Record", title, genbuf, "[系統]");
}
+
+void
+post_policelog(const char *bname, const char *atitle, const char *action, const int toggle)
+{
+ char genbuf[256], title[TTLEN+1];
+
+ snprintf(title, sizeof(title), "[%s] %s by %s", action, bname, cuser.userid);
+ snprintf(genbuf, sizeof(genbuf),
+ "%s (%s) %s %s 看板 %s 功能\n%s%s\n",
+ cuser.userid, fromhost, toggle ? "開啟" : "關閉", bname, action,
+ atitle ? "文章標題" : "", atitle ? atitle : "");
+
+ post_msg("PoliceLog", title, genbuf, "[系統]");
+}