diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-12-19 13:33:45 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2007-12-19 13:33:45 +0800 |
commit | 08ae8ba0331d27fc196d41a0cbc480c5ee3aa0c6 (patch) | |
tree | 777979db7273a30e79fb6142f23641cad5fc7a96 | |
parent | 3fb733dd415e5f0fd762e5f14272e400b20ca990 (diff) | |
download | pttbbs-08ae8ba0331d27fc196d41a0cbc480c5ee3aa0c6.tar pttbbs-08ae8ba0331d27fc196d41a0cbc480c5ee3aa0c6.tar.gz pttbbs-08ae8ba0331d27fc196d41a0cbc480c5ee3aa0c6.tar.bz2 pttbbs-08ae8ba0331d27fc196d41a0cbc480c5ee3aa0c6.tar.lz pttbbs-08ae8ba0331d27fc196d41a0cbc480c5ee3aa0c6.tar.xz pttbbs-08ae8ba0331d27fc196d41a0cbc480c5ee3aa0c6.tar.zst pttbbs-08ae8ba0331d27fc196d41a0cbc480c5ee3aa0c6.zip |
- disable vice tickets < specific number
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3708 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/config.h | 4 | ||||
-rw-r--r-- | mbbsd/cal.c | 28 | ||||
-rw-r--r-- | sample/pttbbs.conf | 3 |
3 files changed, 22 insertions, 13 deletions
diff --git a/include/config.h b/include/config.h index e2d2d17d..8ed367ab 100644 --- a/include/config.h +++ b/include/config.h @@ -198,6 +198,10 @@ #define HASH_BITS 16 /* userid->uid hashing bits */ #endif +#ifndef VICE_MIN +#define VICE_MIN (1) /* 最小發票面額 */ +#endif // VICE_MIN + /* more.c 中文章頁數上限(lines/22), +4 for safe */ #define MAX_PAGES (MAX_EDIT_LINE / 22 + 4) diff --git a/mbbsd/cal.c b/mbbsd/cal.c index 39f55514..fb5c12e6 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -62,24 +62,26 @@ unlockutmpmode(void) int vice(int money, const char *item) { - char buf[128]; - unsigned int viceserial = (currutmp->lastact % 10000) * 10000 + random() % 10000; + char buf[128]; + unsigned int viceserial = (currutmp->lastact % 10000) * 10000 + + random() % 10000; + // new logic: do not send useless vice tickets demoney(-money); - if(money>=100) - { - setuserfile(buf, VICE_NEW); - log_filef(buf, LOG_CREAT, "%8.8d\n", viceserial); - } + if (money < VICE_MIN) + return 0; + + setuserfile(buf, VICE_NEW); + log_filef(buf, LOG_CREAT, "%8.8d\n", viceserial); snprintf(buf, sizeof(buf), - "%s 花了$%d 編號[%08d]", item, money, viceserial); + "%s 花了$%d 編號[%08d]", item, money, viceserial); mail_id(cuser.userid, buf, "etc/vice.txt", BBSMNAME "經濟部"); return 0; } -#define lockreturn(unmode, state) if(lockutmpmode(unmode, state)) return +#define lockreturn(unmode, state) if(lockutmpmode(unmode, state)) return #define lockreturn0(unmode, state) if(lockutmpmode(unmode, state)) return 0 -#define lockbreak(unmode, state) if(lockutmpmode(unmode, state)) break +#define lockbreak(unmode, state) if(lockutmpmode(unmode, state)) break #define SONGBOOK "etc/SONGBOOK" #define OSONGPATH "etc/SONGO" @@ -205,13 +207,13 @@ osong(void) log_filef("etc/osong.log", LOG_CREAT, "id: %-12s ◇ %s 點給 %s : \"%s\", 轉寄至 %s\n", cuser.userid, sender, receiver, say, address); - if (append_record(OSONGPATH "/.DIR", &mail, sizeof(mail)) != -1) { + if (append_record(OSONGPATH "/" FN_DIR, &mail, sizeof(mail)) != -1) { cuser.lastsong = now; /* Jaky 超過 MAX_MOVIE 首歌就開始砍 */ - nsongs = get_num_records(OSONGPATH "/.DIR", sizeof(mail)); + nsongs = get_num_records(OSONGPATH "/" FN_DIR, sizeof(mail)); if (nsongs > MAX_MOVIE) { // XXX race condition - delete_range(OSONGPATH "/.DIR", 1, nsongs - MAX_MOVIE); + delete_range(OSONGPATH "/" FN_DIR, 1, nsongs - MAX_MOVIE); } snprintf(genbuf, sizeof(genbuf), "%s says \"%s\" to %s.", sender, say, receiver); log_usies("OSONG", genbuf); diff --git a/sample/pttbbs.conf b/sample/pttbbs.conf index 37b416a5..7dea01e6 100644 --- a/sample/pttbbs.conf +++ b/sample/pttbbs.conf @@ -246,6 +246,9 @@ /* 若定義, 新板設定自動開記錄,不過 USE_AUTOCPLOG 還是要開才有用 */ #define DEFAULT_AUTOCPLOG +/* 若定義,少於此數目的金錢將不開發票 */ +#define VICE_MIN (100) + /* 贈送信箱 */ //#define ADD_EXMAILBOX 100 |