summaryrefslogtreecommitdiffstats
path: root/mbbsd/user.c
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-17 12:07:47 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-17 12:07:47 +0800
commit2a83fe8bd5b10cb1b6e1b9b4f8fc76096e185456 (patch)
treeab5b8e43e9768c1662e1b62544925cf9eb06a528 /mbbsd/user.c
parentae598bc932f6a2cc3227b5a65c8ab0c88dedcf69 (diff)
downloadpttbbs-2a83fe8bd5b10cb1b6e1b9b4f8fc76096e185456.tar
pttbbs-2a83fe8bd5b10cb1b6e1b9b4f8fc76096e185456.tar.gz
pttbbs-2a83fe8bd5b10cb1b6e1b9b4f8fc76096e185456.tar.bz2
pttbbs-2a83fe8bd5b10cb1b6e1b9b4f8fc76096e185456.tar.lz
pttbbs-2a83fe8bd5b10cb1b6e1b9b4f8fc76096e185456.tar.xz
pttbbs-2a83fe8bd5b10cb1b6e1b9b4f8fc76096e185456.tar.zst
pttbbs-2a83fe8bd5b10cb1b6e1b9b4f8fc76096e185456.zip
* refine badpost code again
* remove more deprecated stuff git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4847 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/user.c')
-rw-r--r--mbbsd/user.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 67f5c163..d6897099 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -76,24 +76,26 @@ int u_cancelbadpost(void)
int day, prev = cuser.badpost;
// early check.
- if(cuser.badpost==0) {
+ if(cuser.badpost == 0) {
vmsg("你並沒有劣文.");
return 0;
}
// early check for race condition
+ // XXX 由於帳號API已同步化 (pwcuAPI*) 所以這個 check 可有可無
if(search_ulistn(usernum,2)) {
vmsg("請登出其他視窗, 否則不受理.");
return 0;
}
- // XXX reload account here?
+ // XXX reload account here? (also simply optional)
pwcuReload();
// early check for time (must do again later)
- day = BADPOST_CLEAR_DURATION - (now - cuser.timeremovebadpost ) / DAY_SECONDS;
- if(day>0 && day<=BADPOST_CLEAR_DURATION) {
- vmsgf("每 %d 天才能申請一次, 還剩 %d 天.", BADPOST_CLEAR_DURATION, day);
+ day = (now - cuser.timeremovebadpost ) / DAY_SECONDS;
+ if (day < BADPOST_CLEAR_DURATION) {
+ vmsgf("每 %d 天才能申請一次, 還剩 %d 天.",
+ BADPOST_CLEAR_DURATION, BADPOST_CLEAR_DURATION-day);
return 0;
}
@@ -106,12 +108,6 @@ int u_cancelbadpost(void)
return 0;
}
- // check again for race condition
- if(search_ulistn(usernum,2)) {
- vmsg("請登出其他視窗, 否則不受理.");
- return 0;
- }
-
if (pwcuCancelBadpost() != 0) {
vmsg("刪除失敗,請洽站務人員。");
return 0;
@@ -857,7 +853,7 @@ uinfo_query(const char *orig_uid, int adminmode, int unum)
do {
int max_days = (x.lastlogin - x.firstlogin) / DAY_SECONDS;
snprintf(genbuf, sizeof(genbuf), "%d", x.numlogindays);
- if (getdata_str(y++, 0, STR_LOGINDAYS, buf, 10, DOECHO, genbuf))
+ if (getdata_str(y++, 0, STR_LOGINDAYS ":", buf, 10, DOECHO, genbuf))
if ((tmp = atoi(buf)) >= 0)
x.numlogindays = tmp;
if (x.numlogindays > max_days)