From b8415409477c62175ba2d4bb40d58f615e80af3c Mon Sep 17 00:00:00 2001
From: "Rob Swindell (on Windows 11)" <rob@synchro.net>
Date: Sun, 18 Feb 2024 23:30:42 -0800
Subject: [PATCH] Display warning dialog when changing cmdshell or xtrn
 editor's internal codes

Changing a command shell or an external editor's internal code will revert
the preference of any user's that have selected that shell or editor as their
default/preference. A sysop may not realize this, so warn them with lots of
detail in the help text if they need it. See issue #721 for details.

Also updated the help text for command shell internal codes since it still
only mentioned Baja/.bin modules.
---
 src/sbbs3/scfg/scfg.c     | 19 ++++++++++++++-----
 src/sbbs3/scfg/scfgxtrn.c |  8 ++++++++
 2 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/sbbs3/scfg/scfg.c b/src/sbbs3/scfg/scfg.c
index fe8238a0f1..385d4a1404 100644
--- a/src/sbbs3/scfg/scfg.c
+++ b/src/sbbs3/scfg/scfg.c
@@ -1457,17 +1457,26 @@ void shell_cfg()
 						SAFECOPY(cfg.shell[i]->name,str);
 					break;
 				case 1:
+					uifc.helpbuf=
+						"`WARNING:`\n"
+						"\n"
+						"If you change a command shell's internal code, any users that have\n"
+						"chosen that shell as their default, will be reverted to the default\n"
+						"command shell for new users or the first configured command shell\n"
+						"for which they meet the access requirements.";
+					if(uifc.deny("Changing a shell's internal code is not recommended. Edit anyway?"))
+						break;
 					SAFECOPY(str,cfg.shell[i]->code);
 					uifc.helpbuf=
 						"`Command Shell Internal Code:`\n"
 						"\n"
 						"Every command shell must have its own unique internal code for\n"
-						"Synchronet to reference it by. It is helpful if this code is an\n"
-						"abbreviation of the name.\n"
+						"Synchronet to reference it by.\n"
 						"\n"
-						"This code will be the base filename used to load the shell from your\n"
-						"`exec` directory. e.g. A shell with an internal code of `MYBBS` would\n"
-						"indicate a Baja shell file named `mybbs.bin` in your `exec` directory.\n"
+						"This code will be the base filename of the command shell script/module.\n"
+						"e.g. A shell with an internal code of `MYBBS` would correlate with a\n"
+						"Baja shell file named `mybbs.bin` or a JavaScript module named `mybbs.js`\n"
+						"located in your `exec` or `mods` directories.\n"
 					;
 					uifc.input(WIN_MID|WIN_SAV,0,17,"Internal Code (unique)"
 						,str,LEN_CODE,K_EDIT|K_UPPER|K_NOSPACE);
diff --git a/src/sbbs3/scfg/scfgxtrn.c b/src/sbbs3/scfg/scfgxtrn.c
index b2068175fd..2f7558d399 100644
--- a/src/sbbs3/scfg/scfgxtrn.c
+++ b/src/sbbs3/scfg/scfgxtrn.c
@@ -1949,6 +1949,14 @@ void xedit_cfg()
 						SAFECOPY(cfg.xedit[i]->name,str);
 					break;
 				case 1:
+					uifc.helpbuf=
+						"`WARNING:`\n"
+						"\n"
+						"If you change an external editor's internal code, any users that have\n"
+						"chosen that editor as their default, will be reverted to the internal\n"
+						"message editor as their default preference (that they can then change).";
+					if(uifc.deny("Changing an editor's internal code is not recommended. Edit anyway?"))
+						break;
 					SAFECOPY(str,cfg.xedit[i]->code);
 					uifc.helpbuf=
 						"`Message Editor Internal Code:`\n"
-- 
GitLab