From 6d4da84b0f90c81923e4554783de812128108202 Mon Sep 17 00:00:00 2001
From: rswindell <>
Date: Thu, 14 Mar 2013 07:31:09 +0000
Subject: [PATCH] Implement echicken's idea of using the modopts.ini to
 over-ride the default IRC server and channel (if desired by the sysop).
 modopts.ini is cool and more people should use it. :-)

---
 exec/chat_sec.js | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/exec/chat_sec.js b/exec/chat_sec.js
index 6c27bb4025..e2618d8754 100644
--- a/exec/chat_sec.js
+++ b/exec/chat_sec.js
@@ -7,6 +7,16 @@
 load("sbbsdefs.js");
 load("nodedefs.js");
 
+// Over-ride these default values by creating/modifying the [chat_sec] section in your ctrl/modopts.ini file
+var irc_server = "irc.synchro.net 6667";
+var irc_channel = "#Synchronet"
+var options = load("modopts.js", "chat_sec");
+if (options) {
+    if (options.irc_server)
+        irc_server = options.irc_server;
+    if (options.irc_channel)
+        irc_channel = options.irc_channel;
+}
 var cmdkey;
 
 if(user.compare_ars("rest C")) {
@@ -59,17 +69,16 @@ while(1) {
 			break;
 		case 'R':
 			{
-				var server = "irc.synchro.net 6667";
 				if(user.security.level >= 90 || user.security.exemptions&UFLAG_C) {
 					write("\r\n\001n\001y\001hIRC Server: ");
-					server=console.getstr(server, 40, K_EDIT|K_LINE|K_AUTODEL);
+					server=console.getstr(irc_server, 40, K_EDIT|K_LINE|K_AUTODEL);
 					if(console.aborted)
 						break;
 				}
 				write("\r\n\001n\001y\001hIRC Channel: ");
-				var channel=console.getstr("#Synchronet", 40, K_EDIT|K_LINE|K_AUTODEL);
+				var channel=console.getstr(irc_channel, 40, K_EDIT|K_LINE|K_AUTODEL);
 				if(!console.aborted)
-					bbs.exec("?irc -a " + server + " " + channel);
+					bbs.exec("?irc -a " + irc_server + " " + channel);
 			}
 			break;
 		case 'J':
-- 
GitLab