diff options
author | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-05-07 21:28:18 +0800 |
---|---|---|
committer | scw <scw@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2004-05-07 21:28:18 +0800 |
commit | ab887ca36d723e3586660e5d0129b2c0bf230df8 (patch) | |
tree | 9d67b25463c81d52df3ad9bf8cfe929c860cd207 | |
parent | 65444f711e64a233e3a12ffc1afa6a416f6b85e3 (diff) | |
download | pttbbs-ab887ca36d723e3586660e5d0129b2c0bf230df8.tar pttbbs-ab887ca36d723e3586660e5d0129b2c0bf230df8.tar.gz pttbbs-ab887ca36d723e3586660e5d0129b2c0bf230df8.tar.bz2 pttbbs-ab887ca36d723e3586660e5d0129b2c0bf230df8.tar.lz pttbbs-ab887ca36d723e3586660e5d0129b2c0bf230df8.tar.xz pttbbs-ab887ca36d723e3586660e5d0129b2c0bf230df8.tar.zst pttbbs-ab887ca36d723e3586660e5d0129b2c0bf230df8.zip |
Move PERM_NOOUTMAIL from userec_t.userlevel to userec_t.uflag2
and fill the space with PERM_ANGEL.
git-svn-id: http://opensvn.csie.org/pttbbs/branches/scw.angel@1929 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/perm.h | 7 | ||||
-rw-r--r-- | include/pttstruct.h | 3 | ||||
-rw-r--r-- | mbbsd/mail.c | 6 | ||||
-rw-r--r-- | mbbsd/menu.c | 3 | ||||
-rw-r--r-- | mbbsd/user.c | 27 | ||||
-rw-r--r-- | mbbsd/var.c | 2 | ||||
-rw-r--r-- | util/AngelConvert.c | 36 | ||||
-rw-r--r-- | util/bbsmail.c | 2 |
8 files changed, 75 insertions, 11 deletions
diff --git a/include/perm.h b/include/perm.h index 02c03d0f..d2788a59 100644 --- a/include/perm.h +++ b/include/perm.h @@ -20,7 +20,12 @@ #define PERM_BBSADM 000000100000 /* BBSADM */ #define PERM_NOTOP 000000200000 /* 不列入排行榜 */ #define PERM_VIOLATELAW 000000400000 /* 違法通緝中 */ -#define PERM_NOOUTMAIL 000001000000 /* 不接受站外的信 */ + +#ifdef PLAY_ANGEL +#define PERM_ANGEL 000001000000 /* 有資格擔任小天使 */ +#endif +#define OLD_PERM_NOOUTMAIL 000001000000 /* 不接受站外的信 */ + #define PERM_NOREGCODE 000002000000 /*不允許認證碼註冊*/ #define PERM_VIEWSYSOP 000004000000 /* 視覺站長 */ #define PERM_LOGUSER 000010000000 /* 觀察使用者行蹤 */ diff --git a/include/pttstruct.h b/include/pttstruct.h index 80cef86c..89135e89 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -119,6 +119,9 @@ typedef struct userec_t { #define FAVNEW_FLAG 0x20 /* true if add new board into one's fav */ #define FOREIGN 0x100 /* true if a foreign */ #define LIVERIGHT 0x200 /* true if get "liveright" already */ +#define REJ_OUTTAMAIL 0x400 /* true if don't accept outside mails */ +#define REJECT_OUTTAMAIL (cuser.uflag2 & REJ_OUTTAMAIL) +#define BEING_ANGEL 0x1000 /* true if willing to be angel */ #define BTLEN 48 /* Length of board title */ diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 6c0ae7c7..f3e7a855 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -816,7 +816,7 @@ mailtitle() prints("[←]離開[↑↓]選擇[→]閱\讀信件 [R]回信 [x]轉達 " "[y]群組回信 [O]站外信:%s [h]求助\n\033[7m" "編號 日 期 作 者 信 件 標 題 \033[32m", - HAS_PERM(PERM_NOOUTMAIL) ? "\033[31m關\033[m" : "開"); + REJECT_OUTTAMAIL ? "\033[31m關\033[m" : "開"); buf[0] = 0; if (mailsumlimit) { snprintf(buf, sizeof(buf), @@ -1038,7 +1038,7 @@ mail_edit(int ent, fileheader_t * fhdr, char *direct) static int mail_nooutmail(int ent, fileheader_t * fhdr, char *direct) { - cuser.userlevel ^= PERM_NOOUTMAIL; + cuser.uflag2 ^= REJ_OUTTAMAIL; passwd_update(usernum, &cuser); return TITLE_REDRAW; @@ -1307,7 +1307,7 @@ mail_waterball(int ent, fileheader_t * fhdr, char *direct) } if (invalidaddr(address)) return -2; - if( strstr(address, ".bbs") && HAS_PERM(PERM_NOOUTMAIL) ){ + if( strstr(address, ".bbs") && REJECT_OUTTAMAIL ){ move(b_lines - 4, 0); outs("\n您必須要打開接受站外信, 水球整理系統才能寄入結果\n" "請麻煩到【郵件選單】按大寫 O改成接受站外信 (在右上角)\n" diff --git a/mbbsd/menu.c b/mbbsd/menu.c index 5f8276b8..9e39ae1d 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -363,6 +363,9 @@ static commands_t talklist[] = { {t_talk, PERM_PAGE, "TTalk 找人聊聊"}, {t_chat, PERM_CHAT, "CChat 找家茶坊喫茶去"}, {t_display, 0, "DDisplay 顯示上幾次熱訊"}, +#ifdef PLAY_ANGEL + {t_changeangel, PERM_BASIC, "CChange Angel 更換小天使"}, +#endif {NULL, 0, NULL} }; diff --git a/mbbsd/user.c b/mbbsd/user.c index 4a531d10..8ca757f7 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -229,15 +229,23 @@ static void Customize(void) move(4, 0); prints("%-30s%10s\n", "A. 水球模式", wm[(cuser.uflag2 & WATER_MASK)]); - prints("%-30s%10s\n", "B. 接受站外信", - ((cuser.userlevel & PERM_NOOUTMAIL) ? "否" : "是")); + prints("%-30s%10s\n", "B. 接受站外信", REJECT_OUTTAMAIL ? "否" : "是"); prints("%-30s%10s\n", "C. 新板自動進我的最愛", ((cuser.uflag2 & FAVNEW_FLAG) ? "是" : "否")); prints("%-30s%10s\n", "D. 目前的心情", mindbuf); prints("%-30s%10s\n", "E. 高亮度顯示我的最愛", ((cuser.uflag2 & FAVNOHILIGHT) ? "否" : "是")); - getdata(b_lines - 1, 0, "請按 [A-E] 切換設定,按 [Return] 結束:", - ans, 3, DOECHO); +#ifdef PLAY_ANGEL + if( HAS_PERM(PERM_ANGEL) ){ + prints("%-30s%10s\n", "F. 接受小主人詢問", + ((cuser.uflag2 & BEING_ANGEL) ? "是" : "否")); + getdata(b_lines - 1, 0, "請按 [A-F] 切換設定,按 [Return] 結束:", + ans, 3, DOECHO); + }else +#else + getdata(b_lines - 1, 0, "請按 [A-E] 切換設定,按 [Return] 結束:", + ans, 3, DOECHO); +#endif switch( ans[0] ){ case 'A': @@ -251,8 +259,9 @@ static void Customize(void) break; case 'B': case 'b': - cuser.userlevel ^= PERM_NOOUTMAIL; + cuser.uflag2 ^= REJ_OUTTAMAIL; break; + case 'C': case 'c': cuser.uflag2 ^= FAVNEW_FLAG; @@ -275,6 +284,14 @@ static void Customize(void) case 'e': cuser.uflag2 ^= FAVNOHILIGHT; break; +#ifdef PLAY_ANGEL + case 'F': + case 'f': + if( HAS_PERM(PERM_ANGEL) ){ + cuser.uflag2 ^= BEING_ANGEL; + break; + } +#endif default: done = 1; } diff --git a/mbbsd/var.c b/mbbsd/var.c index c9347b20..f3179f37 100644 --- a/mbbsd/var.c +++ b/mbbsd/var.c @@ -21,7 +21,7 @@ char *str_permid[] = { "BBSADM", /* PERM_POSTMARK */ "不列入排行榜", /* PERM_NOTOP */ "違法通緝中", /* PERM_VIOLATELAW */ - "不接受站外的信", /* PERM_ */ + "可擔任小天使", /* PERM_ANGEL */ "不允許\認證碼註冊", /* PERM_NOREGCODE */ "視覺站長", /* PERM_VIEWSYSOP */ "觀察使用者行蹤", /* PERM_LOGUSER */ diff --git a/util/AngelConvert.c b/util/AngelConvert.c new file mode 100644 index 00000000..94c42cb4 --- /dev/null +++ b/util/AngelConvert.c @@ -0,0 +1,36 @@ +#include "bbs.h" + +int main(){ + int i; + int orig_fd, new_fd; + userec_t u; + int count = 0; + + orig_fd = open(BBSHOME "/.PASSWD", O_RDONLY); + if( orig_fd < 0 ){ + perror("opening " BBSHOME "/.PASSWD for reading"); + return 1; + } + printf("Reading from " BBSHOME "/.PASSWD\n"); + + new_fd = open(BBSHOME "/PASSWD.NEW", O_WRONLY); + if( new_fd < 0 ){ + perror("opening " BBSHOME "/PASSWD.NEW for writing"); + return 1; + } + printf("Writing to " BBSHOME "/PASSWD.NEW\n"); + + while(read(orig_fd, &u, sizeof(userec_t)) == sizeof(userec_t)){ + u.uflag2 &= 0x03ff; // clear 0x400 and 0x1000 + if( u.userlevel & OLD_PERM_NOOUTMAIL ) + u.uflag2 |= REJ_OUTTAMAIL; + u.userlevel &= ~PERM_ANGEL; + write(new_fd, &u, sizeof(userec_t)); + ++count; + } + + close(orig_fd); + close(new_fd); + printf("Done, totally %d accounts transfered\n", count); + return 0; +} diff --git a/util/bbsmail.c b/util/bbsmail.c index a58d5763..dd015099 100644 --- a/util/bbsmail.c +++ b/util/bbsmail.c @@ -93,7 +93,7 @@ int mail2bbs(char *userid) return -1;//EX_NOUSER; } - if( xuser.userlevel & PERM_NOOUTMAIL ) + if( xuser.uflag2 & REJ_OUTTAMAIL ) return -1; //不接受站外信 sprintf(filename, BBSHOME "/home/%c/%s", userid[0], userid); |