diff options
author | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-09 21:30:32 +0800 |
---|---|---|
committer | victor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2003-05-09 21:30:32 +0800 |
commit | 43c23212c73e8960fc1fdeb4849d327c28b3a5d9 (patch) | |
tree | fb496a57960085b970e46eb682f20cd2a6428284 | |
parent | ff3afd480dad5adc0404dc2a747508de95c5c32e (diff) | |
download | pttbbs-43c23212c73e8960fc1fdeb4849d327c28b3a5d9.tar pttbbs-43c23212c73e8960fc1fdeb4849d327c28b3a5d9.tar.gz pttbbs-43c23212c73e8960fc1fdeb4849d327c28b3a5d9.tar.bz2 pttbbs-43c23212c73e8960fc1fdeb4849d327c28b3a5d9.tar.lz pttbbs-43c23212c73e8960fc1fdeb4849d327c28b3a5d9.tar.xz pttbbs-43c23212c73e8960fc1fdeb4849d327c28b3a5d9.tar.zst pttbbs-43c23212c73e8960fc1fdeb4849d327c28b3a5d9.zip |
use another clear bits -_-
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@830 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | include/pttstruct.h | 11 | ||||
-rw-r--r-- | mbbsd/admin.c | 14 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 4 | ||||
-rw-r--r-- | mbbsd/user.c | 44 |
4 files changed, 43 insertions, 30 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h index 044704ad..80bbe7f3 100644 --- a/include/pttstruct.h +++ b/include/pttstruct.h @@ -1,4 +1,4 @@ -/* $Id: pttstruct.h,v 1.36 2003/05/09 07:44:48 victor Exp $ */ +/* $Id: pttstruct.h,v 1.37 2003/05/09 13:30:32 victor Exp $ */ #ifndef INCLUDE_STRUCT_H #define INCLUDE_STRUCT_H @@ -75,8 +75,7 @@ typedef struct userec_t { char mind[4]; char ident[11]; unsigned int uflag2; - char foreign; - char pad[71]; + char pad[72]; } userec_t; /* these are flags in userec_t.uflag */ #define SIG_FLAG 0x3 /* signature number, 2 bits */ @@ -95,10 +94,8 @@ typedef struct userec_t { #define WATERMODE(mode) ((cuser.uflag2 & WATER_MASK) == mode) #define FAVNOHILIGHT 0x10 /* false if hilight favorite */ #define FAVNEW_FLAG 0x20 /* true if add new board into one's fav */ - -/* these are flags in userec_t.foreign */ -#define FOREIGN 0x1 -#define LIVERIGHT 0x2 +#define FOREIGN 0x100 /* true if a foreign */ +#define LIVERIGHT 0x200 /* true if get "liveright" already */ #define BTLEN 48 /* Length of board title */ diff --git a/mbbsd/admin.c b/mbbsd/admin.c index 4b87f98a..d021c2f0 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -1,4 +1,4 @@ -/* $Id: admin.c,v 1.33 2003/05/09 07:43:57 victor Exp $ */ +/* $Id: admin.c,v 1.34 2003/05/09 13:30:32 victor Exp $ */ #include "bbs.h" /* 使用者管理 */ @@ -762,7 +762,6 @@ scan_register_form(char *regfile, int automode, int neednum) char fdata[7][STRLEN]; char fname[STRLEN], buf[STRLEN]; char ans[4], *ptr, *uid; - char foreign; int n = 0, unum = 0; int nSelf = 0, nAuto = 0; @@ -822,12 +821,11 @@ scan_register_form(char *regfile, int automode, int neednum) user_display(&muser, 1); move(14, 0); prints("\033[1;32m------------- 請站長嚴格審核使用者資料,您還有 %d 份---------------\033[m\n", neednum); - for (n = 0; field[n]; n++) { - if (n >= 2 && n <= 5) - prints("%d.", n - 2); - else - prints(" "); - prints("%-12s:%s\n", finfo[n], fdata[n]); + prints(" %-12s:%s\n", finfo[0], fdata[0]); + prints(" %-12s:%s\n", finfo[1], fdata[1]); + prints("1.%-12s:%s%s\n", finfo[n], fdata[n], muser.uflag2 & FOREIGN ? "外籍" : ""); + for (n = 3; field[n]; n++) { + prints("%d.%-12s:%s\n", n - 2, finfo[n], fdata[n]); } if (muser.userlevel & PERM_LOGINOK) { getdata(b_lines - 1, 0, "\033[1;32m此帳號已經完成註冊, " diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 77dc98e3..7fc41c85 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -1,4 +1,4 @@ -/* $Id: mbbsd.c,v 1.73 2003/05/09 07:53:55 victor Exp $ */ +/* $Id: mbbsd.c,v 1.74 2003/05/09 13:30:32 victor Exp $ */ #include "bbs.h" #define SOCKET_QLEN 4 @@ -884,7 +884,7 @@ user_login() if (!PERM_HIDE(currutmp)) cuser.lastlogin = login_start_time; - if (cuser.foreign & FOREIGN){ + if (cuser.uflag2 & (FOREIGN | LIVERIGHT)){ if (login_start_time - cuser.firstlogin > (FOREIGN_REG_DAY - 5) * 24 * 3600){ mail_muser(cuser, "[出入境管理局]", "etc/foreign_expired_warn"); } diff --git a/mbbsd/user.c b/mbbsd/user.c index 5568854b..58a67ef3 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -1,4 +1,4 @@ -/* $Id: user.c,v 1.53 2003/05/09 07:43:57 victor Exp $ */ +/* $Id: user.c,v 1.54 2003/05/09 13:30:32 victor Exp $ */ #include "bbs.h" static char *sex[8] = { @@ -51,12 +51,15 @@ user_display(userec_t * u, int real) " 資 料 " " \033[m \033[30;41m┴┬┴┬┴┬\033[m\n"); prints(" 代號暱稱: %s(%s)\n" - " 真實姓名: %s %s\n" + " 真實姓名: %s %s%s\n" " 居住住址: %s\n" " 電子信箱: %s\n" " 性 別: %s\n" " 銀行帳戶: %d 銀兩\n", - u->userid, u->username, u->realname, u->foreign & FOREIGN ? "(外籍)" : "", u->address, u->email, + u->userid, u->username, u->realname, + u->uflag2 & FOREIGN ? "(外籍: " : "", + u->uflag2 & LIVERIGHT ? "永久居留)" : "未取得居留權)", + u->address, u->email, sex[u->sex % 8], u->money); sethomedir(genbuf, u->userid); @@ -309,7 +312,7 @@ uinfo_query(userec_t * u, int real, int unum) if (real) { getdata_buf(i++, 0, "真實姓名:", x.realname, sizeof(x.realname), DOECHO); - getdata_buf(i++, 0, cuser.foreign & FOREIGN ? "護照號碼" : "身分證號:", + getdata_buf(i++, 0, cuser.uflag2 & FOREIGN ? "護照號碼" : "身分證號:", x.ident, sizeof(x.ident), DOECHO); getdata_buf(i++, 0, "居住地址:", x.address, sizeof(x.address), DOECHO); @@ -433,12 +436,26 @@ uinfo_query(userec_t * u, int real, int unum) x.chc_tie = atoi(p); break; } - if (getdata_str(i++, 0, "國籍 1)本國 2)外國:", buf, 2, DOECHO, x.foreign & FOREIGN ? "2" : "1")) - if ((fail = atoi(buf)) >= 0){ - if (fail == 0) - x.foreign |= FOREIGN; + if (getdata_str(i++, 0, "國籍 1)本國 2)外國:", buf, 2, DOECHO, x.uflag2 & FOREIGN ? "2" : "1")) + if ((fail = atoi(buf)) > 0){ + if (fail == 2){ + x.uflag2 |= FOREIGN; + } else - x.foreign &= ~FOREIGN; + x.uflag2 &= ~FOREIGN; + } + if (x.uflag2 & FOREIGN) + if (getdata_str(i++, 0, "永久居留權 1)是 2)否:", buf, 2, DOECHO, x.uflag2 & LIVERIGHT ? "1" : "2")){ + if ((fail = atoi(buf)) > 0){ + if (fail == 1){ + x.uflag2 |= LIVERIGHT; + x.userlevel |= (PERM_LOGINOK | PERM_POST); + } + else{ + x.uflag2 &= ~LIVERIGHT; + x.userlevel &= ~(PERM_LOGINOK | PERM_POST); + } + } } fail = 0; } @@ -1093,9 +1110,7 @@ int u_register(void) { char rname[21], addr[51], ident[12], mobile[21]; -//#ifdef FOREIGN_REG_DAY char fore[2]; -//#endif char phone[21], career[41], email[51], birthday[9], sex_is[2], year, mon, day; char inregcode[14], regcode[50]; @@ -1137,7 +1152,7 @@ u_register(void) if ((fn = fopen(genbuf, "r"))) { fgets(phone, 21, fn); if(strcmp(ident, "#foreign") == 0){ - fore[0] |= FOREIGN; + fore[0] = 'y'; fore[1] = '\n'; fgets(ident, 21, fn); } phone[strlen(phone) - 1] = 0; @@ -1317,7 +1332,10 @@ u_register(void) cuser.month = mon; cuser.day = day; cuser.year = year; - cuser.foreign = fore[0]; + if (fore[0]) + cuser.uflag2 |= FOREIGN; + else + cuser.uflag2 &= ~FOREIGN; trim(career); trim(addr); trim(phone); |