summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-28 15:37:04 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-28 15:37:04 +0800
commitae4ff7c9da0f5973cf64a21a3410e0ed246894e6 (patch)
treedfaafd57f4250b63a8f9ca7b5424f843a90f73cf
parent01ff073c35b89ad6662c78efac10d6b632f53048 (diff)
downloadpttbbs-ae4ff7c9da0f5973cf64a21a3410e0ed246894e6.tar
pttbbs-ae4ff7c9da0f5973cf64a21a3410e0ed246894e6.tar.gz
pttbbs-ae4ff7c9da0f5973cf64a21a3410e0ed246894e6.tar.bz2
pttbbs-ae4ff7c9da0f5973cf64a21a3410e0ed246894e6.tar.lz
pttbbs-ae4ff7c9da0f5973cf64a21a3410e0ed246894e6.tar.xz
pttbbs-ae4ff7c9da0f5973cf64a21a3410e0ed246894e6.tar.zst
pttbbs-ae4ff7c9da0f5973cf64a21a3410e0ed246894e6.zip
* drop 'dbcsaware detection' ui, because we have the better 'repeat detection'.
* also changed UF_DBCSAWARE to UF_DBCS_AWARE git-svn-id: http://opensvn.csie.org/pttbbs/trunk@4886 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--pttbbs/UPDATING5
-rw-r--r--pttbbs/include/proto.h4
-rw-r--r--pttbbs/include/uflags.h3
-rw-r--r--pttbbs/mbbsd/edit.c2
-rw-r--r--pttbbs/mbbsd/passwd.c2
-rw-r--r--pttbbs/mbbsd/register.c17
-rw-r--r--pttbbs/mbbsd/user.c89
7 files changed, 14 insertions, 108 deletions
diff --git a/pttbbs/UPDATING b/pttbbs/UPDATING
index 81752ee0..ed14d14b 100644
--- a/pttbbs/UPDATING
+++ b/pttbbs/UPDATING
@@ -23,6 +23,11 @@ https://opensvn.csie.org/traccgi/pttbbs/changeset/2273
make r4871_uflag
-----------------------------------------------------------------------------
+r4886: [dbcs]
+加了 repeat detection 的 DBCS 還不錯,所以正式脫離使用 detection 界面的日子
+有需要作全站轉換的人請自見拿 r4871 去改
+NOTE: 或許未來可以把 DBCSAWARE 的 conditional compile flag 拿掉
+
r4871: [uflag]
由於兩個 uflag 實在太容易令人寫錯、而且 uflag 的空間還很大,
決定把 uflag/uflag2 整合。
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h
index 3c2895a2..5acd4877 100644
--- a/pttbbs/include/proto.h
+++ b/pttbbs/include/proto.h
@@ -621,10 +621,6 @@ int u_editplan(void);
int u_editsig(void);
int u_cloak(void);
int u_list(void);
-#ifdef DBCSAWARE
-int u_detectDBCSAwareEvilClient();
-#endif
-#define ISDBCSAWARE() (cuser.uflag & UF_DBCSAWARE)
/* vote */
void b_suckinfile(FILE *fp, const char *fname);
diff --git a/pttbbs/include/uflags.h b/pttbbs/include/uflags.h
index 8f71c05b..532138c0 100644
--- a/pttbbs/include/uflags.h
+++ b/pttbbs/include/uflags.h
@@ -15,7 +15,7 @@
#define UF_ADBANNER 0x00000040 // (was: MOVIE_FLAG, true if show advertisement banner
#define UF_ADBANNER_USONG 0x00000080 // true if show user songs in banner
// #define UF_MIND 0x00000100 // deprecated: true if mind search mode open <-Heat
-#define UF_DBCSAWARE 0x00000200 // true if DBCS-aware enabled.
+#define UF_DBCS_AWARE 0x00000200 // true if DBCS-aware enabled.
#define UF_DBCS_NOINTRESC 0x00000400 // no Escapes interupting DBCS characters
#define UF_DBCS_DROP_REPEAT 0x00000800 // detect and drop repeated input from evil clients
// #define UF_DBCS_??? 0x00000800 // reserved
@@ -46,6 +46,7 @@
(x != 'n') : \
(x == 'y') )
#define REJECT_OUTTAMAIL(x) (x.uflag & UF_REJ_OUTTAMAIL)
+#define ISDBCSAWARE() (cuser.uflag & UF_DBCS_AWARE)
/* -------------------- userec_t.uflag2 (unsigned int) */
diff --git a/pttbbs/mbbsd/edit.c b/pttbbs/mbbsd/edit.c
index 2dd23eee..f39280d4 100644
--- a/pttbbs/mbbsd/edit.c
+++ b/pttbbs/mbbsd/edit.c
@@ -3486,7 +3486,7 @@ vedit2(const char *fpath, int saveheader, int *islocal, char title[STRLEN], int
currutmp->destuid = currstat;
#ifdef DBCSAWARE
- mbcs_mode = (HasUserFlag(UF_DBCSAWARE)) ? 1 : 0;
+ mbcs_mode = ISDBCSAWARE() ? 1 : 0;
#endif
enter_edit_buffer();
diff --git a/pttbbs/mbbsd/passwd.c b/pttbbs/mbbsd/passwd.c
index 46734d8b..836798d4 100644
--- a/pttbbs/mbbsd/passwd.c
+++ b/pttbbs/mbbsd/passwd.c
@@ -603,7 +603,7 @@ void pwcuInitGuestPerm ()
cuser.uflag = UF_BRDSORT;
cuser.pager = PAGER_OFF;
#ifdef DBCSAWARE
- _ENABLE_BIT(cuser.uflag, UF_DBCSAWARE);
+ _ENABLE_BIT(cuser.uflag, (UF_DBCS_AWARE | UF_DBCS_DROP_REPEAT));
# ifdef GUEST_DEFAULT_DBCS_NOINTRESC
_ENABLE_BIT(cuser.uflag, UF_DBCS_NOINTRESC);
# endif
diff --git a/pttbbs/mbbsd/register.c b/pttbbs/mbbsd/register.c
index c521a8cc..81d13cd0 100644
--- a/pttbbs/mbbsd/register.c
+++ b/pttbbs/mbbsd/register.c
@@ -712,24 +712,15 @@ new_register(void)
newuser.numlogindays = 1;
strlcpy(newuser.lasthost, fromhost, sizeof(newuser.lasthost));
+#ifdef DBCSAWARE
+ newuser.uflag |= UF_DBCS_AWARE | UF_DBCS_DROP_REPEAT;
+#endif
+
#ifdef UF_ADBANNER_USONG
if (query_adbanner_usong_pref_changed(&newuser, 0))
newuser.uflag |= UF_ADBANNER_USONG;
#endif
-#ifdef DBCSAWARE
-# ifndef DBCSAWARE_SKIP_EVIL_REPEATS_CHECK
- newuser.uflag |= UF_DBCS_DROP_REPEAT;
-# endif
- // if we check for repeats, safe to set DBCS aware to user;
- // otherwise use detection
- if ((newuser.uflag & UF_DBCS_DROP_REPEAT) ||
- u_detectDBCSAwareEvilClient() ) {
- newuser.uflag |= UF_DBCSAWARE;
- } else {
- newuser.uflag &= ~UF_DBCSAWARE;
- }
-#endif
more("etc/register", NA);
try = 0;
diff --git a/pttbbs/mbbsd/user.c b/pttbbs/mbbsd/user.c
index 7336b436..6623c316 100644
--- a/pttbbs/mbbsd/user.c
+++ b/pttbbs/mbbsd/user.c
@@ -410,7 +410,7 @@ void Customize(void)
UF_NO_MODMARK ,
UF_COLORED_MODMARK,
#ifdef DBCSAWARE
- UF_DBCSAWARE,
+ UF_DBCS_AWARE,
UF_DBCS_DROP_REPEAT,
UF_DBCS_NOINTRESC,
#endif
@@ -1543,92 +1543,5 @@ u_list(void)
return 0;
}
-#ifdef DBCSAWARE
-
-/* detect if user is using an evil client that sends double
- * keys for DBCS data.
- * True if client is evil.
- */
-
-int u_detectDBCSAwareEvilClient()
-{
- int ret = 0;
-
- clear();
- vs_hdr("設定自動偵測雙位元字集 (全型中文)");
- move(2, 0);
- outs(ANSI_RESET
- "* 本站支援自動偵測中文字的移動與編輯,但有些連線程式 (如xxMan)\n"
- " 也會自行試圖偵測、多送按鍵,於是便會造成" ANSI_COLOR(1;37)
- "一次移動兩個中文字的現象。" ANSI_RESET "\n\n"
- "* 讓連線程式處理移動容易造成顯示及移動上誤判的問題,所以我們建議您\n"
- " 關閉該程式上的設定(通常叫「偵測(全型或雙位元組)中文」),\n"
- " 讓 BBS 系統可以正確的控制你的畫面。\n\n"
- ANSI_COLOR(1;33)
- "* 如果您看不懂上面的說明也無所謂,我們會自動偵測適合您的設定。"
- ANSI_RESET "\n"
- " 請在設定好連線程式成您偏好的模式後按" ANSI_COLOR(1;33)
- "一下" ANSI_RESET "您鍵盤上的" ANSI_COLOR(1;33)
- "←" ANSI_RESET "\n" ANSI_COLOR(1;36)
- " (左右方向鍵或寫 BS/Backspace 的倒退鍵與 Del 刪除鍵均可)\n"
- ANSI_RESET);
-
- /* clear buffer */
- peek_input(0.1, Ctrl('C'));
- drop_input();
-
- while (1)
- {
- int ch = 0;
-
- move(14, 0);
- outs("這是偵測區,您的游標會出現在"
- ANSI_REVERSE "這裡" ANSI_RESET);
- move(14, 15*2);
- ch = igetch();
- if(ch != KEY_LEFT && ch != KEY_RIGHT &&
- ch != KEY_BS && ch != KEY_BS2)
- {
- move(16, 0);
- bell();
- outs("請按一下上面指定的鍵! 你按到別的鍵了!");
- } else {
- move(16, 0);
- /* Actually you may also use num_in_buf here. those clients
- * usually sends doubled keys together in one packet.
- * However when I was writing this, a bug (existed for more than 3
- * years) of num_in_buf forced me to write new wait_input.
- * Anyway it is fixed now.
- */
- refresh();
- if(wait_input(0.1, 0))
- // if(igetch() == ch)
- // if (num_in_buf() > 0)
- {
- /* evil dbcs aware client */
- outs("偵測到您的連線程式會自行處理游標移動。\n"
- // "若日後因此造成瀏覽上的問題本站恕不處理。\n\n"
- "已設定為「讓您的連線程式處理游標移動」\n");
- ret = 1;
- } else {
- /* good non-dbcs aware client */
- outs("您的連線程式似乎不會多送按鍵,"
- "這樣 BBS 可以更精準的控制畫面。\n"
- "已設定為「讓 BBS 伺服器直接處理游標移動」\n");
- ret = 0;
- }
- outs( "\n若想改變設定請至 個人設定區 → 個人化設定 → \n"
- " 調整「自動偵測雙位元字集(如全型中文)」之設定");
- while(num_in_buf())
- igetch();
- break;
- }
- }
- drop_input();
- pressanykey();
- return ret;
-}
-#endif
-
/* vim:sw=4
*/