summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-31 13:30:33 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2008-01-31 13:30:33 +0800
commit3727016a2521ae1fa3f80296100df3294bbc90ce (patch)
treeec50445866392e7e0dcee86af6175f1a4bef13c0
parent718716ca8b2651626439d8a4d0c5b52f7d388130 (diff)
downloadpttbbs-3727016a2521ae1fa3f80296100df3294bbc90ce.tar
pttbbs-3727016a2521ae1fa3f80296100df3294bbc90ce.tar.gz
pttbbs-3727016a2521ae1fa3f80296100df3294bbc90ce.tar.bz2
pttbbs-3727016a2521ae1fa3f80296100df3294bbc90ce.tar.lz
pttbbs-3727016a2521ae1fa3f80296100df3294bbc90ce.tar.xz
pttbbs-3727016a2521ae1fa3f80296100df3294bbc90ce.tar.zst
pttbbs-3727016a2521ae1fa3f80296100df3294bbc90ce.zip
- change over18 calculation as standalone function, in order user changed birthday.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3893 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/modes.h1
-rw-r--r--include/proto.h1
-rw-r--r--mbbsd/cal.c23
-rw-r--r--mbbsd/mbbsd.c23
-rw-r--r--mbbsd/user.c4
5 files changed, 36 insertions, 16 deletions
diff --git a/include/modes.h b/include/modes.h
index e112733c..e53801d2 100644
--- a/include/modes.h
+++ b/include/modes.h
@@ -181,6 +181,7 @@ enum _DBCS_STATUS {
#define SIG_DARK 5
#define SIG_GO 6
#define SIG_REVERSI 7
+#define SIG_CONN6 8
/* talk.c 中的模式 */
#define WATERBALL_GENERAL 0
diff --git a/include/proto.h b/include/proto.h
index 6dc763ec..17a5cbf1 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -190,6 +190,7 @@ int p_from(void);
int ordersong(void);
int p_exmail(void);
void mail_redenvelop(const char* from, const char* to, int money, char mode);
+void resolve_over18(void);
/* card */
int g_card_jack(void);
diff --git a/mbbsd/cal.c b/mbbsd/cal.c
index a98dd001..afdc39ef 100644
--- a/mbbsd/cal.c
+++ b/mbbsd/cal.c
@@ -427,6 +427,29 @@ p_give(void)
return do_give_money(id, uid, atoi(money_buf));
}
+void
+resolve_over18(void)
+{
+ /* get local time */
+ struct tm ptime = *localtime4(&now);
+
+ over18 = 0;
+ /* check if over18 */
+ // 照實歲計算,沒生日的當作未滿 18
+ if (cuser.year < 1 || cuser.month < 1)
+ over18 = 0;
+ else if( (ptime.tm_year - cuser.year) > 18)
+ over18 = 1;
+ else if (ptime.tm_year - cuser.year < 18)
+ over18 = 0;
+ else if ((ptime.tm_mon+1) > cuser.month)
+ over18 = 1;
+ else if ((ptime.tm_mon+1) < cuser.month)
+ over18 = 0;
+ else if (ptime.tm_mday >= cuser.day )
+ over18 = 1;
+}
+
int
p_sysinfo(void)
{
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index d51f506e..08fa5fc1 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1119,21 +1119,6 @@ user_login(void)
/* 初始化: random number 增加user跟時間的差異 */
mysrand();
- /* check if over18 */
- // 照實歲計算,沒生日的當作未滿 18
- if (cuser.year < 1 || cuser.month < 1)
- over18 = 0;
- else if( (ptime.tm_year - cuser.year) > 18)
- over18 = 1;
- else if (ptime.tm_year - cuser.year < 18)
- over18 = 0;
- else if ((ptime.tm_mon+1) > cuser.month)
- over18 = 1;
- else if ((ptime.tm_mon+1) < cuser.month)
- over18 = 0;
- else if (ptime.tm_mday >= cuser.day )
- over18 = 1;
-
log_usies("ENTER", fromhost);
#ifndef VALGRIND
setproctitle("%s: %s", margs, cuser.userid);
@@ -1206,6 +1191,7 @@ user_login(void)
move(t_lines - 4, 0);
clrtobot();
welcome_msg();
+ resolve_over18();
if( ifbirth ){
birthday_make_a_wish(&ptime, &lasttime);
@@ -1227,7 +1213,12 @@ user_login(void)
pressanykey();
#endif
} else {
- pressanykey();
+ // XXX no userlevel, no guest - what is this?
+ // clear();
+ // outs("此帳號停權中");
+ // pressanykey();
+ // exit(1);
+
check_mailbox_quota();
}
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 83402dfe..9ad49259 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1122,6 +1122,10 @@ uinfo_query(userec_t *u, int adminmode, int unum)
passwd_update(unum, &x);
if(perm_changed)
sendalert(x.userid, ALERT_PWD_PERM); // force to reload perm
+
+ // resolve_over18 only works for cuser
+ if (!adminmode)
+ resolve_over18();
}
}