Commit 407895b0 authored by rswindell's avatar rswindell

Use menu(..., P_NOERROR)'s result rather than calling menu_exists() and then

menu() if it does (exist) and doing something else if it doesn't.
parent 33587951
......@@ -368,9 +368,7 @@ void sbbs_t::multinodechat(int channel)
done=1;
break;
case '*':
if(menu_exists("chan"))
menu("chan");
else {
if(!menu("chan", P_NOERROR)) {
bputs(text[ChatChanLstHdr]);
bputs(text[ChatChanLstTitles]);
if(cfg.total_chans>=10) {
......
......@@ -53,9 +53,7 @@ int sbbs_t::exec_file(csi_t *csi)
while(online) {
j=0;
if(usrlibs>1) {
if(menu_exists("libs"))
menu("libs");
else {
if(!menu("libs", P_NOERROR)) {
bputs(text[CfgLibLstHdr]);
for(i=0;i<usrlibs && !msgabort();i++) {
if(i==curlib)
......@@ -78,10 +76,7 @@ int sbbs_t::exec_file(csi_t *csi)
j--;
}
sprintf(str,"dirs%u",usrlib[j]+1);
if(menu_exists(str)) {
menu(str);
}
else {
if(!menu(str, P_NOERROR)) {
CLS;
bprintf(text[DirLstHdr], cfg.lib[usrlib[j]]->lname);
for(i=0;i<usrdirs[j] && !msgabort();i++) {
......@@ -200,8 +195,7 @@ int sbbs_t::exec_file(csi_t *csi)
case CS_FILE_SHOW_LIBRARIES:
if(!usrlibs) return(0);
if(menu_exists("libs")) {
menu("libs");
if(menu("libs"), P_NOERROR) {
return(0);
}
bputs(text[LibLstHdr]);
......@@ -218,8 +212,7 @@ int sbbs_t::exec_file(csi_t *csi)
case CS_FILE_SHOW_DIRECTORIES:
if(!usrlibs) return(0);
sprintf(str,"dirs%u",usrlib[curlib]+1);
if(menu_exists(str)) {
menu(str);
if(menu(str, P_NOERROR)) {
return(0);
}
CRLF;
......
......@@ -51,9 +51,7 @@ int sbbs_t::exec_msg(csi_t *csi)
while(online) {
j=0;
if(usrgrps>1) {
if(menu_exists("grps"))
menu("grps");
else {
if(!menu("grps", P_NOERROR)) {
bputs(text[CfgGrpLstHdr]);
for(i=0;i<usrgrps && !msgabort();i++) {
if(i==curgrp)
......@@ -75,10 +73,7 @@ int sbbs_t::exec_msg(csi_t *csi)
j--;
}
sprintf(str,"subs%u",usrgrp[j]+1);
if(menu_exists(str)) {
menu(str);
}
else {
if(!menu(str, P_NOERROR)) {
CLS;
bprintf(text[SubLstHdr], cfg.grp[usrgrp[j]]->lname);
for(i=0;i<usrsubs[j] && !msgabort();i++) {
......@@ -207,8 +202,7 @@ int sbbs_t::exec_msg(csi_t *csi)
case CS_MSG_SHOW_GROUPS:
if(!usrgrps) return(0);
if(menu_exists("grps")) {
menu("grps");
if(menu("grps", P_NOERROR)) {
return(0);
}
bputs(text[GrpLstHdr]);
......@@ -225,8 +219,7 @@ int sbbs_t::exec_msg(csi_t *csi)
case CS_MSG_SHOW_SUBBOARDS:
if(!usrgrps) return(0);
sprintf(str,"subs%u",usrgrp[curgrp]+1);
if(menu_exists(str)) {
menu(str);
if(menu(str, P_NOERROR)) {
return(0);
}
CRLF;
......
......@@ -132,9 +132,7 @@ void sbbs_t::show_msghdr(smbmsg_t* msg)
else
CRLF;
if(menu_exists("msghdr")) {
menu("msghdr");
} else {
if(!menu("msghdr", P_NOERROR)) {
bprintf(text[MsgSubj],msg->subj);
if(msg->tags && *msg->tags)
bprintf(text[MsgTags], msg->tags);
......
......@@ -81,9 +81,7 @@ BOOL sbbs_t::newuser()
logline(LOG_NOTICE,"N!",tmp);
}
if(c==4) {
const char* nupguess = "../nupguess";
if(menu_exists(nupguess))
menu(nupguess, P_NOABORT);
menu("../nupguess", P_NOABORT|P_NOERROR);
hangup();
return(FALSE);
}
......@@ -162,14 +160,14 @@ BOOL sbbs_t::newuser()
if(useron.misc&ANSI) {
useron.rows=0; /* Auto-rows */
if(!(cfg.uq&UQ_COLORTERM) || useron.misc&(RIP|WIP|HTML) || text[ColorTerminalQ][0]==0 || yesno(text[ColorTerminalQ]))
if(!(cfg.uq&UQ_COLORTERM) || useron.misc&(RIP|WIP|HTML) || yesno(text[ColorTerminalQ]))
useron.misc|=COLOR;
else
useron.misc&=~COLOR;
}
else
useron.rows=24;
if(!(useron.misc&PETSCII) && text[ExAsciiTerminalQ][0] && !yesno(text[ExAsciiTerminalQ]))
if(!(useron.misc&PETSCII) && !yesno(text[ExAsciiTerminalQ]))
useron.misc|=NO_EXASCII;
else
useron.misc&=~NO_EXASCII;
......@@ -306,15 +304,9 @@ BOOL sbbs_t::newuser()
SAFEPRINTF(str,"New user: %s",useron.alias);
logline("N",str);
if(!online) return(FALSE);
const char* fname = "../sbbs";
if(menu_exists(fname))
menu(fname, P_NOABORT);
fname = "../system";
if(menu_exists(fname))
menu(fname, P_NOABORT);
fname = "../newuser";
if(menu_exists(fname))
menu(fname, P_NOABORT);
menu("../sbbs", P_NOABORT|P_NOERROR);
menu("../system", P_NOABORT|P_NOERROR);
menu("../newuser", P_NOABORT|P_NOERROR);
answertime=time(NULL); /* could take 10 minutes to get this far */
/* Default editor (moved here, after terminal type setup Jan-2003) */
......@@ -429,9 +421,7 @@ BOOL sbbs_t::newuser()
delallmail(useron.number, MAIL_ANY);
if(useron.number!=1 && cfg.node_valuser) {
const char* fname = "../feedback";
if(menu_exists(fname))
menu(fname, P_NOABORT);
menu("../feedback", P_NOABORT|P_NOERROR);
safe_snprintf(str,sizeof(str),text[NewUserFeedbackHdr]
,nulstr,getage(&cfg,useron.birth),useron.sex,useron.birth
,useron.name,useron.phone,useron.comp,useron.modem);
......
......@@ -941,15 +941,13 @@ void sbbs_t::user_info()
void sbbs_t::xfer_policy()
{
if(!usrlibs) return;
if(menu_exists("tpolicy"))
menu("tpolicy");
else {
if(!menu("tpolicy", P_NOERROR)) {
bprintf(text[TransferPolicyHdr],cfg.sys_name);
bprintf(text[TpUpload]
,cfg.dir[usrdir[curlib][curdir[curlib]]]->up_pct);
bprintf(text[TpDownload]
,cfg.dir[usrdir[curlib][curdir[curlib]]]->dn_pct);
}
}
}
const char* prot_menu_file[] = {
......@@ -962,8 +960,7 @@ const char* prot_menu_file[] = {
void sbbs_t::xfer_prot_menu(enum XFER_TYPE type)
{
if(menu_exists(prot_menu_file[type])) {
menu(prot_menu_file[type]);
if(menu(prot_menu_file[type], P_NOERROR)) {
return;
}
......
......@@ -790,9 +790,7 @@ ulong sbbs_t::msgeditor(char *buf, const char *top, char *title)
bprintf("\r\nMessage editor: Read in %d lines\r\n",lines);
bprintf(text[EnterMsgNow],maxlines);
if(menu_exists("msgtabs"))
menu("msgtabs");
else {
if(!menu("msgtabs")) {
for(i=0; i < (cols-1); i++) {
if(i%EDIT_TABSIZE || !i)
outchar('-');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment