Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 0dd4b358 authored by rswindell's avatar rswindell

Displays dynamic protocol menu (using new TEXT.DAT entry: TransferProtLstFmt)

if text/menu/*prot.asc does not exist.
parent 0467e0a6
......@@ -117,7 +117,7 @@ void sbbs_t::batchmenu()
bputs(text[NotEnoughTimeToDl]);
break;
}
menu("biprot");
xfer_prot_menu(XFER_BIDIR);
if(!create_batchdn_lst())
break;
if(!create_batchup_lst())
......@@ -278,7 +278,7 @@ void sbbs_t::batchmenu()
bputs(text[UploadQueueIsEmpty]);
break;
}
menu("batuprot");
xfer_prot_menu(XFER_BATCH_UPLOAD);
if(!create_batchup_lst())
break;
if(!create_bimodem_pth())
......@@ -370,7 +370,7 @@ BOOL sbbs_t::start_batch_download()
bputs(text[NotEnoughTimeToDl]);
return(FALSE);
}
menu("batdprot");
xfer_prot_menu(XFER_BATCH_DOWNLOAD);
if(!create_batchdn_lst())
return(FALSE);
if(!create_bimodem_pth())
......
......@@ -125,7 +125,7 @@ bool sbbs_t::email(int usernumber, char *top, char *subj, long mode)
strcat(str,title);
mv(str,str2,1); }
else { /* Remote */
menu("ulprot");
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
strcpy(str,"Q");
for(x=0;x<cfg.total_prots;x++)
......
......@@ -361,7 +361,7 @@ int sbbs_t::exec_function(csi_t *csi)
case CS_FILE_SEND:
csi->logic=LOGIC_FALSE;
menu("dlprot");
xfer_prot_menu(XFER_DOWNLOAD);
mnemonics(text[ProtocolOrQuit]);
strcpy(str,"Q");
for(i=0;i<cfg.total_prots;i++)
......@@ -388,7 +388,7 @@ int sbbs_t::exec_function(csi_t *csi)
case CS_FILE_RECEIVE:
csi->logic=LOGIC_FALSE;
menu("ulprot");
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
strcpy(str,"Q");
for(i=0;i<cfg.total_prots;i++)
......
......@@ -236,7 +236,7 @@ bool sbbs_t::netmail(char *into, char *title, long mode)
if(mv(str,subj,1))
return(false);
} else { /* Remote */
menu("ulprot");
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
strcpy(str,"Q");
for(x=0;x<cfg.total_prots;x++)
......
......@@ -1220,7 +1220,7 @@ int sbbs_t::listfileinfo(uint dirnum, char *filespec, long mode)
found=-1;
break; }
continue; }
menu("dlprot");
xfer_prot_menu(XFER_DOWNLOAD);
openfile(&f);
SYNC;
mnemonics(text[ProtocolBatchQuitOrNext]);
......
......@@ -113,7 +113,7 @@ bool sbbs_t::inetmail(char *into, char *subj, long mode)
strcat(str,title);
mv(str,str2,1); }
else { /* Remote */
menu("ulprot");
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
strcpy(str,"Q");
for(x=0;x<cfg.total_prots;x++)
......
......@@ -188,7 +188,7 @@ void sbbs_t::printtail(char *str, int lines, long mode)
/* Called from every function that has an available menu. */
/* The code definitions are as follows: */
/****************************************************************************/
void sbbs_t::menu(char *code)
void sbbs_t::menu(const char *code)
{
char str[MAX_PATH+1],path[MAX_PATH+1];
......
......@@ -563,7 +563,7 @@ void sbbs_t::qwk_sec()
last_ns_time=ns_time;
continue; }
bprintf(text[UploadingREP],cfg.sys_id);
menu("biprot");
xfer_prot_menu(XFER_BIDIR);
mnemonics(text[ProtocolOrQuit]);
strcpy(tmp2,"Q");
for(i=0;i<cfg.total_prots;i++)
......@@ -663,7 +663,7 @@ void sbbs_t::qwk_sec()
/***************/
/* Send Packet */
/***************/
menu("dlprot");
xfer_prot_menu(XFER_DOWNLOAD);
mnemonics(text[ProtocolOrQuit]);
strcpy(tmp2,"Q");
for(i=0;i<cfg.total_prots;i++)
......@@ -738,7 +738,7 @@ void sbbs_t::qwk_sec()
/******************/
/* Receive Packet */
/******************/
menu("ulprot");
xfer_prot_menu(XFER_UPLOAD);
mnemonics(text[ProtocolOrQuit]);
strcpy(tmp2,"Q");
for(i=0;i<cfg.total_prots;i++)
......
......@@ -254,7 +254,7 @@ void sbbs_t::readmail(uint usernumber, int which)
,fd.name,ultoac(length,tmp)); } } }
else { /* Remote User */
menu("dlprot");
xfer_prot_menu(XFER_DOWNLOAD);
mnemonics(text[ProtocolOrQuit]);
strcpy(str3,"Q");
for(i=0;i<cfg.total_prots;i++)
......
......@@ -369,6 +369,8 @@ public:
void sys_info(void);
void user_info(void);
void xfer_policy(void);
void xfer_prot_menu(enum XFER_TYPE);
void node_stats(uint node_num);
void sys_stats(void);
void logonlist(void);
......@@ -502,7 +504,7 @@ public:
/* prntfile.cpp */
void printfile(char *str, long mode);
void printtail(char *str, int lines, long mode);
void menu(char *code);
void menu(const char *code);
int uselect(int add, uint n, char *title, char *item, uchar *ar);
uint uselect_total, uselect_num[500];
......
......@@ -780,7 +780,15 @@ enum { /* Values for 'mode' in listfileinfo */
,FI_USERXFER /* User Xfer Download */
,FI_CLOSE /* Close any open records */
};
enum XFER_TYPE { /* Values for type in xfer_prot_select() */
XFER_UPLOAD
,XFER_DOWNLOAD
,XFER_BATCH_UPLOAD
,XFER_BATCH_DOWNLOAD
,XFER_BIDIR
};
#define L_LOGON 1 /* Logon List maintenance */
#define LOL_SIZE 81 /* Length of each logon list entry */
......
......@@ -924,6 +924,47 @@ void sbbs_t::xfer_policy()
}
}
const char* prot_menu_file[] = {
"ulprot"
,"dlprot"
,"batuprot"
,"batdprot"
,"biprot"
};
void sbbs_t::xfer_prot_menu(enum XFER_TYPE type)
{
char path[MAX_PATH+1];
sprintf(path,"%smenu/%s.*",cfg.text_dir,prot_menu_file[type]);
if(fexistcase(path)) {
menu(prot_menu_file[type]);
return;
}
CRLF;
int printed=0;
for(int i=0;i<cfg.total_prots;i++) {
if(!chk_ar(cfg.prot[i]->ar,&useron))
continue;
if(type==XFER_UPLOAD && cfg.prot[i]->ulcmd[0]==0)
continue;
if(type==XFER_DOWNLOAD && cfg.prot[i]->dlcmd[0]==0)
continue;
if(type==XFER_BATCH_UPLOAD && cfg.prot[i]->batulcmd[0]==0)
continue;
if(type==XFER_BATCH_DOWNLOAD && cfg.prot[i]->batdlcmd[0]==0)
continue;
if(type==XFER_BIDIR && cfg.prot[i]->bicmd[0]==0)
continue;
if(printed && (printed%2)==0)
CRLF;
bprintf(text[TransferProtLstFmt],cfg.prot[i]->mnemonic,cfg.prot[i]->name);
printed++;
}
CRLF;
}
void sbbs_t::node_stats(uint node_num)
{
char tmp[128];
......
......@@ -199,7 +199,7 @@ enum {
,StatsFeedbacksToday
,ChUserPrompt
,ChUserPwPrompt
,NBytesFreeMemory
,Unused156
,ErrorLogHdr
,DeleteErrorLogQ
,NoErrorLogExists
......@@ -228,7 +228,7 @@ enum {
,LibLstFmt
,InvalidNetMailAddr
,TransferPolicyHdr
,Unused185
,TransferProtLstFmt
,TpUpload
,TpDownload
,NoUserDir
......
......@@ -150,7 +150,7 @@ void sbbs_t::temp_xfer()
bputs(text[CantDownloadFromDir]);
break; }
addfiledat(&cfg,&f);
menu("dlprot");
xfer_prot_menu(XFER_DOWNLOAD);
SYNC;
mnemonics(text[ProtocolOrQuit]);
strcpy(tmp2,"Q");
......
......@@ -457,7 +457,7 @@ bool sbbs_t::upload(uint dirnum)
if(!uploadfile(&f))
return(false);
} else {
menu("ulprot");
xfer_prot_menu(XFER_UPLOAD);
SYNC;
strcpy(keys,"Q");
if(dirnum==cfg.user_dir || !cfg.max_batup) /* no batch user to user xfers */
......
......@@ -998,7 +998,7 @@ void sbbs_t::maindflts(user_t* user)
remove(str);
break;
case 'Z':
menu("dlprot");
xfer_prot_menu(XFER_DOWNLOAD);
SYNC;
mnemonics(text[ProtocolOrQuit]);
strcpy(str,"Q");
......
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