diff options
-rw-r--r-- | include/perm.h | 2 | ||||
-rw-r--r-- | include/proto.h | 2 | ||||
-rw-r--r-- | mbbsd/admin.c | 24 | ||||
-rw-r--r-- | mbbsd/announce.c | 14 | ||||
-rw-r--r-- | mbbsd/bbs.c | 62 | ||||
-rw-r--r-- | mbbsd/board.c | 72 | ||||
-rw-r--r-- | mbbsd/cache.c | 14 | ||||
-rw-r--r-- | mbbsd/cal.c | 4 | ||||
-rw-r--r-- | mbbsd/chat.c | 2 | ||||
-rw-r--r-- | mbbsd/edit.c | 4 | ||||
-rw-r--r-- | mbbsd/fav.c | 6 | ||||
-rw-r--r-- | mbbsd/indict.c | 4 | ||||
-rw-r--r-- | mbbsd/mail.c | 22 | ||||
-rw-r--r-- | mbbsd/mbbsd.c | 8 | ||||
-rw-r--r-- | mbbsd/menu.c | 16 | ||||
-rw-r--r-- | mbbsd/more.c | 2 | ||||
-rw-r--r-- | mbbsd/name.c | 8 | ||||
-rw-r--r-- | mbbsd/pmore.c | 2 | ||||
-rw-r--r-- | mbbsd/read.c | 4 | ||||
-rw-r--r-- | mbbsd/register.c | 4 | ||||
-rw-r--r-- | mbbsd/stuff.c | 4 | ||||
-rw-r--r-- | mbbsd/talk.c | 76 | ||||
-rw-r--r-- | mbbsd/user.c | 44 | ||||
-rw-r--r-- | mbbsd/vote.c | 2 | ||||
-rw-r--r-- | mbbsd/voteboard.c | 2 | ||||
-rw-r--r-- | util/buildir.c | 1 | ||||
-rw-r--r-- | util/checkdir.c | 2 | ||||
-rw-r--r-- | util/checkmoney.c | 2 | ||||
-rw-r--r-- | util/chkhbf.c | 2 | ||||
-rw-r--r-- | util/cleanpasswd.c | 2 | ||||
-rw-r--r-- | util/gamblegive.c | 2 | ||||
-rw-r--r-- | util/merge_dir.c | 2 | ||||
-rw-r--r-- | util/transman.c | 2 |
33 files changed, 210 insertions, 209 deletions
diff --git a/include/perm.h b/include/perm.h index 9f88bf96..e129a991 100644 --- a/include/perm.h +++ b/include/perm.h @@ -52,7 +52,7 @@ #define PERM_FORWARD (PERM_BASIC) /* to do the forwarding */ #define PERM_INTERNET (PERM_LOGINOK) /* 身份認證過關的才能寄信到 Internet */ -#define HAS_PERM(x) ((x) ? cuser.userlevel & (x) : 1) +#define HasUserPerm(x) ((x) ? cuser.userlevel & (x) : 1) #define HAVE_PERM(x) (cuser.userlevel&(x)) #define PERM_HIDE(u) (u && (u)->userlevel & PERM_SYSOPHIDE) diff --git a/include/proto.h b/include/proto.h index e92082c7..4f9b179d 100644 --- a/include/proto.h +++ b/include/proto.h @@ -86,7 +86,7 @@ int check_cooldown(boardheader_t *bp); /* board */ #define setutmpbid(bid) currutmp->brc_id=bid; -int HasPerm(boardheader_t *bptr); +int HasBoardPerm(boardheader_t *bptr); int New(void); int Boards(void); int root_board(void); diff --git a/mbbsd/admin.c b/mbbsd/admin.c index 77c75a27..ae543d33 100644 --- a/mbbsd/admin.c +++ b/mbbsd/admin.c @@ -416,14 +416,14 @@ m_mod_board(char *bname) /* Ptt 這邊斷行會檔到下面 */ move(9, 0); snprintf(genbuf, sizeof(genbuf), "(E)設定 (V)違法/解除%s%s [Q]取消?", - HAS_PERM(PERM_SYSOP | + HasUserPerm(PERM_SYSOP | PERM_BOARD) ? " (B)Vote (S)救回 (C)合併 (G)賭盤解卡" : "", - HAS_PERM(PERM_SYSSUBOP | PERM_BOARD) ? " (D)刪除" : ""); + HasUserPerm(PERM_SYSSUBOP | PERM_BOARD) ? " (D)刪除" : ""); getdata(10, 0, genbuf, ans, 3, LCECHO); switch (*ans) { case 'g': - if (HAS_PERM(PERM_SYSOP | PERM_BOARD)) { + if (HasUserPerm(PERM_SYSOP | PERM_BOARD)) { char path[256]; setbfile(genbuf, bname, FN_TICKET_LOCK); setbfile(path, bname, FN_TICKET_END); @@ -431,7 +431,7 @@ m_mod_board(char *bname) } break; case 's': - if (HAS_PERM(PERM_SYSOP | PERM_BOARD)) { + if (HasUserPerm(PERM_SYSOP | PERM_BOARD)) { snprintf(genbuf, sizeof(genbuf), BBSHOME "/bin/buildir boards/%c/%s &", bh.brdname[0], bh.brdname); @@ -439,7 +439,7 @@ m_mod_board(char *bname) } break; case 'c': - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { char frombname[20], fromdir[256]; #ifdef MERGEBBS if(getans("是否匯入SOB看板? (y/N)")=='y') @@ -465,7 +465,7 @@ m_mod_board(char *bname) } break; case 'b': - if (HAS_PERM(PERM_SYSOP | PERM_BOARD)) { + if (HasUserPerm(PERM_SYSOP | PERM_BOARD)) { char bvotebuf[10]; memcpy(&newbh, &bh, sizeof(bh)); @@ -496,7 +496,7 @@ m_mod_board(char *bname) } break; case 'd': - if (!HAS_PERM(PERM_SYSOP | PERM_BOARD)) + if (!HasUserPerm(PERM_SYSOP | PERM_BOARD)) break; getdata_str(9, 0, msg_sure_ny, genbuf, 3, LCECHO, "N"); if (genbuf[0] != 'y' || !bname[0]) @@ -559,7 +559,7 @@ m_mod_board(char *bname) strlcpy(newbh.BM, genbuf, sizeof(newbh.BM)); } #ifdef CHESSCOUNTRY - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { snprintf(genbuf, sizeof(genbuf), "%d", bh.chesscountry); if (getdata_str(16, 0, "設定棋國 (0)無 (1)五子棋 (2)象棋", ans, sizeof(ans), LCECHO, genbuf)){ @@ -570,7 +570,7 @@ m_mod_board(char *bname) } } #endif /* defined(CHESSCOUNTRY) */ - if (HAS_PERM(PERM_SYSOP|PERM_BOARD)) { + if (HasUserPerm(PERM_SYSOP|PERM_BOARD)) { move(1, 0); clrtobot(); newbh.brdattr = setperms(newbh.brdattr, str_permboard); @@ -584,7 +584,7 @@ m_mod_board(char *bname) else strncpy(newbh.title + 5, "●", 2); - if (HAS_PERM(PERM_SYSOP|PERM_BOARD) && !(newbh.brdattr & BRD_HIDE)) { + if (HasUserPerm(PERM_SYSOP|PERM_BOARD) && !(newbh.brdattr & BRD_HIDE)) { getdata_str(14, 0, "設定讀寫權限(Y/N)?", ans, sizeof(ans), LCECHO, "N"); if (*ans == 'y') { getdata_str(15, 0, "限制 [R]閱\讀 (P)發表?", ans, sizeof(ans), LCECHO, @@ -848,7 +848,7 @@ m_newbrd(int whatclass, int recover) } newboard.brdattr = BRD_NOTRAN; - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { move(1, 0); clrtobot(); newboard.brdattr = setperms(newboard.brdattr, str_permboard); @@ -878,7 +878,7 @@ m_newbrd(int whatclass, int recover) } #endif /* defined(CHESSCOUNTRY) */ - if (HAS_PERM(PERM_SYSOP) && !(newboard.brdattr & BRD_HIDE)) { + if (HasUserPerm(PERM_SYSOP) && !(newboard.brdattr & BRD_HIDE)) { getdata_str(14, 0, "設定讀寫權限(Y/N)?", ans, sizeof(ans), LCECHO, "N"); if (*ans == 'y') { getdata_str(15, 0, "限制 [R]閱\讀 (P)發表?", ans, sizeof(ans), LCECHO, "R"); diff --git a/mbbsd/announce.c b/mbbsd/announce.c index 27dc373e..950a907d 100644 --- a/mbbsd/announce.c +++ b/mbbsd/announce.c @@ -278,7 +278,7 @@ a_newitem(menu_t * pm, int mode) strlcpy(item.title, "★ ", sizeof(item.title)); /* A1B4 */ break; } - if (!HAS_PERM(PERM_BBSADM) && d == 1) + if (!HasUserPerm(PERM_BBSADM) && d == 1) break; } @@ -681,7 +681,7 @@ a_showname(const menu_t * pm) buf[len] = '\0'; for (i = 0; BBSHOME[i] && buf[i] == BBSHOME[i]; i++); if (!BBSHOME[i] && buf[i] == '/') { - if (HAS_PERM(PERM_BBSADM)) + if (HasUserPerm(PERM_BBSADM)) sym = 1; else { sym = 0; @@ -865,7 +865,7 @@ a_menu(const char *maintitle, char *path, int lastlevel, char *trans_buffer) 還是檔案竟然是用 fstat(2) 而不是直接存在 .DIR 內 |||b 須等該資料寫入 .DIR 內再 implement才有效率. */ - if( !lastlevel && !HAS_PERM(PERM_SYSOP) && + if( !lastlevel && !HasUserPerm(PERM_SYSOP) && !is_BM_cache(currbid) && dashd(fname) ) vmsg("只有板主才可以拷貝目錄唷!"); else @@ -954,7 +954,7 @@ a_menu(const char *maintitle, char *path, int lastlevel, char *trans_buffer) case 'U': snprintf(fname, sizeof(fname), "%s/%s", path, me.header[me.now - me.page].filename); - if (me.now < me.num && HAS_PERM(PERM_LOGINOK) && dashf(fname)) { + if (me.now < me.num && HasUserPerm(PERM_LOGINOK) && dashf(fname)) { a_forward(path, &me.header[me.now - me.page], ch /* == 'U' */ ); /* By CharlieL */ } else @@ -965,7 +965,7 @@ a_menu(const char *maintitle, char *path, int lastlevel, char *trans_buffer) #ifdef BLOG case 'b': - if( !HAS_PERM(PERM_SYSOP) && !is_BM_cache(currbid) ) + if( !HasUserPerm(PERM_SYSOP) && !is_BM_cache(currbid) ) vmsg("只有板主才可以用唷!"); else{ char genbuf[128]; @@ -978,7 +978,7 @@ a_menu(const char *maintitle, char *path, int lastlevel, char *trans_buffer) break; case 'B': - if( !HAS_PERM(SYSOP) && !is_BM_cache(currbid) ) + if( !HasUserPerm(SYSOP) && !is_BM_cache(currbid) ) vmsg("只有板主才可以用唷!"); else BlogMain(me.now); @@ -1077,7 +1077,7 @@ Announce(void) { setutmpmode(ANNOUNCE); a_menu(mytitle, "man", - ((HAS_PERM(PERM_SYSOP) ) ? SYSOP : NOBODY), + ((HasUserPerm(PERM_SYSOP) ) ? SYSOP : NOBODY), NULL); return 0; } diff --git a/mbbsd/bbs.c b/mbbsd/bbs.c index e9b66a0f..de7383db 100644 --- a/mbbsd/bbs.c +++ b/mbbsd/bbs.c @@ -100,13 +100,13 @@ set_board(void) boardheader_t *bp; bp = getbcache(currbid); - if( !HasPerm(bp) ){ + if( !HasBoardPerm(bp) ){ vmsg("access control violation, exit"); u_exit("access control violation!"); exit(-1); } - if( HAS_PERM(PERM_SYSOP) && + if( HasUserPerm(PERM_SYSOP) && (bp->brdattr & BRD_HIDE) && !is_BM_cache(bp - bcache + 1) && hbflcheck((int)(bp - bcache) + 1, currutmp->uid) ) @@ -129,8 +129,8 @@ set_board(void) /* init basic perm, but post perm is checked on demand */ currmode = (currmode & (MODE_DIRTY | MODE_GROUPOP)) | MODE_STARTED; - if (!HAS_PERM(PERM_NOCITIZEN) && - (HAS_PERM(PERM_ALLBOARD) || is_BM_cache(currbid))) { + if (!HasUserPerm(PERM_NOCITIZEN) && + (HasUserPerm(PERM_ALLBOARD) || is_BM_cache(currbid))) { currmode = currmode | MODE_BOARD | MODE_POST | MODE_POSTCHECKED; } } @@ -167,7 +167,7 @@ readtitle(void) prints("[←]離開 [→]閱\讀 [^P]發表文章 [b]備忘錄 [d]刪除 [z]精華區 " "[TAB]文摘 [h]elp\n" ANSI_COLOR(7) " 編號 日 期 作 者 文 章 標 題"); #ifdef USE_COOLDOWN - if (bp->brdattr & BRD_COOLDOWN && !((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) + if (bp->brdattr & BRD_COOLDOWN && !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) prints(" " ANSI_RESET); else #endif @@ -184,7 +184,7 @@ readdoent(int num, fileheader_t * ent) type = brc_unread(ent->filename, brc_num, brc_list) ? '+' : ' '; if ((currmode & MODE_BOARD) && (ent->filemode & FILE_DIGEST)) type = (type == ' ') ? '*' : '#'; - else if (currmode & MODE_BOARD || HAS_PERM(PERM_LOGINOK)) { + else if (currmode & MODE_BOARD || HasUserPerm(PERM_LOGINOK)) { if (ent->filemode & FILE_MARKED) { if(ent->filemode & FILE_SOLVED) @@ -303,7 +303,7 @@ do_select(int ent, const fileheader_t * fhdr, const char *direct) if (bname[0] == '\0' || !(i = getbnum(bname))) return FULLUPDATE; bh = getbcache(i); - if (!HasPerm(bh)) + if (!HasBoardPerm(bh)) return FULLUPDATE; strlcpy(bname, bh->brdname, sizeof(bname)); brc_update(); @@ -548,7 +548,7 @@ do_general(int isbid) } #ifndef DEBUG - if ( !((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP)) && + if ( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) && (cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) || cuser.numlogins < ((unsigned int)(bcache[currbid - 1].post_limit_logins) * 10) || cuser.numposts < ((unsigned int)(bcache[currbid - 1].post_limit_posts) * 10)) ) { @@ -621,7 +621,7 @@ do_general(int isbid) setutmpmode(POSTING); /* 未具備 Internet 權限者,只能在站內發表文章 */ /* 板主預設站內存檔 */ - if (HAS_PERM(PERM_INTERNET) && !(bp->brdattr & BRD_LOCALSAVE)) + if (HasUserPerm(PERM_INTERNET) && !(bp->brdattr & BRD_LOCALSAVE)) local_article = 0; else local_article = 1; @@ -807,7 +807,7 @@ do_generalboardreply(const fileheader_t * fhdr) { char genbuf[3]; - if ( !((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP)) && + if ( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) && (cuser.firstlogin > (now - (time4_t)bcache[currbid - 1].post_limit_regtime * 2592000) || cuser.numlogins < ((unsigned int)(bcache[currbid - 1].post_limit_logins) * 10) || cuser.numposts < ((unsigned int)(bcache[currbid - 1].post_limit_posts) * 10)) ) { @@ -965,11 +965,11 @@ edit_post(int ent, fileheader_t * fhdr, const char *direct) if (fhdr->filemode&FILE_BOTTOM && strcmp(bp->brdname, "Security") == 0) return DONOTHING; - if (!HAS_PERM(PERM_SYSOP) && + if (!HasUserPerm(PERM_SYSOP) && ((bp->brdattr & BRD_VOTEBOARD) || fhdr->filemode & FILE_VOTE)) return DONOTHING; - if( !HAS_PERM(PERM_SYSOP) && + if( !HasUserPerm(PERM_SYSOP) && (!CheckPostPerm() || strcmp(fhdr->owner, cuser.userid) != 0) ) return DONOTHING; @@ -1044,7 +1044,7 @@ cross_post(int ent, const fileheader_t * fhdr, const char *direct) postrecord.checksum[0] = ent; } - if ( !((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP)) && + if ( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) && (cuser.firstlogin > (now - (time4_t)bcache[author - 1].post_limit_regtime * 2592000) || cuser.numlogins < ((unsigned int)(bcache[author - 1].post_limit_logins) * 10) || cuser.numposts < ((unsigned int)(bcache[author - 1].post_limit_posts) * 10)) ) { @@ -1060,7 +1060,7 @@ cross_post(int ent, const fileheader_t * fhdr, const char *direct) ent = 1; author = 0; - if (HAS_PERM(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) { + if (HasUserPerm(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) { getdata(2, 0, "(1)原文轉載 (2)舊轉錄格式?[1] ", genbuf, 3, DOECHO); if (genbuf[0] != '2') { @@ -1189,11 +1189,11 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct) int temp; boardheader_t *bp = getbcache(currbid); - if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) + if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) return DONOTHING; strcpy(buf, "更改 "); - if (HAS_PERM(PERM_SYSOP)) + if (HasUserPerm(PERM_SYSOP)) strcat(buf, "(A)本板發表限制 "); strcat(buf, "(B)本板預設"); if (fhdr->filemode & FILE_VOTE) @@ -1201,7 +1201,7 @@ do_limitedit(int ent, fileheader_t * fhdr, const char *direct) strcat(buf, "連署限制 (Q)取消?[Q]"); genbuf[0] = getans(buf); - if (HAS_PERM(PERM_SYSOP) && genbuf[0] == 'a') { + if (HasUserPerm(PERM_SYSOP) && genbuf[0] == 'a') { sprintf(genbuf, "%u", bp->post_limit_regtime); do { getdata_buf(b_lines - 1, 0, "註冊時間限制 (以'月'為單位,0~255):", genbuf, 4, LCECHO); @@ -1293,14 +1293,14 @@ b_man(void) char buf[PATHLEN]; setapath(buf, currboard); - if ((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP)) { + if ((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) { char genbuf[128]; int fd; snprintf(genbuf, sizeof(genbuf), "%s/.rebuild", buf); if ((fd = open(genbuf, O_CREAT, 0640)) > 0) close(fd); } - return a_menu(currboard, buf, HAS_PERM(PERM_ALLBOARD) ? 2 : + return a_menu(currboard, buf, HasUserPerm(PERM_ALLBOARD) ? 2 : (currmode & MODE_BOARD ? 1 : 0), NULL); } @@ -1327,7 +1327,7 @@ stop_gamble(void) static int join_gamble(int ent, const fileheader_t * fhdr, const char *direct) { - if (!HAS_PERM(PERM_LOGINOK)) + if (!HasUserPerm(PERM_LOGINOK)) return DONOTHING; if (stop_gamble()) { vmsg("目前未舉辦賭盤或賭盤已開獎"); @@ -1466,7 +1466,7 @@ edit_title(int ent, fileheader_t * fhdr, const char *direct) dirty++; } } - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { if (getdata(b_lines - 1, 0, "作者:", genbuf, IDLEN + 2, DOECHO)) { strlcpy(tmpfhdr.owner, genbuf, sizeof(tmpfhdr.owner)); dirty++; @@ -1928,7 +1928,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct) not_owned = (tusernum == usernum ? 0: 1); if ((!(currmode & MODE_BOARD) && not_owned) || - ((bp->brdattr & BRD_VOTEBOARD) && !HAS_PERM(PERM_SYSOP)) || + ((bp->brdattr & BRD_VOTEBOARD) && !HasUserPerm(PERM_SYSOP)) || !strcmp(cuser.userid, STR_GUEST)) return DONOTHING; @@ -2026,7 +2026,7 @@ del_post(int ent, fileheader_t * fhdr, char *direct) static int // Ptt: 修石頭文 show_filename(int ent, const fileheader_t * fhdr, const char *direct) { - if(!HAS_PERM(PERM_SYSOP)) return DONOTHING; + if(!HasUserPerm(PERM_SYSOP)) return DONOTHING; vmsg("檔案名稱: %s ", fhdr->filename); return PART_REDRAW; @@ -2063,7 +2063,7 @@ tar_addqueue(int ent, const fileheader_t * fhdr, const char *direct) clear(); showtitle("看板備份", BBSNAME); move(2, 0); - if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) { + if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) { move(5, 10); outs("妳要是板主或是站長才能醬醬啊 -.-\"\""); pressanykey(); @@ -2397,7 +2397,7 @@ static int b_changerecommend(int ent, const fileheader_t * fhdr, const char *direct) { boardheader_t *bp=NULL; - if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) + if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) return DONOTHING; bp = getbcache(currbid); @@ -2432,7 +2432,7 @@ static int change_hidden(int ent, const fileheader_t * fhdr, const char *direct) { boardheader_t *bp; - if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) + if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) return DONOTHING; bp = getbcache(currbid); @@ -2463,7 +2463,7 @@ change_counting(int ent, const fileheader_t * fhdr, const char *direct) { boardheader_t *bp; - if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) + if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) return DONOTHING; bp = getbcache(currbid); if (!(bp->brdattr & BRD_HIDE && bp->brdattr & BRD_POSTMASK)) @@ -2494,7 +2494,7 @@ static int change_localsave(int ent, const fileheader_t * fhdr, const char *direct) { boardheader_t *bp; - if (!((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) + if (!((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) return DONOTHING; bp = getbcache(currbid); @@ -2520,7 +2520,7 @@ change_localsave(int ent, const fileheader_t * fhdr, const char *direct) static int change_restrictedpost(int ent, fileheader_t * fhdr, char *direct){ boardheader_t *bp; - if (!HAS_PERM(PERM_SYSOP)) + if (!HasUserPerm(PERM_SYSOP)) return DONOTHING; bp = getbcache(currbid); @@ -2549,7 +2549,7 @@ int check_cooldown(boardheader_t *bp) if(diff<0) SHM->cooldowntime[usernum - 1] &= 0xFFFFFFF0; - else if( !((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP))) + else if( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP))) { if( bp->brdattr & BRD_COOLDOWN ) { @@ -2584,7 +2584,7 @@ change_cooldown(int ent, const fileheader_t * fhdr, const char *direct) { boardheader_t *bp = getbcache(currbid); - if (!HAS_PERM(PERM_SYSOP)) + if (!HasUserPerm(PERM_SYSOP)) return DONOTHING; if (bp->brdattr & BRD_COOLDOWN) { diff --git a/mbbsd/board.c b/mbbsd/board.c index 9f0a7ce2..9fae48e0 100644 --- a/mbbsd/board.c +++ b/mbbsd/board.c @@ -93,14 +93,14 @@ save_brdbuf(void) } int -HasPerm(boardheader_t * bptr) +HasBoardPerm(boardheader_t *bptr) { register int level, brdattr; level = bptr->level; brdattr = bptr->brdattr; - if (HAS_PERM(PERM_SYSOP)) + if (HasUserPerm(PERM_SYSOP)) return 1; if( is_BM_cache(bptr - bcache + 1) ) /* XXXbid */ @@ -118,7 +118,7 @@ HasPerm(boardheader_t * bptr) return 1; } /* 限制閱讀權限 */ - if (level && !(brdattr & BRD_POSTMASK) && !HAS_PERM(level)) + if (level && !(brdattr & BRD_POSTMASK) && !HasUserPerm(level)) return 0; return 1; @@ -287,7 +287,7 @@ load_boards(char *key) continue; }else{ bptr = getbcache(fav_getid(&fav->favh[i])); - if( HasPerm(bptr) && strcasestr(bptr->title, key)) + if( HasBoardPerm(bptr) && strcasestr(bptr->title, key)) state = NBRD_BOARD; else continue; @@ -312,7 +312,7 @@ load_boards(char *key) for( i = 0 ; i < SHM->nHOTs ; ++i ) { if(SHM->HBcache[i] == -1) continue; - addnewbrdstat(SHM->HBcache[i], HasPerm(&bcache[SHM->HBcache[i]])); + addnewbrdstat(SHM->HBcache[i], HasBoardPerm(&bcache[SHM->HBcache[i]])); } } #endif @@ -324,7 +324,7 @@ load_boards(char *key) continue; if (!bptr->brdname[0] || (bptr->brdattr & (BRD_GROUPBOARD | BRD_SYMBOLIC)) || - !((state = HasPerm(bptr)) || GROUPOP()) || + !((state = HasBoardPerm(bptr)) || GROUPOP()) || TITLE_MATCH(bptr, key) #if ! HOTBOARDCACHE || (IN_HOTBOARD() && bptr->nuser < 5) @@ -345,14 +345,14 @@ load_boards(char *key) for (bid = bptr->firstchild[type]; bid > 0 && brdnum < childcount+2; bid = bptr->next[type]) { bptr = getbcache(bid); - state = HasPerm(bptr); + state = HasBoardPerm(bptr); if ( !(state || GROUPOP()) || TITLE_MATCH(bptr, key) ) continue; if (bptr->brdattr & BRD_SYMBOLIC) { /* Only SYSOP knows a board is symbolic */ - if (HAS_PERM(PERM_SYSOP)) + if (HasUserPerm(PERM_SYSOP)) state |= NBRD_SYMBOLIC; else bid = BRD_LINK_TARGET(bptr); @@ -376,7 +376,7 @@ search_board(void) CreateNameList(); for (num = 0; num < brdnum; num++) if (!IS_LISTING_FAV() || - (nbrd[num].myattr & NBRD_BOARD && HasPerm(B_BH(&nbrd[num]))) ) + (nbrd[num].myattr & NBRD_BOARD && HasBoardPerm(B_BH(&nbrd[num]))) ) AddNameList(B_BH(&nbrd[num])->brdname); namecomplete(MSG_SELECT_BOARD, genbuf); FreeNameList(); @@ -546,7 +546,7 @@ show_brdlist(int head, int clsflag, int newflag) if (IN_CLASSROOT()) outs(" "); else { - if (!GROUPOP() && !HasPerm(B_BH(ptr))) { + if (!GROUPOP() && !HasBoardPerm(B_BH(ptr))) { prints("%5d Unknown?? 隱板 ?這個板是隱板", head); continue; } @@ -617,7 +617,7 @@ show_brdlist(int head, int clsflag, int newflag) static void set_menu_BM(char *BM) { - if (!HAS_PERM(PERM_NOCITIZEN) && (HAS_PERM(PERM_ALLBOARD) || is_BM(BM))) { + if (!HasUserPerm(PERM_NOCITIZEN) && (HasUserPerm(PERM_ALLBOARD) || is_BM(BM))) { currmode |= MODE_GROUPOP; cuser.userlevel |= PERM_SYSSUBOP; } @@ -634,7 +634,7 @@ paste_taged_brds(int gid) fav_t *fav; int bid, tmp; - if (gid == 0 || ! (HAS_PERM(PERM_SYSOP) || GROUPOP()) || + if (gid == 0 || ! (HasUserPerm(PERM_SYSOP) || GROUPOP()) || getans("貼上標記的看板?(y/N)")!='y') return 0; fav = get_current_fav(); for (tmp = 0; tmp < fav->DataTail; tmp++) { @@ -688,7 +688,7 @@ choose_board(int newflag) yank_flag++; /* FAV => BRD, BRD => GUEST */ continue; } - if (HAS_PERM(PERM_SYSOP) || GROUPOP()) { + if (HasUserPerm(PERM_SYSOP) || GROUPOP()) { if (paste_taged_brds(class_bid) || m_newbrd(class_bid, 0) == -1) break; @@ -833,7 +833,7 @@ choose_board(int newflag) break; case 'F': case 'f': - if (IN_SUBCLASS() && HAS_PERM(PERM_SYSOP)) { + if (IN_SUBCLASS() && HasUserPerm(PERM_SYSOP)) { getbcache(class_bid)->firstchild[cuser.uflag & BRDSORT_FLAG ? 1 : 0] = 0; brdnum = -1; } @@ -872,7 +872,7 @@ choose_board(int newflag) brdnum = -1; break; case 'D': - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { ptr = &nbrd[num]; if (ptr->myattr & NBRD_SYMBOLIC) { if (getans("確定刪除連結?[N/y]") == 'y') @@ -882,19 +882,19 @@ choose_board(int newflag) } break; case Ctrl('D'): - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { fav_remove_all_tagged_item(); brdnum = -1; } break; case Ctrl('A'): - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { fav_add_all_tagged_item(); brdnum = -1; } break; case Ctrl('T'): - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { fav_remove_all_tag(); brdnum = -1; } @@ -904,13 +904,13 @@ choose_board(int newflag) brdnum = -1; break; case 'L': - if (HAS_PERM(PERM_SYSOP) && IN_CLASS()) { + if (HasUserPerm(PERM_SYSOP) && IN_CLASS()) { if (make_symbolic_link_interactively(class_bid) < 0) break; brdnum = -1; head = 9999; } - else if (HAS_PERM(PERM_LOGINOK) && IS_LISTING_FAV()) { + else if (HasUserPerm(PERM_LOGINOK) && IS_LISTING_FAV()) { if (fav_add_line() == NULL) { vmsg("新增失敗,分隔線/總最愛 數量達最大值。"); break; @@ -924,14 +924,14 @@ choose_board(int newflag) break; /* case 'l': - if (HAS_PERM(PERM_SYSOP) && (nbrd[num].myattr & NBRD_SYMBOLIC)) { + if (HasUserPerm(PERM_SYSOP) && (nbrd[num].myattr & NBRD_SYMBOLIC)) { replace_link_by_target(&nbrd[num]); head = 9999; } break; */ case 'm': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { ptr = &nbrd[num]; if (IS_LISTING_FAV()) { if (ptr->myattr & NBRD_FAV) { @@ -958,7 +958,7 @@ choose_board(int newflag) } break; case 'M': - if (HAS_PERM(PERM_LOGINOK)){ + if (HasUserPerm(PERM_LOGINOK)){ if (IN_FAVORITE() && IS_LISTING_FAV()){ imovefav(num); brdnum = -1; @@ -967,7 +967,7 @@ choose_board(int newflag) } break; case 'g': - if (HAS_PERM(PERM_LOGINOK) && IS_LISTING_FAV()) { + if (HasUserPerm(PERM_LOGINOK) && IS_LISTING_FAV()) { fav_type_t *ft; if (fav_stack_full()){ vmsg("目錄已達最大層數!!"); @@ -986,7 +986,7 @@ choose_board(int newflag) } break; case 'T': - if (HAS_PERM(PERM_LOGINOK) && nbrd[num].myattr & NBRD_FOLDER) { + if (HasUserPerm(PERM_LOGINOK) && nbrd[num].myattr & NBRD_FOLDER) { fav_type_t *ft = getfolder(nbrd[num].bid); strlcpy(buf, get_item_title(ft), sizeof(buf)); getdata_buf(b_lines - 1, 0, "請輸入板名:", buf, 65, DOECHO); @@ -995,7 +995,7 @@ choose_board(int newflag) } break; case 'K': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { char c, fname[80]; if (get_current_fav() != get_fav_root()) { vmsg("請到我的最愛最上層執行本功\能"); @@ -1033,11 +1033,11 @@ choose_board(int newflag) } break; case 'z': - if (HAS_PERM(PERM_LOGINOK)) + if (HasUserPerm(PERM_LOGINOK)) vmsg("這個功\能已經被我的最愛取代掉了喔!"); break; case 'Z': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { char genbuf[64]; sprintf(genbuf, "確定要 %s訂閱\ 新看板? [N/y] ", cuser.uflag2 & FAVNEW_FLAG ? "取消" : ""); if (getans(genbuf) != 'y') @@ -1054,7 +1054,7 @@ choose_board(int newflag) case 'v': case 'V': ptr = &nbrd[num]; - if(nbrd[num].bid < 0 || !HasPerm(B_BH(ptr))) + if(nbrd[num].bid < 0 || !HasBoardPerm(B_BH(ptr))) break; if (ch == 'v') { ptr->myattr &= ~NBRD_UNREAD; @@ -1075,7 +1075,7 @@ choose_board(int newflag) num = tmp; break; case 'E': - if (HAS_PERM(PERM_SYSOP | PERM_BOARD) || GROUPOP()) { + if (HasUserPerm(PERM_SYSOP | PERM_BOARD) || GROUPOP()) { ptr = &nbrd[num]; move(1, 1); clrtobot(); @@ -1084,20 +1084,20 @@ choose_board(int newflag) } break; case 'R': - if (HAS_PERM(PERM_SYSOP) || GROUPOP()) { + if (HasUserPerm(PERM_SYSOP) || GROUPOP()) { m_newbrd(class_bid, 1); brdnum = -1; } break; case 'B': - if (HAS_PERM(PERM_SYSOP) || GROUPOP()) { + if (HasUserPerm(PERM_SYSOP) || GROUPOP()) { m_newbrd(class_bid, 0); brdnum = -1; } break; case 'W': if (IN_SUBCLASS() && - (HAS_PERM(PERM_SYSOP) || GROUPOP())) { + (HasUserPerm(PERM_SYSOP) || GROUPOP())) { setbpath(buf, getbcache(class_bid)->brdname); mkdir(buf, 0755); /* Ptt:開群組目錄 */ b_note_edit_bname(class_bid); @@ -1107,7 +1107,7 @@ choose_board(int newflag) case 'a': case 'i': - if(IS_LISTING_FAV() && HAS_PERM(PERM_LOGINOK)){ + if(IS_LISTING_FAV() && HasUserPerm(PERM_LOGINOK)){ char bname[IDLEN + 1]; int bid; move(0, 0); @@ -1118,7 +1118,7 @@ choose_board(int newflag) bname); if (bname[0] && (bid = getbnum(bname)) && - HasPerm(getbcache(bid))) { + HasBoardPerm(getbcache(bid))) { fav_type_t * ptr = getboard(bid); if (ptr != NULL) { // already in fav list // move curser to item @@ -1177,7 +1177,7 @@ choose_board(int newflag) } if (!(B_BH(ptr)->brdattr & BRD_GROUPBOARD)) { /* 非sub class */ - if (HasPerm(B_BH(ptr))) { + if (HasBoardPerm(B_BH(ptr))) { brc_initial_board(B_BH(ptr)->brdname); if (newflag) { diff --git a/mbbsd/cache.c b/mbbsd/cache.c index b65e8090..8e7895c7 100644 --- a/mbbsd/cache.c +++ b/mbbsd/cache.c @@ -488,7 +488,7 @@ setutmpmode(unsigned int mode) if (currstat != mode) currutmp->mode = currstat = mode; /* 追蹤使用者 */ - if (HAS_PERM(PERM_LOGUSER)) { + if (HasUserPerm(PERM_LOGUSER)) { log_user("setutmpmode to %s(%d)\n", modestring(currutmp, 0), mode); } } @@ -653,7 +653,7 @@ reset_board(int bid) /* XXXbid: from 1 */ } } -#ifndef _BBS_UTIL_C_ /* because of HasPerm() in board.c */ +#ifndef _BBS_UTIL_C_ /* because of HasBoardPerm() in board.c */ int apply_boards(int (*func) (boardheader_t *)) { @@ -661,7 +661,7 @@ apply_boards(int (*func) (boardheader_t *)) register boardheader_t *bhdr; for (i = 0, bhdr = bcache; i < numboards; i++, bhdr++) { - if (!(bhdr->brdattr & BRD_GROUPBOARD) && HasPerm(bhdr) && + if (!(bhdr->brdattr & BRD_GROUPBOARD) && HasBoardPerm(bhdr) && (*func) (bhdr) == QUIT) return QUIT; } @@ -763,7 +763,7 @@ haspostperm(const char *bname) if (bcache[i - 1].brdattr & BRD_GUESTPOST) return 1; - if (!HAS_PERM(PERM_POST)) + if (!HasUserPerm(PERM_POST)) return 0; /* 秘密看板特別處理 */ @@ -775,12 +775,12 @@ haspostperm(const char *bname) i = bcache[i - 1].level; - if (HAS_PERM(PERM_VIOLATELAW) && (i & PERM_VIOLATELAW)) + if (HasUserPerm(PERM_VIOLATELAW) && (i & PERM_VIOLATELAW)) return 1; - else if (HAS_PERM(PERM_VIOLATELAW)) + else if (HasUserPerm(PERM_VIOLATELAW)) return 0; - return HAS_PERM(i & ~PERM_POST); + return HasUserPerm(i & ~PERM_POST); } void buildBMcache(int bid) /* bid starts from 1 */ diff --git a/mbbsd/cal.c b/mbbsd/cal.c index 56da1cb0..8658e850 100644 --- a/mbbsd/cal.c +++ b/mbbsd/cal.c @@ -100,7 +100,7 @@ osong(const char *defaultid) lockreturn0(OSONG, LOCK_MULTI); /* Jaky 一人一天點一首 */ - if (!strcmp(buf, Cdatedate(&cuser.lastsong)) && !HAS_PERM(PERM_SYSOP)) { + if (!strcmp(buf, Cdatedate(&cuser.lastsong)) && !HasUserPerm(PERM_SYSOP)) { move(22, 0); vmsg("你今天已經點過囉,明天再點吧...."); unlockutmpmode(); @@ -426,7 +426,7 @@ p_sysinfo(void) MAX_ACTIVE, #endif compile_time, ctime4(&start_time)); - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { struct rusage ru; getrusage(RUSAGE_SELF, &ru); prints("記憶體用量: " diff --git a/mbbsd/chat.c b/mbbsd/chat.c index a837eab3..d679c18e 100644 --- a/mbbsd/chat.c +++ b/mbbsd/chat.c @@ -126,7 +126,7 @@ printuserent(const userinfo_t * uentp) cnt = 0; return 0; } - if (!HAS_PERM(PERM_SYSOP) && !HAS_PERM(PERM_SEECLOAK) && uentp->invisible) + if (!HasUserPerm(PERM_SYSOP) && !HasUserPerm(PERM_SEECLOAK) && uentp->invisible) return 0; snprintf(pline, sizeof(pline), "%-13s%c%-10s ", uentp->userid, diff --git a/mbbsd/edit.c b/mbbsd/edit.c index ec041eab..432b8903 100644 --- a/mbbsd/edit.c +++ b/mbbsd/edit.c @@ -1511,7 +1511,7 @@ write_file(char *fpath, int saveheader, int *islocal) strlcpy(save_title, ans, sizeof(save_title)); return KEEP_EDITING; case 's': - if (!HAS_PERM(PERM_LOGINOK)) { + if (!HasUserPerm(PERM_LOGINOK)) { local_article = 1; move(2, 0); outs("您尚未通過身份確認,只能 Local Save。\n"); @@ -2880,7 +2880,7 @@ vedit(char *fpath, int saveheader, int *islocal) unsigned int currstat0 = currstat; setutmpmode(EDITEXP); a_menu("編輯輔助器", "etc/editexp", - (HAS_PERM(PERM_SYSOP) ? SYSOP : NOBODY), + (HasUserPerm(PERM_SYSOP) ? SYSOP : NOBODY), trans_buffer); currstat = currstat0; } diff --git a/mbbsd/fav.c b/mbbsd/fav.c index 6476ab85..a4a5802e 100644 --- a/mbbsd/fav.c +++ b/mbbsd/fav.c @@ -323,7 +323,7 @@ static void rebuild_fav(fav_t *fp, int clean_invisible) bp = &bcache[cast_board(ft)->bid - 1]; if (!bp->brdname[0]) continue; - if ( clean_invisible && !HasPerm(bp)) + if ( clean_invisible && !HasBoardPerm(bp)) continue; break; case FAVT_LINE: @@ -1119,7 +1119,7 @@ int updatenewfav(int mode) for(i = 0; i < brdnum + 1 && brd[i] != BRD_END; i++){ if(brd[i] == BRD_NEW){ /* check the permission if the board exsits */ - if(bcache[i].brdname[0] && HasPerm(&bcache[i])){ + if(bcache[i].brdname[0] && HasBoardPerm(&bcache[i])){ if(mode && !(bcache[i].brdattr & BRD_SYMBOLIC)) { fav_add_board(i + 1); count++; @@ -1135,7 +1135,7 @@ int updatenewfav(int mode) if( i < brdnum) { // the board number may change for(; i < brdnum; ++i){ - if(bcache[i].brdname[0] && HasPerm(&bcache[i])){ + if(bcache[i].brdname[0] && HasBoardPerm(&bcache[i])){ if(mode && !(bcache[i].brdattr & BRD_SYMBOLIC)) { fav_add_board(i + 1); count++; diff --git a/mbbsd/indict.c b/mbbsd/indict.c index e8af6075..c5d530f2 100644 --- a/mbbsd/indict.c +++ b/mbbsd/indict.c @@ -74,7 +74,7 @@ use_dict(char *dict,char *database) int i = 0; setutmpmode(DICT); - if (!HAS_PERM(PERM_SYSOP)) + if (!HasUserPerm(PERM_SYSOP)) sys[0] = 0; clear(); @@ -109,7 +109,7 @@ use_dict(char *dict,char *database) more("etc/dict.hlp", YEA); clear(); continue; - } else if (word[0] == 'e' && HAS_PERM(PERM_SYSOP)) { + } else if (word[0] == 'e' && HasUserPerm(PERM_SYSOP)) { vedit(database, NA, NULL); clear(); continue; diff --git a/mbbsd/mail.c b/mbbsd/mail.c index 32b9da2e..74a7f9c5 100644 --- a/mbbsd/mail.c +++ b/mbbsd/mail.c @@ -139,14 +139,14 @@ void setupmailusage(void) { // Ptt: get_sum_records is a bad function int max_keepmail = MAX_KEEPMAIL; - if( HAS_PERM(PERM_SYSSUBOP | PERM_ACCTREG | PERM_PRG | + if( HasUserPerm(PERM_SYSSUBOP | PERM_ACCTREG | PERM_PRG | PERM_ACTION | PERM_PAINT) ){ mailsumlimit = 700; max_keepmail = 500; - } else if (HAS_PERM(PERM_BM)) { + } else if (HasUserPerm(PERM_BM)) { mailsumlimit = 500; max_keepmail = 300; - } else if (HAS_PERM(PERM_LOGINOK)) + } else if (HasUserPerm(PERM_LOGINOK)) mailsumlimit = 200; else mailsumlimit = 50; @@ -981,7 +981,7 @@ mail_edit(int ent, fileheader_t * fhdr, const char *direct) { char genbuf[200]; - if (!HAS_PERM(PERM_SYSOP) && + if (!HasUserPerm(PERM_SYSOP) && strcmp(cuser.userid, fhdr->owner) && strcmp("[備.忘.錄]", fhdr->owner)) return DONOTHING; @@ -1060,7 +1060,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, const char *direct) return TITLE_REDRAW; ent = getbnum(xboard); - if ( !((currmode & MODE_BOARD) || HAS_PERM(PERM_SYSOP)) && + if ( !((currmode & MODE_BOARD) || HasUserPerm(PERM_SYSOP)) && (cuser.firstlogin > (now - (time4_t)bcache[ent - 1].post_limit_regtime * 2592000) || cuser.numlogins < ((unsigned int)(bcache[ent - 1].post_limit_logins) * 10) || cuser.numposts < ((unsigned int)(bcache[ent - 1].post_limit_posts) * 10)) ) { @@ -1075,7 +1075,7 @@ mail_cross_post(int ent, fileheader_t * fhdr, const char *direct) #endif ent = 1; - if (HAS_PERM(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) { + if (HasUserPerm(PERM_SYSOP) || !strcmp(fhdr->owner, cuser.userid)) { getdata(2, 0, "(1)原文轉載 (2)舊轉錄格式?[1] ", genbuf, 3, DOECHO); if (genbuf[0] != '2') { @@ -1158,7 +1158,7 @@ mail_man(void) sethomeman(buf, cuser.userid); snprintf(buf1, sizeof(buf1), "%s 的信件夾", cuser.userid); - a_menu(buf1, buf, HAS_PERM(PERM_MAILLIMIT), NULL); + a_menu(buf1, buf, HasUserPerm(PERM_MAILLIMIT), NULL); currutmp->mode = mode0; currstat = stat0; return FULLUPDATE; @@ -1193,7 +1193,7 @@ mail_cite(int ent, fileheader_t * fhdr, const char *direct) setapath(fpath, xboard); setutmpmode(ANNOUNCE); a_menu(xboard, fpath, - HAS_PERM(PERM_ALLBOARD) ? 2 : is_BM_cache(bid) ? 1 : 0, + HasUserPerm(PERM_ALLBOARD) ? 2 : is_BM_cache(bid) ? 1 : 0, NULL); } else { mail_man(); @@ -1211,7 +1211,7 @@ mail_save(int ent, fileheader_t * fhdr, const char *direct) char fpath[256]; char title[TTLEN + 1]; - if (HAS_PERM(PERM_MAILLIMIT)) { + if (HasUserPerm(PERM_MAILLIMIT)) { setuserfile(fpath, fhdr->filename); strlcpy(title, "◇ ", sizeof(title)); strncpy(title + 3, fhdr->title, TTLEN - 3); @@ -1608,7 +1608,7 @@ doforward(const char *direct, const fileheader_t * fh, int mode) refresh(); /* 追蹤使用者 */ - if (HAS_PERM(PERM_LOGUSER)) + if (HasUserPerm(PERM_LOGUSER)) log_user("mailforward to %s ",address); if (mode == 'Z') { snprintf(fname, sizeof(fname), @@ -1661,7 +1661,7 @@ load_mailalert(const char *userid) fileheader_t my_mail; sethomedir(maildir, userid); - if (!HAS_PERM(PERM_BASIC)) + if (!HasUserPerm(PERM_BASIC)) return 0; if (stat(maildir, &st) < 0) return 0; diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c index 00d470f1..6f4faecc 100644 --- a/mbbsd/mbbsd.c +++ b/mbbsd/mbbsd.c @@ -130,7 +130,7 @@ log_usies(const char *mode, const char *mesg) Cdate(&now), mode, cuser.userid, mesg); /* 追蹤使用者 */ - if (HAS_PERM(PERM_LOGUSER)) + if (HasUserPerm(PERM_LOGUSER)) log_user("logout"); } @@ -177,7 +177,7 @@ u_exit(const char *mode) cuser.pager = currutmp->pager; memcpy(cuser.mind, currutmp->mind, 4); setutmpbid(0); - if (!(HAS_PERM(PERM_SYSOP) && HAS_PERM(PERM_SYSOPHIDE)) && + if (!(HasUserPerm(PERM_SYSOP) && HasUserPerm(PERM_SYSOPHIDE)) && !currutmp->invisible) do_aloha("<<下站通知>> -- 我走囉!"); @@ -480,7 +480,7 @@ multi_user_check(void) register pid_t pid; char genbuf[3]; - if (HAS_PERM(PERM_SYSOP)) + if (HasUserPerm(PERM_SYSOP)) return; /* don't check sysops */ if (cuser.userlevel) { @@ -980,7 +980,7 @@ user_login(void) SHM->max_time = now; } - if (!(HAS_PERM(PERM_SYSOP) && HAS_PERM(PERM_SYSOPHIDE)) && + if (!(HasUserPerm(PERM_SYSOP) && HasUserPerm(PERM_SYSOPHIDE)) && !currutmp->invisible) do_aloha("<<上站通知>> -- 我來啦!"); diff --git a/mbbsd/menu.c b/mbbsd/menu.c index 247f515b..a42cc0bd 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -32,7 +32,7 @@ showtitle(const char *title, const char *mid) else if (currutmp->mailalert) { mid = ANSI_COLOR(41;5) " 郵差來按鈴囉 " TITLE_COLOR; spc = 22; - } else if ( HAS_PERM(PERM_ACCTREG) && + } else if ( HasUserPerm(PERM_ACCTREG) && (nreg = dashs((char *)fn_register) / 163) > 100 ) { snprintf(numreg, sizeof(numreg), ANSI_COLOR(41;5) " 有 %03d 未審核 " TITLE_COLOR, @@ -146,7 +146,7 @@ show_menu(const commands_t * p) move(menu_row, 0); while ((s = p[n].desc)) { - if (HAS_PERM(p[n].level)) { + if (HasUserPerm(p[n].level)) { prints("%*s (" ANSI_COLOR(1;36) "%c" ANSI_COLOR(0) ")%s\n", menu_column, "", s[1], s+2); } @@ -202,7 +202,7 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) do { if (++i > total) i = 0; - } while (!HAS_PERM(cmdtable[i].level)); + } while (!HasUserPerm(cmdtable[i].level)); break; case KEY_END: case KEY_PGDN: @@ -213,7 +213,7 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) do { if (--i < 0) i = total; - } while (!HAS_PERM(cmdtable[i].level)); + } while (!HasUserPerm(cmdtable[i].level)); break; case KEY_LEFT: case 'e': @@ -263,9 +263,9 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) if (cmdtable[i].desc[1] == cmd) break; - if (!HAS_PERM(cmdtable[i].level)) { + if (!HasUserPerm(cmdtable[i].level)) { for (i = 0; cmdtable[i].desc; i++) - if (HAS_PERM(cmdtable[i].level)) + if (HasUserPerm(cmdtable[i].level)) break; if (!cmdtable[i].desc) return; @@ -276,7 +276,7 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) } } - if (i > total || !HAS_PERM(cmdtable[i].level)) + if (i > total || !HasUserPerm(cmdtable[i].level)) continue; if (refscreen) { @@ -290,7 +290,7 @@ domenu(int cmdmode, const char *cmdtitle, int cmd, const commands_t cmdtable[]) cursor_clear(menu_row + pos, menu_column); n = pos = -1; while (++n <= (lastcmdptr = i)) - if (HAS_PERM(cmdtable[n].level)) + if (HasUserPerm(cmdtable[n].level)) pos++; cursor_show(menu_row + pos, menu_column); diff --git a/mbbsd/more.c b/mbbsd/more.c index 56ccdb7f..fed6e878 100644 --- a/mbbsd/more.c +++ b/mbbsd/more.c @@ -489,7 +489,7 @@ more(char *fpath, int promptend) lino = line = 0; break; case 'E': - if (HAS_PERM(PERM_SYSOP) && strcmp(fpath, "etc/ve.hlp")) { + if (HasUserPerm(PERM_SYSOP) && strcmp(fpath, "etc/ve.hlp")) { close(fd); vedit(fpath, NA, NULL); return 0; diff --git a/mbbsd/name.c b/mbbsd/name.c index b87c324a..4151a50f 100644 --- a/mbbsd/name.c +++ b/mbbsd/name.c @@ -713,7 +713,7 @@ completeboard_permission(int where) { boardheader_t *bptr = &bcache[SHM->bsorted[0][where]]; return (!(bptr->brdattr & BRD_SYMBOLIC) && - (GROUPOP() || HasPerm(bptr)) && + (GROUPOP() || HasBoardPerm(bptr)) && !(bptr->brdattr & BRD_GROUPBOARD)); } @@ -722,7 +722,7 @@ complete_board_and_group_permission(int where) { boardheader_t *bptr = &bcache[SHM->bsorted[0][where]]; return (!(bptr->brdattr & BRD_SYMBOLIC) && - (GROUPOP() || HasPerm(bptr))); + (GROUPOP() || HasBoardPerm(bptr))); } @@ -744,8 +744,8 @@ int completeutmp_permission(int where) { userinfo_t *u = &SHM->uinfo[SHM->sorted[SHM->currsorted][0][where]]; - return (unlikely(HAS_PERM(PERM_SYSOP)) || - unlikely(HAS_PERM(PERM_SEECLOAK)) || + return (unlikely(HasUserPerm(PERM_SYSOP)) || + unlikely(HasUserPerm(PERM_SEECLOAK)) || // !SHM->sorted[SHM->currsorted][0][where]->invisible); isvisible(currutmp, u)); } diff --git a/mbbsd/pmore.c b/mbbsd/pmore.c index ea28a41d..413cac64 100644 --- a/mbbsd/pmore.c +++ b/mbbsd/pmore.c @@ -2122,7 +2122,7 @@ pmore(char *fpath, int promptend) case 'E': // admin edit any files other than ve help file - if (HAS_PERM(PERM_SYSOP) && strcmp(fpath, "etc/ve.hlp")) { + if (HasUserPerm(PERM_SYSOP) && strcmp(fpath, "etc/ve.hlp")) { mf_detach(); vedit(fpath, NA, NULL); REENTRANT_RESTORE(); diff --git a/mbbsd/read.c b/mbbsd/read.c index 1629a9d1..5988a5ea 100644 --- a/mbbsd/read.c +++ b/mbbsd/read.c @@ -641,7 +641,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem, case 'F': case 'U': - if (HAS_PERM(PERM_FORWARD)) { + if (HasUserPerm(PERM_FORWARD)) { mail_forward(&headers[locmem->crs_ln - locmem->top_ln], currdirect, ch /* == 'U' */ ); /* by CharlieL */ @@ -654,7 +654,7 @@ i_read_key(const onekey_t * rcmdlist, keeploc_t * locmem, break; case Ctrl('S'): - if (HAS_PERM(PERM_ACCOUNTS)) { + if (HasUserPerm(PERM_ACCOUNTS)) { int id; userec_t muser; diff --git a/mbbsd/register.c b/mbbsd/register.c index b0d948d7..51524c6b 100644 --- a/mbbsd/register.c +++ b/mbbsd/register.c @@ -294,7 +294,7 @@ check_register(void) { char *ptr = NULL; - if (HAS_PERM(PERM_LOGINOK)) + if (HasUserPerm(PERM_LOGINOK)) return; /* @@ -323,7 +323,7 @@ check_register(void) sizeof(cuser.address), DOECHO); - if (!HAS_PERM(PERM_SYSOP)) { + if (!HasUserPerm(PERM_SYSOP)) { /* 回覆過身份認證信函,或曾經 E-mail post 過 */ clear(); move(9, 3); diff --git a/mbbsd/stuff.c b/mbbsd/stuff.c index cd0b3471..3b076fca 100644 --- a/mbbsd/stuff.c +++ b/mbbsd/stuff.c @@ -848,7 +848,7 @@ show_help(const char * const helptext[]) prints(" %s\n", str); } #ifdef PLAY_ANGEL - if (HAS_PERM(PERM_LOGINOK)) + if (HasUserPerm(PERM_LOGINOK)) pressanykey_or_callangel(); else #endif @@ -861,7 +861,7 @@ show_helpfile(const char *helpfile) clear(); show_file((char *)helpfile, 0, b_lines, NO_RELOAD); #ifdef PLAY_ANGEL - if (HAS_PERM(PERM_LOGINOK)) + if (HasUserPerm(PERM_LOGINOK)) pressanykey_or_callangel(); else #endif diff --git a/mbbsd/talk.c b/mbbsd/talk.c index e73246c1..740b5936 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -49,10 +49,10 @@ iswritable_stat(const userinfo_t * uentp, int fri_stat) if (uentp == currutmp) return 0; - if (HAS_PERM(PERM_SYSOP)) + if (HasUserPerm(PERM_SYSOP)) return 1; - if (!HAS_PERM(PERM_LOGINOK)) + if (!HasUserPerm(PERM_LOGINOK)) return 0; return (uentp->pager != 3 && (fri_stat & HFM || uentp->pager != 4)); @@ -94,7 +94,7 @@ modestring(const userinfo_t * uentp, int simple) word = ModeTypeTable[mode]; fri_stat = friend_stat(currutmp, uentp); - if (!(HAS_PERM(PERM_SYSOP) || HAS_PERM(PERM_SEECLOAK)) && + if (!(HasUserPerm(PERM_SYSOP) || HasUserPerm(PERM_SEECLOAK)) && ((uentp->invisible || (fri_stat & HRM)) && !((fri_stat & HFM) && (fri_stat & HRM)))) return notonline; @@ -759,7 +759,7 @@ my_write(pid_t pid, const char *prompt, const char *id, int flag, userinfo_t * p /* Angel accept or not is checked outside. * Avoiding new users don't know what pager is. */ #endif - !HAS_PERM(PERM_SYSOP) && + !HasUserPerm(PERM_SYSOP) && (uin->pager == 3 || uin->pager == 2 || (uin->pager == 4 && @@ -1401,14 +1401,14 @@ my_talk(userinfo_t * uin, int fri_stat, char defact) } else outs("人家在忙啦"); - } else if (!HAS_PERM(PERM_SYSOP) && + } else if (!HasUserPerm(PERM_SYSOP) && (((fri_stat & HRM) && !(fri_stat & HFM)) || ((!uin->pager) && !(fri_stat & HFM)))) { outs("對方關掉呼叫器了"); - } else if (!HAS_PERM(PERM_SYSOP) && + } else if (!HasUserPerm(PERM_SYSOP) && (((fri_stat & HRM) && !(fri_stat & HFM)) || uin->pager == 2)) { outs("對方拔掉呼叫器了"); - } else if (!HAS_PERM(PERM_SYSOP) && + } else if (!HasUserPerm(PERM_SYSOP) && !(fri_stat & HFM) && uin->pager == 4) { outs("對方只接受好友的呼叫"); } else if (!(pid = uin->pid) /* || (kill(pid, 0) == -1) */ ) { @@ -1588,7 +1588,7 @@ t_showhelp(void) "(a/d/o) 好友 增加/刪除/修改 (/)(s) 網友ID/暱稱搜尋\n" "(N) 修改暱稱 (y) 我想找人聊天、下棋…\n"); - if (HAS_PERM(PERM_PAGE)) { + if (HasUserPerm(PERM_PAGE)) { outs("\n" ANSI_COLOR(36) "【 交談專用鍵 】" ANSI_RESET "\n" "(→)(t)(Enter) 跟他/她聊天\n" "(w) 熱線 Call in\n" @@ -1596,7 +1596,7 @@ t_showhelp(void) "(b) 對好友廣播 (一定要在好友列表中)\n" "(^R) 即時回應 (有人 Call in 你時)\n"); } - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { outs("\n" ANSI_COLOR(36) "【 站長專用鍵 】" ANSI_RESET "\n\n"); outs("(u)/(H) 設定使用者資料/切換隱形模式\n"); outs("(K) 把壞蛋踢出去\n"); @@ -1605,7 +1605,7 @@ t_showhelp(void) #endif } #ifdef PLAY_ANGEL - if (HAS_PERM(PERM_LOGINOK)) + if (HasUserPerm(PERM_LOGINOK)) pressanykey_or_callangel(); else #endif @@ -1663,7 +1663,7 @@ descript(int show_mode, const userinfo_t * uentp, time4_t diff) return friend_descript(uentp, description, sizeof(description)); case 0: return (((uentp->pager != 2 && uentp->pager != 3 && diff) || - HAS_PERM(PERM_SYSOP)) ? + HasUserPerm(PERM_SYSOP)) ? #ifdef WHERE uentp->from_alias ? SHM->home_desc[uentp->from_alias] : uentp->from @@ -1940,7 +1940,7 @@ draw_pickup(int drawall, pickup_t * pickup, int pickup_way, prints("\n" ANSI_COLOR(7) " %s P%c代號 %-17s%-17s%-13s%-10s" ANSI_RESET "\n", show_uid ? "UID" : "No.", - (HAS_PERM(PERM_SEECLOAK) || HAS_PERM(PERM_SYSOP)) ? 'C' : ' ', + (HasUserPerm(PERM_SEECLOAK) || HasUserPerm(PERM_SYSOP)) ? 'C' : ' ', "暱稱", MODE_STRING[show_mode], show_board ? "Board" : "動態", @@ -2195,14 +2195,14 @@ userlist(void) break; case 'H': - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { currutmp->userlevel ^= PERM_SYSOPHIDE; redrawall = redraw = 1; } break; case 'D': - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { char buf[100]; snprintf(buf, sizeof(buf), "代號 [%s]:", currutmp->userid); @@ -2214,7 +2214,7 @@ userlist(void) break; case 'F': - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { char buf[100]; snprintf(buf, sizeof(buf), "故鄉 [%s]:", currutmp->from); @@ -2227,7 +2227,7 @@ userlist(void) case 'C': #if !HAVE_FREECLOAK - if (HAS_PERM(PERM_CLOAK)) + if (HasUserPerm(PERM_CLOAK)) #endif { currutmp->invisible ^= 1; @@ -2367,7 +2367,7 @@ userlist(void) #ifdef SHOWUID case 'U': - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { show_uid ^= 1; redrawall = redraw = 1; } @@ -2375,7 +2375,7 @@ userlist(void) #endif #if defined(SHOWBOARD) && defined(DEBUG) case 'Y': - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { show_board ^= 1; redrawall = redraw = 1; } @@ -2383,7 +2383,7 @@ userlist(void) #endif #ifdef SHOWPID case '#': - if (HAS_PERM(PERM_SYSOP)) { + if (HasUserPerm(PERM_SYSOP)) { show_pid ^= 1; redrawall = redraw = 1; } @@ -2391,7 +2391,7 @@ userlist(void) #endif case 'b': /* broadcast */ - if (cuser.uflag & FRIEND_FLAG || HAS_PERM(PERM_SYSOP)) { + if (cuser.uflag & FRIEND_FLAG || HasUserPerm(PERM_SYSOP)) { char genbuf[60]="[廣播]"; char ans[4]; @@ -2402,7 +2402,7 @@ userlist(void) ans, sizeof(ans), LCECHO) || ans[0] != 'y') break; - if (!(cuser.uflag & FRIEND_FLAG) && HAS_PERM(PERM_SYSOP)) { + if (!(cuser.uflag & FRIEND_FLAG) && HasUserPerm(PERM_SYSOP)) { msgque_t msg; getdata(1, 0, "再次確定站長廣播? [N]", ans, sizeof(ans), LCECHO); @@ -2473,7 +2473,7 @@ userlist(void) break; case 'u': /* 線上修改資料 */ - if (HAS_PERM(PERM_ACCOUNTS)) { + if (HasUserPerm(PERM_ACCOUNTS)) { int id; userec_t muser; strlcpy(currauthor, uentp->userid, sizeof(currauthor)); @@ -2508,7 +2508,7 @@ userlist(void) case '\n': case '\r': case 't': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { if (uentp->pid != currpid && strcmp(uentp->userid, cuser.userid) != 0) { move(1, 0); @@ -2520,7 +2520,7 @@ userlist(void) } break; case 'K': - if (HAS_PERM(PERM_ACCOUNTS)) { + if (HasUserPerm(PERM_ACCOUNTS)) { my_kick(uentp); redrawall = redraw = 1; } @@ -2530,7 +2530,7 @@ userlist(void) redrawall = redraw = 1; break; case 'a': - if (HAS_PERM(PERM_LOGINOK) && !(fri_stat & IFH)) { + if (HasUserPerm(PERM_LOGINOK) && !(fri_stat & IFH)) { if (getans("確定要加入好友嗎 [N/y]") == 'y') { friend_add(uentp->userid, FRIEND_OVERRIDE,uentp->username); friend_load(FRIEND_OVERRIDE); @@ -2540,7 +2540,7 @@ userlist(void) break; case 'd': - if (HAS_PERM(PERM_LOGINOK) && (fri_stat & IFH)) { + if (HasUserPerm(PERM_LOGINOK) && (fri_stat & IFH)) { if (getans("確定要刪除好友嗎 [N/y]") == 'y') { friend_delete(uentp->userid, FRIEND_OVERRIDE); friend_load(FRIEND_OVERRIDE); @@ -2550,21 +2550,21 @@ userlist(void) break; case 'o': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { t_override(); redrawall = redraw = 1; } break; case 'f': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { cuser.uflag ^= FRIEND_FLAG; redrawall = redraw = 1; } break; case 'g': - if (HAS_PERM(PERM_LOGINOK) && + if (HasUserPerm(PERM_LOGINOK) && strcmp(uentp->userid, cuser.userid) != 0) { char genbuf[10]; move(b_lines - 2, 0); @@ -2604,7 +2604,7 @@ userlist(void) break; case 'm': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { char userid[IDLEN + 1]; strlcpy(userid, uentp->userid, sizeof(userid)); stand_title("寄 信"); @@ -2623,14 +2623,14 @@ userlist(void) break; case 'c': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { chicken_query(uentp->userid); redrawall = redraw = 1; } break; case 'l': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { t_display(); redrawall = redraw = 1; } @@ -2642,14 +2642,14 @@ userlist(void) break; case 'p': - if (HAS_PERM(PERM_BASIC)) { + if (HasUserPerm(PERM_BASIC)) { t_pager(); redrawall = redraw = 1; } break; case Ctrl('W'): - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { int tmp; char *wm[3] = {"一般", "進階", "未來"}; tmp = cuser.uflag2 & WATER_MASK; @@ -2668,7 +2668,7 @@ userlist(void) break; case 'r': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { m_read(); setutmpmode(LUSERS); redrawall = redraw = 1; @@ -2676,7 +2676,7 @@ userlist(void) break; case 'N': - if (HAS_PERM(PERM_LOGINOK)) { + if (HasUserPerm(PERM_LOGINOK)) { oldgetdata(1, 0, "新的暱稱: ", cuser.username, sizeof(cuser.username), DOECHO); strcpy(currutmp->username, cuser.username); @@ -2707,7 +2707,7 @@ t_users(void) assert(strncmp(cuser.userid, currutmp->userid, IDLEN)==0); if( strncmp(cuser.userid , currutmp->userid, IDLEN) != 0 ){ - if( HAS_PERM(PERM_SYSOP) ) + if( HasUserPerm(PERM_SYSOP) ) vmsg("warning: currutmp userid is changed"); else abort_bbs(0); @@ -3167,7 +3167,7 @@ CallAngel(){ void *screen0; int x, y; - if (!HAS_PERM(PERM_LOGINOK) || entered) + if (!HasUserPerm(PERM_LOGINOK) || entered) return; entered = 1; diff --git a/mbbsd/user.c b/mbbsd/user.c index b6ef27da..533a8dee 100644 --- a/mbbsd/user.c +++ b/mbbsd/user.c @@ -59,7 +59,7 @@ u_loginview(void) } void -user_display(const userec_t * u, int real) +user_display(const userec_t * u, int adminmode) { int diff = 0; char genbuf[200]; @@ -102,7 +102,7 @@ user_display(const userec_t * u, int real) u->exmailbox, u->mobile, u->month, u->day, u->year % 100, u->mychicken.name); #ifdef PLAY_ANGEL - if (real) + if (adminmode) prints(" 小 天 使: %s\n", u->myangel[0] ? u->myangel : "無"); #endif @@ -129,7 +129,7 @@ user_display(const userec_t * u, int real) } #endif - if (real) { + if (adminmode) { strcpy(genbuf, "bTCPRp#@XWBA#VSM0123456789ABCDEF"); for (diff = 0; diff < 32; diff++) if (!(u->userlevel & (1 << diff))) @@ -166,7 +166,7 @@ user_display(const userec_t * u, int real) "\n如果要提昇權限,請參考本站公佈欄辦理註冊"); #ifdef NEWUSER_LIMIT - if ((u->lastlogin - u->firstlogin < 3 * 86400) && !HAS_PERM(PERM_POST)) + if ((u->lastlogin - u->firstlogin < 3 * 86400) && !HasUserPerm(PERM_POST)) outs("\n新手上路,三天後開放權限"); #endif } @@ -296,7 +296,7 @@ void Customize(void) maxc = 'f'; #ifdef PLAY_ANGEL - if( HAS_PERM(PERM_ANGEL) ){ + if( HasUserPerm(PERM_ANGEL) ){ prints("%-40s%10s\n", "g. 開放小主人詢問", (REJECT_QUESTION ? "否" : "是")); prints("%-40s%10s\n", "h. 接受的小主人性別", am[ANGEL_STATUS()]); @@ -348,7 +348,7 @@ void Customize(void) #ifdef PLAY_ANGEL case 'g': - if( HAS_PERM(PERM_ANGEL) ){ + if( HasUserPerm(PERM_ANGEL) ){ SwitchBeingAngel(); } else @@ -356,7 +356,7 @@ void Customize(void) break; case 'h': - if( HAS_PERM(PERM_ANGEL) ){ + if( HasUserPerm(PERM_ANGEL) ){ SwitchAngelSex(ANGEL_STATUS() + 1); } break; @@ -394,7 +394,7 @@ void Customize(void) } void -uinfo_query(userec_t * u, int real, int unum) +uinfo_query(userec_t *u, int adminmode, int unum) { userec_t x; register int i = 0, fail, mail_changed; @@ -407,12 +407,12 @@ uinfo_query(userec_t * u, int real, int unum) fail = mail_changed = 0; memcpy(&x, u, sizeof(userec_t)); - ans = getans(real ? + ans = getans(adminmode ? "(1)改資料(2)設密碼(3)設權限(4)砍帳號(5)改ID" "(6)殺/復活寵物(7)審判 [0]結束 " : "請選擇 (1)修改資料 (2)設定密碼 (C) 個人化設定 ==> [0]結束 "); - if (ans > '2' && ans != 'C' && ans != 'c' && !real) + if (ans > '2' && ans != 'C' && ans != 'c' && !adminmode) ans = '0'; if (ans == '1' || ans == '3') { @@ -436,7 +436,7 @@ uinfo_query(userec_t * u, int real, int unum) getdata_buf(i++, 0, " 暱 稱 :", x.username, sizeof(x.username), DOECHO); - if (real) { + if (adminmode) { getdata_buf(i++, 0, "真實姓名:", x.realname, sizeof(x.realname), DOECHO); getdata_buf(i++, 0, "居住地址:", @@ -449,7 +449,7 @@ uinfo_query(userec_t * u, int real, int unum) x.email); if (strcmp(buf, x.email) && strchr(buf, '@')) { strlcpy(x.email, buf, sizeof(x.email)); - mail_changed = 1 - real; + mail_changed = 1 - adminmode; } snprintf(genbuf, sizeof(genbuf), "%i", (u->sex + 1) % 8); getdata_str(i++, 0, "性別 (1)葛格 (2)姐接 (3)底迪 (4)美眉 (5)薯叔 " @@ -479,7 +479,7 @@ uinfo_query(userec_t * u, int real, int unum) x.year = (buf[6] - '0') * 10 + (buf[7] - '0'); } else continue; - if (!real && (x.month > 12 || x.month < 1 || x.day > 31 || + if (!adminmode && (x.month > 12 || x.month < 1 || x.day > 31 || x.day < 1 || x.year > 90 || x.year < 40)) continue; i++; @@ -487,7 +487,7 @@ uinfo_query(userec_t * u, int real, int unum) } #ifdef PLAY_ANGEL - if (real) + if (adminmode) while (1) { userec_t xuser; getdata_str(i, 0, "小天使:", buf, IDLEN + 1, DOECHO, @@ -545,9 +545,9 @@ uinfo_query(userec_t * u, int real, int unum) } #endif - if (real) { + if (adminmode) { int l; - if (HAS_PERM(PERM_BBSADM)) { + if (HasUserPerm(PERM_BBSADM)) { snprintf(genbuf, sizeof(genbuf), "%d", x.money); if (getdata_str(i++, 0, "銀行帳戶:", buf, 10, DOECHO, genbuf)) if ((l = atol(buf)) != 0) { @@ -658,7 +658,7 @@ uinfo_query(userec_t * u, int real, int unum) case '2': i = 19; - if (!real) { + if (!adminmode) { if (!getdata(i++, 0, "請輸入原密碼:", buf, PASSLEN, NOECHO) || !checkpasswd(u->passwd, buf)) { outs("\n\n您輸入的密碼不正確\n"); @@ -707,8 +707,8 @@ uinfo_query(userec_t * u, int real, int unum) } buf[8] = '\0'; strncpy(x.passwd, genpasswd(buf), PASSLEN); - if (real) - x.userlevel &= (!PERM_LOGINOK); + if (adminmode) + x.userlevel &= (~PERM_LOGINOK); break; case '3': @@ -1657,7 +1657,7 @@ u_list_CB(int num, userec_t * uentp) prints(ANSI_COLOR(7) " 使用者代號 %-25s 上站 文章 %s " "最近光臨日期 " ANSI_COLOR(0) "\n", "綽號暱稱", - HAS_PERM(PERM_SEEULEVELS) ? "等級" : ""); + HasUserPerm(PERM_SEEULEVELS) ? "等級" : ""); i = 3; return 0; } @@ -1708,7 +1708,7 @@ u_list_CB(int num, userec_t * uentp) uentp->userid, uentp->username, uentp->numlogins, uentp->numposts, - HAS_PERM(PERM_SEEULEVELS) ? permstr : "", ptr); + HasUserPerm(PERM_SEEULEVELS) ? permstr : "", ptr); usercounter++; i++; return 0; @@ -1722,7 +1722,7 @@ u_list(void) setutmpmode(LAUSERS); u_list_special = usercounter = 0; totalusers = SHM->number; - if (HAS_PERM(PERM_SEEULEVELS)) { + if (HasUserPerm(PERM_SEEULEVELS)) { getdata(b_lines - 1, 0, "觀看 [1]特殊等級 (2)全部?", genbuf, 3, DOECHO); if (genbuf[0] != '2') diff --git a/mbbsd/vote.c b/mbbsd/vote.c index c5e7bd6a..a12fadfe 100644 --- a/mbbsd/vote.c +++ b/mbbsd/vote.c @@ -1080,7 +1080,7 @@ user_vote(const char *bname) #if 0 // convert the filenames of first vote convert_first_vote(fhp); #endif - if (!HAS_PERM(PERM_LOGINOK)) { + if (!HasUserPerm(PERM_LOGINOK)) { vmsg("對不起! 您未滿二十歲, 還沒有投票權喔!"); return FULLUPDATE; } diff --git a/mbbsd/voteboard.c b/mbbsd/voteboard.c index 864aeb02..ac237f58 100644 --- a/mbbsd/voteboard.c +++ b/mbbsd/voteboard.c @@ -19,7 +19,7 @@ do_voteboardreply(const fileheader_t * fhdr) clear(); - if (!CheckPostPerm()||HAS_PERM(PERM_NOCITIZEN)) { + if (!CheckPostPerm()||HasUserPerm(PERM_NOCITIZEN)) { move(5, 10); vmsg("對不起,您目前無法在此發表文章!"); return; diff --git a/util/buildir.c b/util/buildir.c index cccc8c8a..d8b7e339 100644 --- a/util/buildir.c +++ b/util/buildir.c @@ -102,6 +102,7 @@ int main(int argc, char **argv) if( fhdr.title[i] == '\e' || fhdr.title[i] == '\b' ) fhdr.title[i] = ' '; + printf("%s, owner: %s, title: %s\n", path, fhdr.owner, fhdr.title); break; } } else if(strncmp(buf, "☉ 歡迎光臨", 11) == 0) { diff --git a/util/checkdir.c b/util/checkdir.c index 5c98a874..fb02f43a 100644 --- a/util/checkdir.c +++ b/util/checkdir.c @@ -1,4 +1,4 @@ -/* $Id: checkdir.c 1356 2003-11-22 02:16:02Z victor $ */ +/* $Id$ */ /* typedef struct fileheader_t { char filename[FNLEN]; diff --git a/util/checkmoney.c b/util/checkmoney.c index 0f86420b..a9ad9773 100644 --- a/util/checkmoney.c +++ b/util/checkmoney.c @@ -1,4 +1,4 @@ -/* $Id: checkmoney.c 1645 2004-03-31 01:24:38Z ptt $ */ +/* $Id$ */ #define _UTIL_C_ #include "bbs.h" diff --git a/util/chkhbf.c b/util/chkhbf.c index d4ad5e24..3203a3d0 100644 --- a/util/chkhbf.c +++ b/util/chkhbf.c @@ -1,4 +1,4 @@ -/* $Id: shmctl.c 1484 2004-01-15 17:37:12Z in2 $ */ +/* $Id$ */ #include "bbs.h" struct { diff --git a/util/cleanpasswd.c b/util/cleanpasswd.c index 60ae650d..ffb13393 100644 --- a/util/cleanpasswd.c +++ b/util/cleanpasswd.c @@ -1,4 +1,4 @@ -/* $Id: toplazyBM.c 1096 2003-08-15 06:13:29Z victor $ */ +/* $Id$ */ #define _UTIL_C_ #include "bbs.h" diff --git a/util/gamblegive.c b/util/gamblegive.c index 8bc8d441..9ce66e5c 100644 --- a/util/gamblegive.c +++ b/util/gamblegive.c @@ -1,4 +1,4 @@ -/* $Id: gamblegive.c 1096 2003-08-15 06:13:29Z Ptt $ */ +/* $Id$ */ /* 爭議賭盤 產生紅包機格式 */ #define _UTIL_C_ #include "bbs.h" diff --git a/util/merge_dir.c b/util/merge_dir.c index 37ff8919..1fe74368 100644 --- a/util/merge_dir.c +++ b/util/merge_dir.c @@ -1,4 +1,4 @@ -/* $Id: merge_dir.c 1096 2003-08-15 06:13:29Z victor $ */ +/* $Id$ */ #define _UTIL_C_ #include "bbs.h" diff --git a/util/transman.c b/util/transman.c index 6ed5988e..711e8ead 100644 --- a/util/transman.c +++ b/util/transman.c @@ -1,4 +1,4 @@ -/* $Id: transman 1298 2003-11-04 12:27:48Z Ptt $ */ +/* $Id$ */ // tools to translate the format of eagle bbs -> Ptt bbs */ #include "bbs.h" |