Commit df3de69c authored by rswindell's avatar rswindell

3 new configurable system loadable modules:

- nodelist (default: "nodelist")
- who's online (default: "nodelist -active")
- private message (default: "privatemsg")

This allows the nodelist and private message modules to be "installed" without
over-riding global hot key events (SCFG->External Programs->Global Hot Key
Events), allows the Baja functions NODELIST_ALL, NODELIST_USERS, and
PRIVATE_MESSAGE and JS bbs.list_nodes(), bbs.whos_online(), and
bbs.private_message() methods to use external modules (JS or Baja)
automatically.

The old C++ logic remains for these features if the module's are cleared (set
to a blank string) in SCFG, but at some point, that code will likely be removed.
parent 4ac95d29
......@@ -1354,9 +1354,14 @@ void sbbs_t::nodemsg()
if(nodemsg_inside>1) /* nested once only */
return;
nodemsg_inside++;
if(cfg.privatemsg_mod[0] != '\0') {
exec_bin(cfg.privatemsg_mod, &main_csi);
nodemsg_inside--;
return;
}
sys_status|=SS_IN_CTRLP;
getnodedat(cfg.node_num,&savenode,0);
nodemsg_inside++;
wordwrap[0]=0;
while(online && !done) {
if(useron.rest&FLAG('C')) {
......
......@@ -377,6 +377,10 @@ int sbbs_t::whos_online(bool listself)
int i,j;
node_t node;
if(cfg.whosonline_mod[0] != '\0') {
return exec_bin(cfg.whosonline_mod, &main_csi);
}
CRLF;
bputs(text[NodeLstHdr]);
for(j=0,i=1;i<=cfg.sys_nodes && i<=cfg.sys_lastnode;i++) {
......@@ -402,6 +406,11 @@ void sbbs_t::nodelist(void)
{
node_t node;
if(cfg.nodelist_mod[0] != '\0') {
exec_bin(cfg.nodelist_mod, &main_csi);
return;
}
CRLF;
bputs(text[NodeLstHdr]);
for(int i=1;i<=cfg.sys_nodes && i<=cfg.sys_lastnode;i++) {
......
......@@ -601,6 +601,9 @@ typedef struct
char scanposts_mod[LEN_CMD+1]; /* Scanning posts (in a single sub) module */
char scansubs_mod[LEN_CMD+1]; /* Scanning sub-boards module */
char listmsgs_mod[LEN_CMD+1]; /* Listing messages module */
char nodelist_mod[LEN_CMD+1];
char whosonline_mod[LEN_CMD+1];
char privatemsg_mod[LEN_CMD+1];
char scfg_cmd[LEN_CMD+1]; /* SCFG command line - unused! */
uchar smb_retry_time; /* Seconds to retry on SMBs */
uint16_t sec_warn; /* Seconds before inactivity warning */
......
......@@ -313,7 +313,16 @@ BOOL read_main_cfg(scfg_t* cfg, char* error)
get_int(c, instream);
for(i=0;i<21;i++) /* unused - initialized to NULL */
get_int(n,instream);
for(i=0;i<254;i++) /* unused - initialized to 0xff */
get_str(cfg->nodelist_mod,instream);
if(cfg->nodelist_mod[0] == '\xff')
SAFECOPY(cfg->nodelist_mod, "nodelist");
get_str(cfg->whosonline_mod,instream);
if(cfg->whosonline_mod[0] == '\xff')
SAFECOPY(cfg->whosonline_mod, "nodelist -active");
get_str(cfg->privatemsg_mod,instream);
if(cfg->privatemsg_mod[0] == '\xff')
SAFECOPY(cfg->privatemsg_mod, "privatemsg");
for(i=0;i<158;i++) /* unused - initialized to 0xff */
get_int(n,instream);
get_int(cfg->user_backup_level,instream);
......
......@@ -277,8 +277,11 @@ BOOL DLLCALL write_main_cfg(scfg_t* cfg, int backup_level)
n=0;
for(i=0;i<26;i++)
put_int(n,stream);
put_str(cfg->nodelist_mod, stream);
put_str(cfg->whosonline_mod, stream);
put_str(cfg->privatemsg_mod, stream);
n=0xffff;
for(i=0;i<254;i++)
for(i=0;i<158;i++)
put_int(n,stream);
put_int(cfg->user_backup_level,stream);
......
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