diff options
author | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-28 15:37:04 +0800 |
---|---|---|
committer | piaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2009-09-28 15:37:04 +0800 |
commit | 4621028ffd6a8acbc2bc76c528f11315812c7049 (patch) | |
tree | 6f0d3e255f4bb401ce06ad57d8c7226652fd3837 | |
parent | d0122a0edf93089c7a3897a899b26c8eeda4d311 (diff) | |
download | pttbbs-4621028ffd6a8acbc2bc76c528f11315812c7049.tar pttbbs-4621028ffd6a8acbc2bc76c528f11315812c7049.tar.gz pttbbs-4621028ffd6a8acbc2bc76c528f11315812c7049.tar.bz2 pttbbs-4621028ffd6a8acbc2bc76c528f11315812c7049.tar.lz pttbbs-4621028ffd6a8acbc2bc76c528f11315812c7049.tar.xz pttbbs-4621028ffd6a8acbc2bc76c528f11315812c7049.tar.zst pttbbs-4621028ffd6a8acbc2bc76c528f11315812c7049.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/pttbbs@4886 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | UPDATING | 5 | ||||
-rw-r--r-- | include/proto.h | 4 | ||||
-rw-r--r-- | include/uflags.h | 3 | ||||
-rw-r--r-- | mbbsd/edit.c | 2 | ||||
-rw-r--r-- | mbbsd/passwd.c | 2 | ||||
-rw-r--r-- | mbbsd/register.c | 17 | ||||
-rw-r--r-- | mbbsd/user.c | 89 |
7 files changed, 14 insertions, 108 deletions
@@ -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/include/proto.h b/include/proto.h index 3c2895a2..5acd4877 100644 --- a/include/proto.h +++ b/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/include/uflags.h b/include/uflags.h index 8f71c05b..532138c0 100644 --- a/include/uflags.h +++ b/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/mbbsd/edit.c b/mbbsd/edit.c index 2dd23eee..f39280d4 100644 --- a/mbbsd/edit.c +++ b/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/mbbsd/passwd.c b/mbbsd/passwd.c index 46734d8b..836798d4 100644 --- a/mbbsd/passwd.c +++ b/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/mbbsd/register.c b/mbbsd/register.c index c521a8cc..81d13cd0 100644 --- a/mbbsd/register.c +++ b/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/mbbsd/user.c b/mbbsd/user.c index 7336b436..6623c316 100644 --- a/mbbsd/user.c +++ b/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 */ |