diff options
Diffstat (limited to 'mbbsd')
-rw-r--r-- | mbbsd/menu.c | 18 | ||||
-rw-r--r-- | mbbsd/talk.c | 10 |
2 files changed, 20 insertions, 8 deletions
diff --git a/mbbsd/menu.c b/mbbsd/menu.c index 6b45d528..7543ae8d 100644 --- a/mbbsd/menu.c +++ b/mbbsd/menu.c @@ -171,9 +171,10 @@ domenu(int cmdmode, char *cmdtitle, int cmd, const commands_t cmdtable[]) int lastcmdptr; int n, pos, total, i; int err; + + // XXX do we really need this ? static char cmd0[MODE_MAX]; - /* XXX: 傳進來的 cmd 若權限不足, 則不知 cursor 在哪, 導致 crash */ if (cmd0[cmdmode]) cmd = cmd0[cmdmode]; @@ -271,6 +272,15 @@ domenu(int cmdmode, char *cmdtitle, int cmd, const commands_t cmdtable[]) while (++i <= total) if (cmdtable[i].desc[1] == cmd) break; + + if (!HAS_PERM(cmdtable[i].level)) { + for (i = 0; cmdtable[i].desc; i++) + if (HAS_PERM(cmdtable[i].level)) + break; + if (!cmdtable[i].desc) + return; + } + if (cmd == 'H' && i > total){ /* TODO: Add menu help */ } @@ -324,10 +334,10 @@ const static commands_t adminlist[] = { const static commands_t maillist[] = { {m_new, PERM_READMAIL, "RNew 閱\讀新進郵件"}, {m_read, PERM_READMAIL, "RRead 多功\能讀信選單"}, - {m_send, PERM_BASIC, "RSend 站內寄信"}, + {m_send, PERM_LOGINOK, "RSend 站內寄信"}, {x_love, PERM_LOGINOK, "PPaper \033[1;32m情書產生器\033[m "}, - {mail_list, PERM_BASIC, "RMail List 群組寄信"}, - {setforward, PERM_LOGINOK,"FForward \033[32m設定信箱自動轉寄\033[m"}, + {mail_list, PERM_LOGINOK, "RMail List 群組寄信"}, + {setforward, PERM_LOGINOK, "FForward \033[32m設定信箱自動轉寄\033[m"}, {m_sysop, 0, "YYes, sir! 諂媚站長"}, {m_internet, PERM_INTERNET, "RInternet 寄信到 Internet"}, {mail_mbox, PERM_INTERNET, "RZip UserHome 把所有私人資料打包回去"}, diff --git a/mbbsd/talk.c b/mbbsd/talk.c index c7db75f1..6d14f4c9 100644 --- a/mbbsd/talk.c +++ b/mbbsd/talk.c @@ -2647,10 +2647,12 @@ userlist(void) break; case 'N': - oldgetdata(1, 0, "新的暱稱: ", - cuser.username, sizeof(cuser.username), DOECHO); - strcpy(currutmp->username, cuser.username); - redrawall = redraw = 1; + if (HAS_PERM(PERM_LOGINOK)) { + oldgetdata(1, 0, "新的暱稱: ", + cuser.username, sizeof(cuser.username), DOECHO); + strcpy(currutmp->username, cuser.username); + redrawall = redraw = 1; + } break; case 'y': |