summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-19 21:00:51 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2005-03-19 21:00:51 +0800
commita8daf9e241b3aae6f7439622034cfad504b4a86f (patch)
tree12053f34625363bf75eafb77a2448b63aa3ec5ca
parent0d6b1346ac41841aaf4bf8fb5a7e8660404c4b24 (diff)
downloadpttbbs-a8daf9e241b3aae6f7439622034cfad504b4a86f.tar
pttbbs-a8daf9e241b3aae6f7439622034cfad504b4a86f.tar.gz
pttbbs-a8daf9e241b3aae6f7439622034cfad504b4a86f.tar.bz2
pttbbs-a8daf9e241b3aae6f7439622034cfad504b4a86f.tar.lz
pttbbs-a8daf9e241b3aae6f7439622034cfad504b4a86f.tar.xz
pttbbs-a8daf9e241b3aae6f7439622034cfad504b4a86f.tar.zst
pttbbs-a8daf9e241b3aae6f7439622034cfad504b4a86f.zip
refactor post article
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@2637 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/syspost.c83
-rw-r--r--mbbsd/user.c35
2 files changed, 36 insertions, 82 deletions
diff --git a/mbbsd/syspost.c b/mbbsd/syspost.c
index 9e02fc63..741fc122 100644
--- a/mbbsd/syspost.c
+++ b/mbbsd/syspost.c
@@ -101,81 +101,46 @@ post_change_perm(int oldperm, int newperm, const char *sysopid, const char *user
void
post_violatelaw(const char *crime, const char *police, const char *reason, const char *result)
{
- char genbuf[200];
- fileheader_t fhdr;
- FILE *fp;
-/*
- strlcpy(genbuf, "boards/S/Security", sizeof(genbuf));
- stampfile(genbuf, &fhdr);
- if (!(fp = fopen(genbuf, "w")))
- return;
- fprintf(fp, "作者: [Ptt法院] 看板: Security\n"
- "標題: [報告] %-20s 違法判決報告\n"
- "時間: %s\n"
- "\033[1;32m%s\033[m判決:\n \033[1;32m%s\033[m"
- "因\033[1;35m%s\033[m行為,\n違反本站站規,處以\033[1;35m%s\033[m,特此公告",
- crime, ctime4(&now), police, crime, reason, result);
- fclose(fp);
- snprintf(fhdr.title, sizeof(fhdr.title),
- "[報告] %-20s 違法判決報告", crime);
- strlcpy(fhdr.owner, "[Ptt法院]", sizeof(fhdr.owner));
- append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr));
-
-*/
- setbpath(genbuf, "ViolateLaw");
- stampfile(genbuf, &fhdr);
- if (!(fp = fopen(genbuf, "w")))
- return;
- fprintf(fp, "作者: [Ptt法院] 看板: ViolateLaw\n"
- "標題: [報告] %-20s 違法判決報告\n"
- "時間: %s\n"
- "\033[1;32m%s\033[m判決:\n \033[1;32m%s\033[m"
- "因\033[1;35m%s\033[m行為,\n違反本站站規,處以\033[1;35m%s\033[m,特此公告",
- crime, ctime4(&now), police, crime, reason, result);
- fclose(fp);
- snprintf(fhdr.title, sizeof(fhdr.title),
- "[報告] %s:%-*s 判決", crime,
- (int)(37 - strlen(reason) - strlen(crime)), reason);
- strlcpy(fhdr.owner, "[Ptt法院]", sizeof(fhdr.owner));
-
- append_record("boards/V/ViolateLaw/.DIR", &fhdr, sizeof(fhdr));
- touchbtotal(getbnum("ViolateLaw"));
-
+ char title[TTLEN+1];
+ char msg[200];
+
+ snprintf(title, sizeof(title),
+ "[報告] %s:%-*s 判決", crime,
+ (int)(37 - strlen(reason) - strlen(crime)), reason);
+ snprintf(msg, sizeof(msg),
+ "\033[1;32m%s\033[m判決:\n"
+ " \033[1;32m%s\033[m因\033[1;35m%s\033[m行為,\n"
+ "違反本站站規,處以\033[1;35m%s\033[m,特此公告\n",
+ police, crime, reason, result);
+
+ post_msg("ViolateLaw",title,msg,"[Ptt法院]");
}
void
post_newboard(const char *bgroup, const char *bname, const char *bms)
{
- char genbuf[256], title[128];
+ char genbuf[256], title[TTLEN+1];
+
snprintf(title, sizeof(title), "[新板成立] %s", bname);
snprintf(genbuf, sizeof(genbuf),
"%s 開了一個新板 %s : %s\n\n新任板主為 %s\n\n恭喜*^_^*\n",
cuser.userid, bname, bgroup, bms);
+
post_msg("Record", title, genbuf, "[系統]");
}
void
give_money_post(const char *userid, int money)
{
- FILE *fp;
- fileheader_t fhdr;
- char genbuf[200];
+ char title[TTLEN+1];
+ char msg[128];
- setbpath(genbuf, "Security");
- stampfile(genbuf, &fhdr);
- if (!(fp = fopen(genbuf, "w")))
- return;
- fprintf(fp, "作者: [系統安全局] 看板: Security\n"
- "標題: [公安報告] 站長%s使用紅包機報告\n"
- "時間: %s\n", cuser.userid, ctime4(&now));
- clrtobot();
- clear();
- fprintf(fp, "\n 站長\033[1;32m%s\033[m給\033[1;33m%s %d 元\033[m",
+ snprintf(title, sizeof(title), "[公安報告] 站長%s使用紅包機報告", cuser.userid);
+ snprintf(msg, sizeof(msg), "\n 站長\033[1;32m%s\033[m給\033[1;33m%s %d 元\033[m",
cuser.userid, userid, money);
- fclose(fp);
- snprintf(fhdr.title, sizeof(fhdr.title), "[公安報告] 站長%s使用紅包機報告",
- cuser.userid);
- strlcpy(fhdr.owner, "[系統安全局]", sizeof(fhdr.owner));
- append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr));
+ post_msg("Security", title, msg, "[系統安全局]");
+
+ clrtobot();
+ clear();
}
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 52d2dd5e..e12fa9be 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -187,7 +187,7 @@ mail_violatelaw(const char *crime, const char *police, const char *reason, const
"時間: %s\n"
"\033[1;32m%s\033[m判決:\n \033[1;32m%s\033[m"
"因\033[1;35m%s\033[m行為,\n違反本站站規,處以\033[1;35m%s\033[m,特此通知"
- "\n請到 PttLaw 查詢相關法規資訊,並到 Play-Pay-ViolateLaw 繳交罰單",
+ "\n請到 PttLaw 查詢相關法規資訊,並到 Play-Pay-ViolateLaw 繳交罰單",
ctime4(&now), police, crime, reason, result);
fclose(fp);
strcpy(fhdr.title, "[報告] 違法判決報告");
@@ -347,11 +347,8 @@ uinfo_query(userec_t * u, int real, int unum)
char buf[STRLEN], *p;
char genbuf[200], reason[50];
int money = 0;
- fileheader_t fhdr;
int flag = 0, temp = 0, money_change = 0;
- FILE *fp;
-
fail = mail_changed = 0;
memcpy(&x, u, sizeof(userec_t));
@@ -735,31 +732,23 @@ uinfo_query(userec_t * u, int real, int unum)
setumoney(unum, x.money);
passwd_update(unum, &x);
if (money_change) {
- setbpath(genbuf, "Security");
- stampfile(genbuf, &fhdr);
- if (!(fp = fopen(genbuf, "w")))
- return;
-
- fprintf(fp, "作者: [系統安全局] 看板: Security\n"
- "標題: [公安報告] 站長修改金錢報告\n"
- "時間: %s\n"
- " 站長\033[1;32m%s\033[m把\033[1;32m%s\033[m"
- "的錢從\033[1;35m%d\033[m改成\033[1;35m%d\033[m",
- ctime4(&now), cuser.userid, x.userid, money, x.money);
-
+ char title[TTLEN+1];
+ char msg[200];
clrtobot();
clear();
while (!getdata(5, 0, "請輸入理由以示負責:",
reason, sizeof(reason), DOECHO));
- fprintf(fp, "\n \033[1;37m站長%s修改錢理由是:%s\033[m",
+ snprintf(msg, sizeof(msg),
+ " 站長\033[1;32m%s\033[m把\033[1;32m%s\033[m的錢"
+ "從\033[1;35m%d\033[m改成\033[1;35m%d\033[m\n"
+ " \033[1;37m站長%s修改錢理由是:%s\033[m",
+ cuser.userid, x.userid, money, x.money,
cuser.userid, reason);
- fclose(fp);
- snprintf(fhdr.title, sizeof(fhdr.title),
- "[公安報告] 站長%s修改%s錢報告", cuser.userid,
- x.userid);
- strlcpy(fhdr.owner, "[系統安全局]", sizeof(fhdr.owner));
- append_record("boards/S/Security/.DIR", &fhdr, sizeof(fhdr));
+ snprintf(title, sizeof(title),
+ "[公安報告] 站長%s修改%s錢報告", cuser.userid,
+ x.userid);
+ post_msg("Security", title, msg, "[系統安全局]");
}
}
}