summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pttbbs/include/proto.h1
-rw-r--r--pttbbs/mbbsd/admin.c5
-rw-r--r--pttbbs/mbbsd/bbs.c27
-rw-r--r--pttbbs/mbbsd/cal.c19
-rw-r--r--pttbbs/mbbsd/gamble.c8
5 files changed, 32 insertions, 28 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index e73b51c2..92e4a537 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -123,7 +123,6 @@ const char * postperm_msg(const char *bname);
/* cal */
const char* money_level(int money);
-int vice(int money, const char* item);
int pay(int money, const char *item, ...) GCC_CHECK_FORMAT(2,3);
int pay_as_uid(int uid, int money, const char *item,...)GCC_CHECK_FORMAT(3,4);
int lockutmpmode(int unmode, int state);
diff --git a/pttbbs/mbbsd/admin.c b/pttbbs/mbbsd/admin.c
index 8e434d4e..96e3f96d 100644
--- a/pttbbs/mbbsd/admin.c
+++ b/pttbbs/mbbsd/admin.c
@@ -1100,9 +1100,10 @@ int make_symbolic_link_interactively(int gid)
static void
give_id_money(const char *user_id, int money, const char *mail_title)
{
- char tt[TTLEN + 1] = {0};
+ char tt[TTLEN + 1] = {0};
+ int unum = searchuser(user_id, NULL);
- if (deumoney(searchuser(user_id, NULL), money) < 0) { // TODO if searchuser() return 0
+ if (unum <= 0 || pay_as_uid(unum, -money, "站長發紅包") < 1) {
move(12, 0);
clrtoeol();
prints("id:%s money:%d 不對吧!!", user_id, money);
diff --git a/pttbbs/mbbsd/bbs.c b/pttbbs/mbbsd/bbs.c
index 920c7f6e..9fd03a34 100644
--- a/pttbbs/mbbsd/bbs.c
+++ b/pttbbs/mbbsd/bbs.c
@@ -3017,11 +3017,9 @@ del_range(int ent, const fileheader_t *fhdr, const char *direct)
static int
del_post(int ent, fileheader_t * fhdr, char *direct)
{
-#ifdef SAFE_ARTICLE_DELETE
- char reason[PROPER_TITLE_LEN];
-#endif
+ char reason[PROPER_TITLE_LEN] = "";
char genbuf[100], newpath[PATHLEN];
- int not_owned, is_anon, tusernum, del_ok = 0;
+ int not_owned, is_anon, tusernum, del_ok = 0, as_badpost = 0;
boardheader_t *bp;
assert(0<=currbid-1 && currbid-1<MAX_BOARD);
@@ -3067,7 +3065,6 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
if (fhdr->filename[0]=='L') fhdr->filename[0]='M';
#ifdef SAFE_ARTICLE_DELETE
- reason[0] = 0;
// query if user really wants to delete it
if (not_owned && !is_anon && fhdr->owner[0])
{
@@ -3156,6 +3153,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
vgets(genbuf, 3, VGET_LOWERCASE);
if (genbuf[0]=='y') {
+ as_badpost = 1;
assign_badpost(getuserid(tusernum), fhdr, newpath, NULL);
}
}
@@ -3192,8 +3190,13 @@ del_post(int ent, fileheader_t * fhdr, char *direct)
xuser.numposts--;
passwd_sync_update(tusernum, &xuser);
}
- deumoney(tusernum, -fhdr->multi.money);
- sendalert_uid(tusernum, ALERT_PWD_PERM);
+
+ pay_as_uid(tusernum, fhdr->multi.money,
+ "%s 看板 文章「%s」被%s,扣除稿酬%s %s",
+ currboard, fhdr->title,
+ as_badpost ? "劣退" : "刪除",
+ reason[0] ? "。原因:" : "", reason);
+ sendalert_uid(tusernum, ALERT_PWD_PERM);
#ifdef USE_COOLDOWN
if (bp->brdattr & BRD_COOLDOWN)
add_cooldowntime(tusernum, 15);
@@ -3664,7 +3667,10 @@ good_post(int ent, fileheader_t * fhdr, const char *direct)
!strcmp(currboard, BN_LAW)
)
{
- deumoney(searchuser(fhdr->owner, NULL), -1000); // TODO if searchuser() return 0
+ int unum = searchuser(fhdr->owner, NULL);
+ if (unum > 0) {
+ pay_as_uid(unum, 1000, "取消 %s 看板文摘", currboard);
+ }
if (!(currmode & MODE_SELECT))
fhdr->multi.money -= 1000;
else
@@ -3710,7 +3716,10 @@ good_post(int ent, fileheader_t * fhdr, const char *direct)
!strcmp(currboard, BN_LAW)
)
{
- deumoney(searchuser(fhdr->owner, NULL), 1000); // TODO if searchuser() return 0
+ int unum = searchuser(fhdr->owner, NULL);
+ if (unum > 0) {
+ pay_as_uid(unum, -1000, "被選入 %s 看板文摘", currboard);
+ }
if (!(currmode & MODE_SELECT))
fhdr->multi.money += 1000;
else
diff --git a/pttbbs/mbbsd/cal.c b/pttbbs/mbbsd/cal.c
index 38cbfa3c..8882bd5a 100644
--- a/pttbbs/mbbsd/cal.c
+++ b/pttbbs/mbbsd/cal.c
@@ -77,11 +77,11 @@ do_pay(int uid, int money, const char *item, const char *reason)
if (uid == usernum)
reload_money();
-#ifdef FN_RECENTVICE
+#ifdef FN_RECENTPAY
char buf[PATHLEN];
- sethomefile(buf, userid, FN_RECENTVICE);
- rotate_text_logfile(buf, SZ_RECENTVICE, 0.2);
+ sethomefile(buf, userid, FN_RECENTPAY);
+ rotate_text_logfile(buf, SZ_RECENTPAY, 0.2);
syncnow();
log_filef(buf, LOG_CREAT, "%s %s $%d ($%d => $%d) %s\n",
Cdatelite(&now),
@@ -129,12 +129,6 @@ pay(int money, const char *item, ...)
return do_pay(usernum, money, item, reason);
}
-// compatible mode: vice
-int
-vice(int money, const char *item) {
- return pay(money, "%s", item);
-}
-
static int
inmailbox(int m)
{
@@ -334,7 +328,7 @@ do_give_money(char *id, int uid, int money, const char *myid)
pay_as_uid(uid, -(money - tax), "來自 %s 的轉帳 (稅前 $%d)",
myid, money);
log_filef(FN_MONEY, LOG_CREAT, "%-12s 給 %-12s %d\t(稅後 %d)\t%s\n",
- cuser.userid, id, money, money - tax, Cdate(&now));
+ cuser.userid, id, money, money - tax, Cdate(&now));
// penalty
if (money < 50) {
@@ -497,6 +491,11 @@ give_money_ui(const char *userid)
char fpath[PATHLEN];
if (mail_redenvelop( myid, id, m - mtax, fpath) < 0)
{
+#ifdef FN_RECENTPAY
+ outs("您可以於下列位置找到最近的交易記錄:\n"
+ "主選單 => (U)ser個人設定 => (L)MyLogs 個人記錄 => "
+ "(V)RecentVice 最近交易記錄\n");
+#endif
vmsg("交易完成。");
return 0;
}
diff --git a/pttbbs/mbbsd/gamble.c b/pttbbs/mbbsd/gamble.c
index 7993e68c..caedca66 100644
--- a/pttbbs/mbbsd/gamble.c
+++ b/pttbbs/mbbsd/gamble.c
@@ -231,9 +231,7 @@ doesnt_catch_up:
price = price * n;
// XXX 這是因為停止下注所以退錢? 感覺好危險+race condition
if (price > 0) {
- // TODO enable this for detail log
- // vice_to(currutmp->uid, -price, "下注失敗退費");
- deumoney(currutmp->uid, price);
+ pay_as_uid(currutmp->uid, -price, "下注失敗退費");
}
vmsg("板主已經停止下注了 不能賭嚕");
unlockutmpmode();
@@ -399,9 +397,7 @@ openticket(int bid)
continue;
if ((uid = searchuser(userid, userid)) == 0)
continue;
- // XXX enable this for detail log
- // vice_to(uid, -(money * i), BBSMNAME "賭場 - 彩票[%s]", betname[mybet]);
- deumoney(uid, money * i);
+ pay_as_uid(uid, -(money * i), BBSMNAME "賭場 - 彩票[%s]", betname[mybet]);
mail_id(userid, buf, "etc/ticket.win", BBSMNAME "賭場");
}
fclose(fp1);