From d99d01e30bd29626aa1f0b7d95c4c2bfeb056997 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Sat, 20 Jun 2015 13:40:20 +0200 Subject: [PATCH] ship with modules.full.conf (rather than modules.conf) and add note as to not to edit this file directly. add updconf stuff for new layout (badwords, help, etc) --- Makefile.in | 4 ++ doc/conf/examples/example.conf | 4 +- doc/conf/examples/example.fr.conf | 4 +- doc/conf/{modules.conf => modules.full.conf} | 14 +++++- src/modules.c | 2 +- src/s_conf.c | 2 +- src/updconf.c | 49 ++++++++++++++++++-- src/win32/unrealinst.iss | 2 +- 8 files changed, 68 insertions(+), 13 deletions(-) rename doc/conf/{modules.conf => modules.full.conf} (87%) diff --git a/Makefile.in b/Makefile.in index 0e6926883..7018c7be1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -190,6 +190,10 @@ install: all $(INSTALL) -m 0600 doc/conf/*.conf @CONFDIR@ $(INSTALL) -m 0700 -d @CONFDIR@/aliases $(INSTALL) -m 0600 doc/conf/aliases/*.conf @CONFDIR@/aliases + $(INSTALL) -m 0700 -d @CONFDIR@/help + $(INSTALL) -m 0600 doc/conf/help/*.conf @CONFDIR@/help + $(INSTALL) -m 0700 -d @CONFDIR@/examples + $(INSTALL) -m 0600 doc/conf/examples/*.conf @CONFDIR@/examples $(INSTALL) -m 0700 -d @CONFDIR@/ssl $(INSTALL) -m 0600 doc/conf/ssl/curl-ca-bundle.crt @CONFDIR@/ssl $(INSTALL) -m 0700 unrealircd @SCRIPTDIR@ diff --git a/doc/conf/examples/example.conf b/doc/conf/examples/example.conf index 924319ff8..a981f2271 100644 --- a/doc/conf/examples/example.conf +++ b/doc/conf/examples/example.conf @@ -22,11 +22,11 @@ # This is also a comment, again this line is ignored (comment type #3) /* UnrealIRCd makes heavy use of modules. By using this include we - * tell the ircd to read the file 'modules.conf' which contains of + * tell the ircd to read the file 'modules.full.conf' which contains * more than a hundred loadmodule lines that load all the necessary * modules. */ -include "modules.conf"; +include "modules.full.conf"; /* Now let's include some other files as well: * - help.conf for our on-IRC /HELPOP system diff --git a/doc/conf/examples/example.fr.conf b/doc/conf/examples/example.fr.conf index 51b144e8c..0f190b46b 100644 --- a/doc/conf/examples/example.fr.conf +++ b/doc/conf/examples/example.fr.conf @@ -33,9 +33,9 @@ /* * UnrealIRCd supporte des modules et certains sont obligatoires. - * La ligne suivante charge tous les modules définis dans modules.conf + * La ligne suivante charge tous les modules définis dans modules.full.conf */ -include "modules.conf"; +include "modules.full.conf"; /* * Vous pouvez également inclure d'autres fichiers de configuration. diff --git a/doc/conf/modules.conf b/doc/conf/modules.full.conf similarity index 87% rename from doc/conf/modules.conf rename to doc/conf/modules.full.conf index ca3c71a4d..0f81e6874 100644 --- a/doc/conf/modules.conf +++ b/doc/conf/modules.full.conf @@ -1,5 +1,15 @@ -/* - * Modules configuration stub... More work will be done on this later. +/* This file will load (nearly) all modules available on UnrealIRCd. + * So all commands, channel modes, user modes, etc.. + * + * If you want to have all UnrealIRCd functionality, then include this + * file from your unrealircd.conf by using: + * include "modules.full.conf"; + * + * DO NOT EDIT THIS FILE! IT WILL BE OVERWRITTEN DURING NEXT UPGRADE! + * + * Instead, if you want to customize the modules to load, make a + * copy of this file (eg: name it modules.custom.conf) and edit it. + * Then include that file from your unrealircd.conf instead of this one. */ loadmodule "cloak"; diff --git a/src/modules.c b/src/modules.c index 7b6c0f90e..0c2f87f28 100644 --- a/src/modules.c +++ b/src/modules.c @@ -1616,7 +1616,7 @@ int i, n, errors=0; if (n < 1) { config_error("ERROR: efunction '%s' not found, you probably did not " - "load all required modules! (hint: see modules.conf)", + "load all required modules! (hint: see modules.full.conf)", efunction_table[i].name); errors++; } else diff --git a/src/s_conf.c b/src/s_conf.c index 6a3abf8fe..51c0bcf0c 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -8220,7 +8220,7 @@ int _conf_loadmodule(ConfigFile *conf, ConfigEntry *ce) { config_error("%s:%i: You are trying to load the 'commands' module, this is no longer supported. " "Fix this by editing your configuration file: remove the loadmodule line for commands and add the following line instead: " - "include \"modules.conf\";", + "include \"modules.full.conf\";", ce->ce_fileptr->cf_filename, ce->ce_varlinenum); need_34_upgrade = 1; return -1; diff --git a/src/updconf.c b/src/updconf.c index b13728aaf..f81efb1b1 100644 --- a/src/updconf.c +++ b/src/updconf.c @@ -498,16 +498,16 @@ int upgrade_loadmodule(ConfigEntry *ce) if (our_strcasestr(file, "commands.dll") || our_strcasestr(file, "/commands.so")) { - snprintf(buf, sizeof(buf), "include \"modules.conf\";\n"); + snprintf(buf, sizeof(buf), "include \"modules.full.conf\";\n"); replace_section(ce, buf); - config_status("- loadmodule for '%s' replaced with an include \"modules.conf\"", file); + config_status("- loadmodule for '%s' replaced with an include \"modules.full.conf\"", file); return 1; } if (our_strcasestr(file, "cloak.dll") || our_strcasestr(file, "/cloak.so")) { - replace_section(ce, "/* NOTE: cloaking module is included in modules.conf */"); - config_status("- loadmodule for '%s' removed as this is now in modules.conf", file); + replace_section(ce, "/* NOTE: cloaking module is included in modules.full.conf */"); + config_status("- loadmodule for '%s' removed as this is now in modules.full.conf", file); return 1; } @@ -532,6 +532,40 @@ int upgrade_loadmodule(ConfigEntry *ce) return 1; } +int upgrade_include(ConfigEntry *ce) +{ + char *file = ce->ce_vardata; + char tmp[512], *p, *newfile; + static int badwords_upgraded_already = 0; + + if (!file) + return 0; + + if (!strstr(file, "help/") && !_match("help*.conf", file)) + { + snprintf(buf, sizeof(buf), "include \"help/%s\";\n", file); + replace_section(ce, buf); + config_status("- include for '%s' replaced with 'help/%s'", file, file); + return 1; + } + + if (!_match("badwords.*.conf", file)) + { + if (badwords_upgraded_already) + { + strcpy(buf, "/* all badwords are now in badwords.conf */\n"); + } else { + strcpy(buf, "include \"badwords.conf\";\n"); + badwords_upgraded_already = 1; + } + replace_section(ce, buf); + config_status("- include for '%s' replaced (now in badwords.conf)", file); + return 1; + } + + return 0; +} + #define MAXSPFTARGETS 32 int upgrade_spamfilter_block(ConfigEntry *ce) { @@ -926,6 +960,11 @@ again: if (upgrade_loadmodule(ce)) goto again; } + if (!strcmp(ce->ce_varname, "include")) + { + if (upgrade_include(ce)) + goto again; + } if (!strcmp(ce->ce_varname, "me")) { if (upgrade_me_block(ce)) @@ -1070,6 +1109,8 @@ void update_conf(void) for (; cf; cf = cf->cf_next) { + if (!file_exists(cf->cf_filename)) + continue; /* skip silently. errors were already shown earlier by build_include_list anyway. */ configfile = cf->cf_filename; config_status("Checking '%s'...", cf->cf_filename); snprintf(configfiletmp, sizeof(configfiletmp), "%s.tmp", configfile); diff --git a/src/win32/unrealinst.iss b/src/win32/unrealinst.iss index 1c00c0294..a2f79e969 100644 --- a/src/win32/unrealinst.iss +++ b/src/win32/unrealinst.iss @@ -44,7 +44,7 @@ Source: "..\..\badwords.channel.conf"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\badwords.message.conf"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\badwords.quit.conf"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\spamfilter.conf"; DestDir: "{app}"; Flags: ignoreversion -Source: "..\..\modules.conf"; DestDir: "{app}"; Flags: ignoreversion +Source: "..\..\modules.*.conf"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\dccallow.conf"; DestDir: "{app}"; Flags: ignoreversion Source: "..\..\Donation"; DestDir: "{app}"; DestName: "Donation.txt"; Flags: ignoreversion Source: "..\..\help.conf"; DestDir: "{app}"; Flags: ignoreversion