From e12b8fb5f87d5bede1af88074cd6c85be93b121c Mon Sep 17 00:00:00 2001 From: piaip Date: Mon, 17 Dec 2007 01:57:04 +0000 Subject: - optimize big I formatting - disable mail pre-check permission until someone fix it git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3697 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- mbbsd/bbs.c | 47 +-------------- mbbsd/board.c | 179 +++++++++++++++++++++++++++------------------------------- mbbsd/mail.c | 6 +- 3 files changed, 89 insertions(+), 143 deletions(-) (limited to 'mbbsd') diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index 0744ad7c..e58e3909 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -3,24 +3,9 @@ #ifdef EDITPOST_SMARTMERGE -#ifdef SMARTMERGE_MD5 - -// To enable SmartMerge/MD5, -// please get MD5 from XySSL or other systems: -// http://xyssl.org/code/source/md5/ -#include "md5.h" -#include "md5.c" - -#define SMHASHLEN (16) - -#else // !SMARTMERGE_MD5, use FNV64 - #include "fnv_hash.h" - #define SMHASHLEN (64/8) -#endif // !SMARTMERGE_MD5 - #endif // EDITPOST_SMARTMERGE #define WHEREAMI_LEVEL 16 @@ -1308,18 +1293,9 @@ hash_partial_file( char *path, size_t sz, unsigned char output[SMHASHLEN] ) size_t n; unsigned char buf[1024]; -#ifdef SMARTMERGE_MD5 - - md5_context ctx; - md5_starts( &ctx ); - -#else // !SMARTMERGE_MD5, use FNV64 - Fnv64_t fnvseed = FNV1_64_INIT; assert(SMHASHLEN == sizeof(fnvseed)); -#endif // SMARTMERGE_MD5 - fd = open(path, O_RDONLY); if (fd < 0) return 1; @@ -1328,13 +1304,7 @@ hash_partial_file( char *path, size_t sz, unsigned char output[SMHASHLEN] ) (n = read(fd, buf, sizeof(buf))) > 0 ) { if (n > sz) n = sz; - -#ifdef SMARTMERGE_MD5 - md5_update( &ctx, buf, (int) n ); -#else // !SMARTMERGE_MD5, use FNV64 fnvseed = fnv_64_buf(buf, (int) n, fnvseed); -#endif //!SMARTMERGE_MD5 - sz -= n; } close(fd); @@ -1342,12 +1312,7 @@ hash_partial_file( char *path, size_t sz, unsigned char output[SMHASHLEN] ) if (sz > 0) // file is different return 2; -#ifdef SMARTMERGE_MD5 - md5_finish( &ctx, output ); -#else // !SMARTMERGE_MD5, use FNV64 memcpy(output, (void*) &fnvseed, sizeof(fnvseed)); -#endif //!SMARTMERGE_MD5 - return HASHPF_RET_OK; } #endif // EDITPOST_SMARTMERGE @@ -3262,16 +3227,6 @@ b_notes_edit(void) return 0; } -static int -can_vote_edit(void) -{ - if (currmode & MODE_BOARD) { - friend_edit(FRIEND_CANVOTE); - return FULLUPDATE; - } - return 0; -} - static int bh_title_edit(void) { @@ -3637,7 +3592,7 @@ const onekey_t read_comms[] = { { 0, NULL }, // 'l' { 1, mark_post }, // 'm' { 0, NULL }, // 'n' - { 0, can_vote_edit }, // 'o' + { 0, b_moved_to_config }, // 'o' { 0, NULL }, // 'p' { 0, NULL }, // 'q' { 1, read_post }, // 'r' diff --git a/mbbsd/board.c b/mbbsd/board.c index 09a4f2a5..74ba0e59 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -178,56 +178,38 @@ HasBoardPerm(boardheader_t *bptr) } // board configuration utilities -static int -b_visible_edit(void) -{ - if (currmode & MODE_BOARD) { - friend_edit(BOARD_VISABLE); - assert(0<=currbid-1 && currbid-1posttype_f; for( i = 0 ; i < 8 ; ++i ){ - move(2,0); + move(2+i,0); outs("文章種類: "); strlcpy(genbuf, bp->posttype + i * 4, 5); sprintf(title, "%d.", i + 1); - if( !getdata_buf(2, 11, title, genbuf, 5, DOECHO) ) + if( !getdata_buf(2+i, 11, title, genbuf, 5, DOECHO) ) break; sprintf(posttype + i * 4, "%-4.4s", genbuf); if( posttype_f & (1<title); prints(" 板主名單: %s\n", (bp->BM[0] > ' ')? bp->BM : "(無)"); - outs("\n"); + outs(" \n"); // at least one character, for move_ansi. prints( " " ANSI_COLOR(1;36) "h" ANSI_RESET " - 公開狀態(是否隱形): %s " ANSI_RESET "\n", @@ -383,7 +370,7 @@ b_config(void) ); #endif - prints( " " ANSI_COLOR(1;36) "o" ANSI_RESET + prints( " " ANSI_COLOR(1;36) "L" ANSI_RESET " - 若有轉信則發文時預設 %s " ANSI_RESET "\n", (bp->brdattr & BRD_LOCALSAVE) ? "站內存檔(不轉出)" : ANSI_COLOR(1)"站際存檔(轉出)" ); @@ -405,16 +392,9 @@ b_config(void) (bp->brdattr & BRD_RESTRICTEDPOST) ? ANSI_COLOR(1)"只有板友才可發文" : "無特別設定" ); - prints("\n " ANSI_COLOR(1;32) "名單編輯與其它:" ANSI_RESET " " - ANSI_COLOR(1;36) "v" ANSI_RESET ")可見名單 " - ANSI_COLOR(1;36) "w" ANSI_RESET ")水桶名單 " - ANSI_COLOR(1;36) "n" ANSI_RESET ")發文注意事項 " - ANSI_COLOR(1;36) "c" ANSI_RESET ")文章類別 " - "\n"); - ipostres = b_lines - LNPOSTRES; move_ansi(ipostres++, COLPOSTRES-2); - prints("發文限制"); + outs(ANSI_COLOR(1;32) "發文限制" ANSI_RESET); #define POSTRESTRICTION(msg,utag) \ prints(msg, attr ? ANSI_COLOR(1) : "", i, attr ? ANSI_RESET : "") @@ -461,8 +441,24 @@ b_config(void) ); } + // if (isBM) + { + ipostres ++; + move_ansi(ipostres++, COLPOSTRES-2); + outs(ANSI_COLOR(1;32) "名單編輯與其它:" ANSI_RESET); + move_ansi(ipostres++, COLPOSTRES); + outs(ANSI_COLOR(1;36) "v" ANSI_RESET ")可見名單 " + ANSI_COLOR(1;36) "w" ANSI_RESET ")水桶名單 "); + move_ansi(ipostres++, COLPOSTRES); + outs(ANSI_COLOR(1;36) "o" ANSI_RESET ")投票名單 "); + //ANSI_COLOR(1;36) "w" ANSI_RESET ")水桶名單 "); + move_ansi(ipostres++, COLPOSTRES); + outs(ANSI_COLOR(1;36) "c" ANSI_RESET ")文章類別 " + ANSI_COLOR(1;36) "n" ANSI_RESET ")發文注意事項 "); + } + move(b_lines, 0); - if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) + if (!isBM) { vmsg("您對此板無管理權限"); return FULLUPDATE; @@ -476,7 +472,7 @@ b_config(void) touched = 1; break; #endif - case 'o': + case 'l': bp->brdattr ^= BRD_LOCALSAVE; touched = 1; break; @@ -580,43 +576,34 @@ b_config(void) break; case 'v': - if (currmode & MODE_BOARD) - { - b_visible_edit(); - clear(); - } else { - vmsg("此項設定需要板主權限"); - } + clear(); + friend_edit(BOARD_VISABLE); + assert(0<=currbid-1 && currbid-1