summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/example_new.conf21
-rw-r--r--src/config.c15
2 files changed, 33 insertions, 3 deletions
diff --git a/data/example_new.conf b/data/example_new.conf
index f368a26b7..642f17066 100644
--- a/data/example_new.conf
+++ b/data/example_new.conf
@@ -580,3 +580,24 @@ botserv
*/
#fantasycharacter = "!"
}
+
+/*
+ * [OPTIONAL] HostServ Config
+ *
+ * This section is used to set up the vHost Service pseudo-client. The block is optional and can be
+ * removed if you do not wish to have HostServ on your network. Unless specified otherwise,
+ * all directives are required if you do wish to use HostServ.
+ */
+hostserv
+{
+ /*
+ * The nickname of the HostServ client.
+ */
+ nick = "HostServ"
+
+ /*
+ * The description of the HostServ client, which will be used as the GECOS (real
+ * name) of the client.
+ */
+ description = "vHost Service"
+}
diff --git a/src/config.c b/src/config.c
index 6ba61ca34..aef2e7473 100644
--- a/src/config.c
+++ b/src/config.c
@@ -492,6 +492,16 @@ bool ValidateBotServ(ServerConfig *, const char *tag, const char *value, ValueIt
return true;
}
+bool ValidateHostServ(ServerConfig *, const char *tag, const char *value, ValueItem &data)
+{
+ if (s_HostServ) {
+ if (static_cast<std::string>(value) == "description" || static_cast<std::string>(value) == "database") {
+ if (!*data.GetString()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> cannot be empty when HostServ is enabled!");
+ }
+ }
+ return true;
+}
+
void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail)
{
alog("There were errors in your configuration file: %s", errormessage.c_str());
@@ -620,6 +630,8 @@ int ServerConfig::Read(bool bail)
{"botserv", "gentlebadwordreason", "no", new ValueContainerBool(&BSGentleBWReason), DT_BOOLEAN, NoValidation},
{"botserv", "casesensitive", "no", new ValueContainerBool(&BSCaseSensitive), DT_BOOLEAN, NoValidation},
{"botserv", "fantasycharacter", "!", new ValueContainerChar(&BSFantasyCharacter), DT_BOOLEAN, NoValidation},
+ {"hostserv", "nick", "", new ValueContainerChar(&s_HostServ), DT_CHARPTR, NoValidation},
+ {"hostserv", "description", "vHost Service", new ValueContainerChar(&desc_HostServ), DT_CHARPTR, ValidateHostServ},
{NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation}
};
/* These tags can occur multiple times, and therefore they have special code to read them
@@ -1201,8 +1213,6 @@ Directive directives[] = {
{"BadPassTimeout", {{PARAM_TIME, PARAM_RELOAD, &BadPassTimeout}}},
{"BotCoreModules", {{PARAM_STRING, PARAM_RELOAD, &BotCoreModules}}},
{"HostServDB", {{PARAM_STRING, PARAM_RELOAD, &HostDBName}}},
- {"HostServName", {{PARAM_STRING, 0, &s_HostServ},
- {PARAM_STRING, 0, &desc_HostServ}}},
{"ChanCoreModules", {{PARAM_STRING, PARAM_RELOAD, &ChanCoreModules}}},
{"DefSessionLimit", {{PARAM_POSINT, 0, &DefSessionLimit}}},
{"DisableRaw", {{PARAM_SET, PARAM_RELOAD, &DisableRaw}}},
@@ -1904,7 +1914,6 @@ int read_config(int reload)
}
if (s_HostServ) {
- CHEK2(s_HostServ, HostServName);
CHEK2(HostDBName, HostServDB);
}