summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-31 13:54:49 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-31 13:54:49 +0800
commit3fbfbac63d50619f92d98140fa7f59f570a180c7 (patch)
tree64cafee218133c82fc7f82075924c812f3992439
parentc7ec45b470726d9b50e7d549a09569e22e2a9a69 (diff)
downloadpttbbs-3fbfbac63d50619f92d98140fa7f59f570a180c7.tar
pttbbs-3fbfbac63d50619f92d98140fa7f59f570a180c7.tar.gz
pttbbs-3fbfbac63d50619f92d98140fa7f59f570a180c7.tar.bz2
pttbbs-3fbfbac63d50619f92d98140fa7f59f570a180c7.tar.lz
pttbbs-3fbfbac63d50619f92d98140fa7f59f570a180c7.tar.xz
pttbbs-3fbfbac63d50619f92d98140fa7f59f570a180c7.tar.zst
pttbbs-3fbfbac63d50619f92d98140fa7f59f570a180c7.zip
* merge pwcu branch with trunk
git-svn-id: http://opensvn.csie.org/pttbbs/branches/pttbbs.pwcu@4806 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--include/proto.h4
-rw-r--r--mbbsd/admin.c2
-rw-r--r--mbbsd/bbs.c9
-rw-r--r--mbbsd/friend.c41
-rw-r--r--mbbsd/gamble.c16
-rw-r--r--mbbsd/ordersong.c8
-rw-r--r--mbbsd/screen.c3
-rw-r--r--mbbsd/user.c1
8 files changed, 63 insertions, 21 deletions
diff --git a/include/proto.h b/include/proto.h
index bc32e07d..a70298b3 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -187,8 +187,8 @@ const char *ask_tmpbuf(int y);
/* emaildb */
#ifdef USE_EMAILDB
-int emaildb_check_email (const char * email, int email_len);
-int emaildb_update_email(const char * userid, int userid_len, const char * email, int email_len);
+int emaildb_check_email (const char *email, int email_len);
+int emaildb_update_email(const char *userid, int userid_len, const char *email, int email_len);
#endif
#ifdef USE_REGCHECKD
int regcheck_ambiguous_userid_exist(const char *userid);
diff --git a/mbbsd/admin.c b/mbbsd/admin.c
index 9dcc5b8a..011f81e7 100644
--- a/mbbsd/admin.c
+++ b/mbbsd/admin.c
@@ -108,7 +108,7 @@ upgrade_passwd(userec_t *puser)
memset(puser->chkpad0, 0, sizeof(puser->chkpad0));
memset(puser->chkpad1, 0, sizeof(puser->chkpad1));
memset(puser->chkpad2, 0, sizeof(puser->chkpad2));
- puser->lastseen = 0;
+ puser->lastseen= 0;
puser->version = PASSWD_VERSION;
return ;
}
diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c
index 183bc16f..2bcf9538 100644
--- a/mbbsd/bbs.c
+++ b/mbbsd/bbs.c
@@ -1235,7 +1235,12 @@ do_generalboardreply(/*const*/ fileheader_t * fhdr)
if (!CheckPostRestriction(currbid))
{
- getdata(b_lines - 1, 0, ANSI_COLOR(1;31) "▲ 無法回應至看板。 " ANSI_RESET
+ getdata(b_lines - 1, 0,
+#ifdef USE_PFTERM
+ ANSI_COLOR(1;31) "▲ 無法回應至看板。 " ANSI_RESET
+#else
+ "▲ 無法回應至看板。 "
+#endif
"改回應至 (M)作者信箱 (Q)取消?[Q] ",
genbuf, sizeof(genbuf), LCECHO);
switch (genbuf[0]) {
@@ -3212,6 +3217,8 @@ view_postinfo(int ent, const fileheader_t * fhdr, const char *direct, int crs_ln
outc(' '); outs(ANSI_CLRTOEND);
move(area_l, 0);
+ // TODO XXX support wide terminal someday.
+
prints("┌─────────────────────────────────────┐\n");
aidu = fn2aidu((char *)fhdr->filename);
diff --git a/mbbsd/friend.c b/mbbsd/friend.c
index 1d63335e..f3f88925 100644
--- a/mbbsd/friend.c
+++ b/mbbsd/friend.c
@@ -234,7 +234,7 @@ delete_friend_from_file(const char *file, const char *string, int case_sensitiv
#define MAX_EXPIRE_MONTH (800)
int
-friend_validate(int type, int expire)
+friend_validate(int type, int expire, int badpost)
{
FILE *fp = NULL, *nfp = NULL;
char fpath[PATHLEN];
@@ -247,6 +247,8 @@ friend_validate(int type, int expire)
expire *= DAY_SECONDS *30;
else
expire = 0;
+ if (badpost < 0 || badpost > UCHAR_MAX)
+ badpost = 0;
syncnow();
setfriendfile(fpath, type);
@@ -271,12 +273,25 @@ friend_validate(int type, int expire)
if (searchuser(buf, NULL))
{
- if (expire > 0) {
+ if (expire > 0 || badpost > 0) {
+ userec_t *pu = &u;
// drop user if (now-lastlogin) longer than expire*month
getuser(buf, &u);
- if (now - u.lastlogin > expire)
- continue;
+ if (expire > 0)
+ {
+ // XXX lastlogin was NOT counting people with PERM_HIDE...
+ // although we will have 'lastseen' in future,
+ // never count people with PERM_HIDE.
+ if (!(PERM_HIDE(pu)) &&
+ now - u.lastlogin > expire)
+ continue;
+ }
+ if (badpost > 0)
+ {
+ if (u.badpost >= badpost)
+ continue;
+ }
}
fputs(genbuf, nfp);
}
@@ -486,9 +501,8 @@ friend_edit(int type)
}
getdata(1, 0, (count ?
"(A)增加(D)刪除(E)修改(P)引入(L)列出(K)清空"
- ANSI_COLOR(33) "(C)整理有效名單" ANSI_RESET
- "(W)水球(Q)結束?[Q] " :
- "(A)增加 (P)引入其他名單 (Q)結束?[Q] "),
+ "(C)整理有效名單(W)水球(Q)結束?[Q] " :
+ "(A)增加 (P)引入其他名單 (Q)結束?[Q] "),
uident, 3, LCECHO);
if (uident[0] == 'a') {
move(1, 0);
@@ -498,11 +512,20 @@ friend_edit(int type)
dirty = 1;
}
} else if (uident[0] == 'c') {
+ int expire = 0, badpost = 0;
getdata(2, 0,
- "要從名單中清除幾個月沒上站(包含帳號已消失)的使用者?",
+ "要從名單中清除幾個月沒上站(包含帳號已消失)的使用者? (0=不清除)[0] ",
uident, 4, NUMECHO);
+ expire = atoi(uident);
+#ifdef ASSESS
+ getdata(3, 0,
+ "要從名單中清除有幾篇以上劣文的使用者? (0=不清除)[0] ",
+ uident, 4, NUMECHO);
+#endif
+ badpost = atoi(uident);
+
// delete all users that not in list.
- friend_validate(type, atoi(uident));
+ friend_validate(type, expire, badpost);
dirty = 1;
} else if (uident[0] == 'p') {
friend_append(type, count);
diff --git a/mbbsd/gamble.c b/mbbsd/gamble.c
index 93388e1f..a3d59236 100644
--- a/mbbsd/gamble.c
+++ b/mbbsd/gamble.c
@@ -258,7 +258,13 @@ openticket(int bid)
do {
do {
getdata(20, 0,
- ANSI_COLOR(1) "選擇中獎的號碼(0:不開獎 99:取消退錢)" ANSI_RESET ":", buf, 3, LCECHO);
+#ifdef USE_PFTERM
+ ANSI_COLOR(1) "選擇中獎的號碼(0:不開獎 99:取消退錢)"
+ ANSI_RESET ":"
+#else
+ "選擇中獎的號碼(0:不開獎 99:取消退錢):"
+#endif
+ , buf, 3, LCECHO);
bet = atoi(buf);
move(0, 0);
clrtoeol();
@@ -267,7 +273,13 @@ openticket(int bid)
unlockutmpmode();
return 0;
}
- getdata(21, 0, ANSI_COLOR(1) "再次確認輸入號碼" ANSI_RESET ":", buf, 3, LCECHO);
+ getdata(21, 0,
+#ifdef USE_PFTERM
+ ANSI_COLOR(1) "再次確認輸入號碼" ANSI_RESET ":"
+#else
+ "再次確認輸入號碼:"
+#endif
+ , buf, 3, LCECHO);
} while (bet != atoi(buf));
// before we fork to process,
diff --git a/mbbsd/ordersong.c b/mbbsd/ordersong.c
index be9844d8..477b85f1 100644
--- a/mbbsd/ordersong.c
+++ b/mbbsd/ordersong.c
@@ -45,15 +45,15 @@ do_order_song(void)
"公然侮辱 誹謗\n"
"若有上述違規情形,站方將保留決定是否公開播放的權利\n"
"如不同意請按 (3) 離開。" ANSI_RESET "\n");
+ getdata(18, 0,
#ifdef USE_PFTERM
- getdata(18, 0, "請選擇 " ANSI_COLOR(1) "1)" ANSI_RESET " 開始點歌、"
+ "請選擇 " ANSI_COLOR(1) "1)" ANSI_RESET " 開始點歌、"
ANSI_COLOR(1) "2)" ANSI_RESET " 看歌本、"
"或是 " ANSI_COLOR(1) "3)" ANSI_RESET " 離開: ",
- ans, sizeof(ans), DOECHO);
#else
- getdata(18, 0, "請選擇 1)開始點歌 2)看歌本 3)離開: ",
- ans, sizeof(ans), DOECHO);
+ "請選擇 1)開始點歌 2)看歌本 3)離開: ",
#endif
+ ans, sizeof(ans), DOECHO);
if (ans[0] == '1')
break;
diff --git a/mbbsd/screen.c b/mbbsd/screen.c
index 5537a4f3..23d00c20 100644
--- a/mbbsd/screen.c
+++ b/mbbsd/screen.c
@@ -160,7 +160,8 @@ getyx_ansi(int *py, int *px)
if (slp->len < 1)
return;
c = slp->data[x];
- *px += (strlen((char*)slp->data) - strlen_noansi((char*)slp->data));
+ slp->data[x] = 0;
+ *px -= (strlen((char*)slp->data) - strlen_noansi((char*)slp->data));
slp->data[x] = c;
}
diff --git a/mbbsd/user.c b/mbbsd/user.c
index 0e8fdb53..76f3593b 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -1204,7 +1204,6 @@ u_info(void)
reload_money();
user_display(cuser_ref, 0);
uinfo_query (cuser.userid, 0, usernum);
- // XXX TODO update from u to cuser
pwcuReload();
strlcpy(currutmp->nickname, cuser.nickname, sizeof(currutmp->nickname));
return 0;