diff options
-rw-r--r-- | data/example_new.conf | 20 | ||||
-rw-r--r-- | src/config.c | 36 |
2 files changed, 33 insertions, 23 deletions
diff --git a/data/example_new.conf b/data/example_new.conf index ebb07cdc5..ff19061b3 100644 --- a/data/example_new.conf +++ b/data/example_new.conf @@ -339,7 +339,7 @@ chanserv database = "chan.db" /* - * The default options for newly registered channel. Note that changing these options + * The default options for newly registered channels. Note that changing these options * will have no effect on channels which are already registered. The list must be separated * by spaces. * @@ -513,4 +513,22 @@ botserv * executable. If not given, defaults to "bot.db". */ database = "bot.db" + + /* + * The default bot options for newly registered channel. Note that changing these options + * will have no effect on channels which are already registered. The list must be separated + * by spaces. + * + * The options are: + * - dontkickops: Channel operators will be protected against BotServ kicks + * - dontkickvoices: Voiced users will be protected against BotServ kicks + * - greet: The channel's BotServ bot will greet incoming users that have set a greet + * in their NickServ settings + * - fantasy: Enables the use of BotServ fantasy commands in the channel + * - symbiosis: Causes the BotServ bot to do all actions that would normally have been + * done by ChanServ + * + * This directive is optional, if left blank, there will be no defaults. + */ + defaults="greet fantasy symbiosis" } diff --git a/src/config.c b/src/config.c index c822ec990..abfd6b627 100644 --- a/src/config.c +++ b/src/config.c @@ -161,11 +161,7 @@ time_t MSSendDelay; bool MSNotifyAll; int MSMemoReceipt; -int BSDefDontKickOps; -int BSDefDontKickVoices; -int BSDefFantasy; -int BSDefGreet; -int BSDefSymbiosis; +static std::string BSDefaults; int BSDefFlags; int BSKeepData; int BSMinUsers; @@ -613,6 +609,7 @@ int ServerConfig::Read(bool bail) {"botserv", "nick", "", new ValueContainerChar(&s_BotServ), DT_CHARPTR, NoValidation}, {"botserv", "description", "Bot Service", new ValueContainerChar(&desc_BotServ), DT_CHARPTR, ValidateBotServ}, {"botserv", "database", "bot.db", new ValueContainerChar(&BotDBName), DT_CHARPTR, ValidateBotServ}, + {"botserv", "defaults", "", new ValueContainerString(&BSDefaults), DT_STRING, NoValidation}, {NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation} }; /* These tags can occur multiple times, and therefore they have special code to read them @@ -1194,12 +1191,6 @@ Directive directives[] = { {"BadPassTimeout", {{PARAM_TIME, PARAM_RELOAD, &BadPassTimeout}}}, {"BotCoreModules", {{PARAM_STRING, PARAM_RELOAD, &BotCoreModules}}}, {"BSBadWordsMax", {{PARAM_POSINT, PARAM_RELOAD, &BSBadWordsMax}}}, - {"BSDefDontKickOps", {{PARAM_SET, PARAM_RELOAD, &BSDefDontKickOps}}}, - {"BSDefDontKickVoices", - {{PARAM_SET, PARAM_RELOAD, &BSDefDontKickVoices}}}, - {"BSDefGreet", {{PARAM_SET, PARAM_RELOAD, &BSDefGreet}}}, - {"BSDefFantasy", {{PARAM_SET, PARAM_RELOAD, &BSDefFantasy}}}, - {"BSDefSymbiosis", {{PARAM_SET, PARAM_RELOAD, &BSDefSymbiosis}}}, {"BSCaseSensitive", {{PARAM_SET, PARAM_RELOAD, &BSCaseSensitive}}}, {"BSFantasyCharacter", {{PARAM_STRING, PARAM_RELOAD, &BSFantasyCharacter}}}, @@ -1814,17 +1805,18 @@ int read_config(int reload) } } - BSDefFlags = 0; - if (BSDefDontKickOps) - BSDefFlags |= BS_DONTKICKOPS; - if (BSDefDontKickVoices) - BSDefFlags |= BS_DONTKICKVOICES; - if (BSDefGreet) - BSDefFlags |= BS_GREET; - if (BSDefFantasy) - BSDefFlags |= BS_FANTASY; - if (BSDefSymbiosis) - BSDefFlags |= BS_SYMBIOSIS; + BSDefFlags = 0; + if (!BSDefaults.empty()) { + spacesepstream options(BSDefaults); + std::string option; + while (options.GetToken(option)) { + if (option == "dontkickops") BSDefFlags |= BS_DONTKICKOPS; + else if (option == "dontkickvoices") BSDefFlags |= BS_DONTKICKVOICES; + else if (option == "greet") BSDefFlags |= BS_GREET; + else if (option == "fantasy") BSDefFlags |= BS_FANTASY; + else if (option == "symbiosis") BSDefFlags |= BS_SYMBIOSIS; + } + } /* Services Root building */ |