summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-08 08:23:32 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-08 08:23:32 +0800
commit8a3a6d8827cf9ba4073dbdff48e0cdfeb7d012c3 (patch)
tree06a88440d5f0e9725ebe7f0e462c1277a434102a
parentdfeb1a9e710617bb8b800ec0a11350d1c9f79489 (diff)
downloadpttbbs-8a3a6d8827cf9ba4073dbdff48e0cdfeb7d012c3.tar
pttbbs-8a3a6d8827cf9ba4073dbdff48e0cdfeb7d012c3.tar.gz
pttbbs-8a3a6d8827cf9ba4073dbdff48e0cdfeb7d012c3.tar.bz2
pttbbs-8a3a6d8827cf9ba4073dbdff48e0cdfeb7d012c3.tar.lz
pttbbs-8a3a6d8827cf9ba4073dbdff48e0cdfeb7d012c3.tar.xz
pttbbs-8a3a6d8827cf9ba4073dbdff48e0cdfeb7d012c3.tar.zst
pttbbs-8a3a6d8827cf9ba4073dbdff48e0cdfeb7d012c3.zip
* improve check_BM frequency
* refine messages git-svn-id: http://opensvn.csie.org/pttbbs/branches/pttbbs.pwcu@4819 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--mbbsd/mbbsd.c14
-rw-r--r--mbbsd/passwd.c3
-rw-r--r--mbbsd/user.c2
-rw-r--r--mbbsd/var.c3
4 files changed, 14 insertions, 8 deletions
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index a99a5145..f10bec3d 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1049,11 +1049,6 @@ setup_utmp(int mode)
strip_nonebig5((unsigned char *)currutmp->nickname, sizeof(currutmp->nickname));
strip_nonebig5((unsigned char *)currutmp->mind, sizeof(currutmp->mind));
- // XXX 這個 check 花不少時間,有點間隔比較好
- // TODO XXX 使用 numlogindays 有點問題,同一天內多次 login 會狂檢查...
- if ((cuser.userlevel & PERM_BM) && !(cuser.numlogindays % 20))
- check_BM(); /* Ptt 自動取下離職板主權力 */
-
// resolve fromhost
#if defined(WHERE)
@@ -1260,9 +1255,16 @@ user_login(void)
check_bad_login();
check_mailbox_quota();
check_register();
- pwcuLoginSave();
+ pwcuLoginSave(); // is_first_login_of_today is only valid after pwcuLoginSave.
restore_backup();
+ // XXX 這個 check 花不少時間,有點間隔比較好
+ if (HasUserPerm(PERM_BM) &&
+ (cuser.numlogindays % 10 == 0) && // when using numlogindays, check with is_first_login_of_today
+ is_first_login_of_today )
+ check_BM(); /* 自動取下離職板主權力 */
+
+
} else if (strcmp(cuser.userid, STR_GUEST) == 0) { /* guest */
init_guest_info();
diff --git a/mbbsd/passwd.c b/mbbsd/passwd.c
index 3bb8e352..bfb64224 100644
--- a/mbbsd/passwd.c
+++ b/mbbsd/passwd.c
@@ -468,7 +468,10 @@ int pwcuLoginSave ()
// calculate numlogindays (only increase one per each key)
if (regdays > prev_regdays)
+ {
++u.numlogindays;
+ is_first_login_of_today = 1;
+ }
cuser.numlogindays = u.numlogindays;
// update last login time
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 8d93d95e..1656869c 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -176,7 +176,7 @@ user_display(const userec_t * u, int adminmode)
prints("\t\t使用記錄: " STR_LOGINDAYS " %d " STR_LOGINDAYS_QTY
,u->numlogindays);
if (u->old_numlogins)
- prints(" (轉換新制前: %d)", u->old_numlogins);
+ prints("(轉換新制前結算:%d)", u->old_numlogins);
prints(" / 文章 %d 篇\n", u->numposts);
sethomedir(genbuf, u->userid);
diff --git a/mbbsd/var.c b/mbbsd/var.c
index 727e9163..eb178940 100644
--- a/mbbsd/var.c
+++ b/mbbsd/var.c
@@ -371,9 +371,10 @@ char local_article;
char fromhost[STRLEN] = "\0";
char fromhost_masked[32] = "\0"; // masked 'fromhost'
char water_usies = 0;
+char over18 = 0;
+char is_first_login_of_today = 0;
FILE *fp_writelog = NULL;
water_t *water, *swater[6], *water_which;
-char over18 = 0;
/* chc_play.c */