Skip to content
Snippets Groups Projects
Commit 46acf140 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

When adding a node, prompt to update Terminal Server LastNode value

This is an easily overlooked setting, let's make it easier
parent 17bf55d4
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4009 passed
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
****************************************************************************/ ****************************************************************************/
#include "scfg.h" #include "scfg.h"
#include "sbbs_ini.h"
static char* node_path_help = static char* node_path_help =
"`Node Directory:`\n" "`Node Directory:`\n"
...@@ -29,6 +30,29 @@ static char* node_path_help = ...@@ -29,6 +30,29 @@ static char* node_path_help =
"that can be accessed by `ALL` nodes of the BBS.\n" "that can be accessed by `ALL` nodes of the BBS.\n"
; ;
void adjust_last_node()
{
char ini_fname[MAX_PATH + 1];
const char* section = "bbs";
const char* key = "LastNode";
sbbs_get_ini_fname(ini_fname, cfg.ctrl_dir);
FILE* fp = iniOpenFile(ini_fname, /* modify */false);
str_list_t ini = iniReadFile(fp);
iniCloseFile(fp);
uint last_node = iniGetUInteger(ini, section, key, cfg.sys_nodes);
char prompt[128];
SAFEPRINTF(prompt, "Update Terminal Server 'LastNode' value to %u", cfg.sys_nodes);
if(last_node < cfg.sys_nodes && uifc.confirm(prompt)) {
fp = iniOpenFile(ini_fname, /* modify */true);
iniSetUInteger(&ini, section, key, cfg.sys_nodes, NULL);
iniWriteFile(fp, ini);
iniCloseFile(fp);
}
iniFreeStringList(ini);
}
void node_menu() void node_menu()
{ {
char str[81],savnode=0; char str[81],savnode=0;
...@@ -92,6 +116,7 @@ void node_menu() ...@@ -92,6 +116,7 @@ void node_menu()
--cfg.sys_nodes; --cfg.sys_nodes;
cfg.new_install=new_install; cfg.new_install=new_install;
save_main_cfg(&cfg,backup_level); save_main_cfg(&cfg,backup_level);
adjust_last_node();
refresh_cfg(&cfg); refresh_cfg(&cfg);
} }
continue; continue;
...@@ -112,7 +137,7 @@ void node_menu() ...@@ -112,7 +137,7 @@ void node_menu()
} }
sprintf(tmp,"Node %d Directory",i); sprintf(tmp,"Node %d Directory",i);
uifc.helpbuf=node_path_help; uifc.helpbuf=node_path_help;
j=uifc.input(WIN_MID,0,0,tmp,str,50,K_EDIT); j=uifc.input(WIN_MID|WIN_SAV,0,0,tmp,str,50,K_EDIT);
uifc.changes=0; uifc.changes=0;
if(j<2) if(j<2)
continue; continue;
...@@ -125,6 +150,7 @@ void node_menu() ...@@ -125,6 +150,7 @@ void node_menu()
save_node_cfg(&cfg,backup_level); save_node_cfg(&cfg,backup_level);
save_main_cfg(&cfg,backup_level); save_main_cfg(&cfg,backup_level);
free_node_cfg(&cfg); free_node_cfg(&cfg);
adjust_last_node();
refresh_cfg(&cfg); refresh_cfg(&cfg);
continue; continue;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment