summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-05-07 08:35:59 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-05-07 08:35:59 +0800
commit6f8724e2ac7407f12e003f1fde2c7b3b02694498 (patch)
treea472f413af8811af8a5e1a0807cc7655080195c4
parent4e7c1a185b51b96a1983839591aaaeccdccdffb2 (diff)
downloadpttbbs-6f8724e2ac7407f12e003f1fde2c7b3b02694498.tar
pttbbs-6f8724e2ac7407f12e003f1fde2c7b3b02694498.tar.gz
pttbbs-6f8724e2ac7407f12e003f1fde2c7b3b02694498.tar.bz2
pttbbs-6f8724e2ac7407f12e003f1fde2c7b3b02694498.tar.lz
pttbbs-6f8724e2ac7407f12e003f1fde2c7b3b02694498.tar.xz
pttbbs-6f8724e2ac7407f12e003f1fde2c7b3b02694498.tar.zst
pttbbs-6f8724e2ac7407f12e003f1fde2c7b3b02694498.zip
Revert r3495. Fix bug of birthday checking and statistic report for today-login.
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3512 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index 979d76dc..754e5388 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1066,23 +1066,23 @@ inline static void foreign_warning(void){
static void
user_login(void)
{
- struct tm *ptime, *lasttime;
+ struct tm ptime, lasttime;
int nowusers, ifbirth = 0, i;
/* NOTE! 在 setup_utmp 之前, 不應該有任何 blocking/slow function,
* 否則可藉機 race condition 達到 multi-login */
/* get local time */
- ptime = localtime4(&now);
+ ptime = *localtime4(&now);
/* 初始化: random number 增加user跟時間的差異 */
mysrand();
/* check if over18 */
- if( (ptime->tm_year - cuser.year) >= 18 ||
- (ptime->tm_year - cuser.year == 17 &&
- ((ptime->tm_mon+1) > cuser.month ||
- ((ptime->tm_mon+1) == cuser.month && ptime->tm_mday > cuser.day))) )
+ if( (ptime.tm_year - cuser.year) >= 18 ||
+ (ptime.tm_year - cuser.year == 17 &&
+ ((ptime.tm_mon+1) > cuser.month ||
+ ((ptime.tm_mon+1) == cuser.month && ptime.tm_mday > cuser.day))) )
over18 = 1;
log_usies("ENTER", fromhost);
@@ -1109,11 +1109,11 @@ user_login(void)
/* 初始化 uinfo、flag、mode */
setup_utmp(LOGIN);
enter_uflag = cuser.uflag;
- lasttime = localtime4(&cuser.lastlogin);
+ lasttime = *localtime4(&cuser.lastlogin);
/* show welcome_login */
- if( (ifbirth = (ptime->tm_mday == cuser.day &&
- ptime->tm_mon + 1 == cuser.month)) ){
+ if( (ifbirth = (ptime.tm_mday == cuser.day &&
+ ptime.tm_mon + 1 == cuser.month)) ){
char buf[PATHLEN];
snprintf(buf, sizeof(buf), "etc/Welcome_birth.%d", getHoroscope(cuser.month, cuser.day));
more(buf, NA);
@@ -1158,7 +1158,7 @@ user_login(void)
welcome_msg();
if( ifbirth ){
- birthday_make_a_wish(ptime, lasttime);
+ birthday_make_a_wish(&ptime, &lasttime);
if( getans("是否要顯示「壽星」於使用者名單上?(y/N)") == 'y' )
currutmp->birth = 1;
}
@@ -1181,7 +1181,7 @@ user_login(void)
check_mailbox_quota();
}
- if(ptime->tm_yday != lasttime->tm_yday)
+ if(ptime.tm_yday!=lasttime.tm_yday)
STATINC(STAT_TODAYLOGIN_MAX);
if (!PERM_HIDE(currutmp)) {
@@ -1202,7 +1202,7 @@ user_login(void)
#endif
/* login time update */
- if(ptime->tm_yday != lasttime->tm_yday)
+ if(ptime.tm_yday!=lasttime.tm_yday)
STATINC(STAT_TODAYLOGIN_MIN);
@@ -1243,12 +1243,11 @@ do_aloha(const char *hello)
setuserfile(genbuf, "aloha");
if ((fp = fopen(genbuf, "r"))) {
- snprintf(genbuf, sizeof(genbuf), hello);
while (fgets(userid, 80, fp)) {
userinfo_t *uentp;
if ((uentp = (userinfo_t *) search_ulist_userid(userid)) &&
isvisible(uentp, currutmp)) {
- my_write(uentp->pid, genbuf, uentp->userid, WATERBALL_ALOHA, uentp);
+ my_write(uentp->pid, hello, uentp->userid, WATERBALL_ALOHA, uentp);
}
}
fclose(fp);