diff options
author | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-13 22:23:22 +0000 |
---|---|---|
committer | Naram Qashat cyberbotx@cyberbotx.com <Naram Qashat cyberbotx@cyberbotx.com@5417fbe8-f217-4b02-8779-1006273d7864> | 2008-10-13 22:23:22 +0000 |
commit | 46771d36769b6b133668fd5b89eb2f3784fe8980 (patch) | |
tree | 13d1176065b73d2cc9aa86a0315d8d373ee1b5c4 | |
parent | 766e04808e3ff1fc30fc1cb04e236e302e7ae289 (diff) |
Added defaults directive to chanserv block in new config.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1432 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | data/example_new.conf | 30 | ||||
-rw-r--r-- | src/config.c | 136 |
2 files changed, 73 insertions, 93 deletions
diff --git a/data/example_new.conf b/data/example_new.conf index fcb650ec8..f03cbabed 100644 --- a/data/example_new.conf +++ b/data/example_new.conf @@ -166,7 +166,7 @@ nickserv /* * The default options for newly registered nicks. Note that changing these options * will have no effect on nicks which are already registered. The list must be separated - * by spaces + * by spaces. * * The options are: * - kill: Kill nick if not identified within 60 seconds @@ -337,4 +337,32 @@ chanserv * executable. If not given, defaults to "chan.db". */ database = "chan.db" + + /* + * The default 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: + * - keeptopic: Retain topic when the channel is not in use + * - opnotice: Send a notice when OP/DEOP commands are used + * - peace: Disallow users from kicking or removing modes from others who are of the same + * access level or superior + * - private: Hide the channel from ChanServ's LIST command + * - restricted: Kick/ban users who are restricted from the channel + * - secure: Enable channel security, requiring the user to be identified with NickServ in + * order to be considered for being on the access list of the channel + * - secureops: Only allow operator status to be given if the user is on the access list + * - securefounder: Only allow the real founder of the channel to drop the channel, change it's + * password, or change the founder or succesor + * - signkick: Use of ChanServ's KICK command will cause the user's nick to be signed to the kick. + * - signkicklevel: Same as above, but the kick will not be signed if the user is at the same access + * level or superior to the target + * - topiclock: Disallow the topic to be changed except with ChanServ's TOPIC command + * - xop: Enable use of the xOP system + * + * This directive is optional, if left blank, the options will default to keetopic, secure, securefounder, + * and signkick. If you really want no defaults, use "none" by itself as the option. + */ + defaults="keeptopic peace secure securefounder signkick xop" } diff --git a/src/config.c b/src/config.c index 1322aae44..ac8895c3d 100644 --- a/src/config.c +++ b/src/config.c @@ -142,19 +142,7 @@ bool NSRestrictGetPass; bool NSNickTracking; bool NSAddAccessOnReg; -int CSDefNone; -int CSDefKeepTopic; -int CSDefOpNotice; -int CSDefPeace; -int CSDefPrivate; -int CSDefRestricted; -int CSDefSecure; -int CSDefSecureOps; -int CSDefSecureFounder; -int CSDefSignKick; -int CSDefSignKickLevel; -int CSDefTopicLock; -int CSDefXOP; +static std::string CSDefaults; int CSDefFlags; int CSMaxReg; int CSExpire; @@ -587,6 +575,7 @@ int ServerConfig::Read(bool bail) {"chanserv", "nick", "ChanServ", new ValueContainerChar(&s_ChanServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, {"chanserv", "description", "Channel Registration Service", new ValueContainerChar(&desc_ChanServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty}, {"chanserv", "database", "chan.db", new ValueContainerChar(&ChanDBName), DT_CHARPTR, ValidateNotEmpty}, + {"chanserv", "defaults", "keetopic secure securefounder signkick", new ValueContainerString(&CSDefaults), DT_BOOLEAN, NoValidation}, {NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation} }; /* These tags can occur multiple times, and therefore they have special code to read them @@ -1193,21 +1182,6 @@ Directive directives[] = { {"CSAutokickReason", {{PARAM_STRING, PARAM_RELOAD, &CSAutokickReason}}}, {"CSDefBantype", {{PARAM_INT, PARAM_RELOAD, &CSDefBantype}}}, - {"CSDefNone", {{PARAM_SET, PARAM_RELOAD, &CSDefNone}}}, - {"CSDefKeepTopic", {{PARAM_SET, PARAM_RELOAD, &CSDefKeepTopic}}}, - {"CSDefOpNotice", {{PARAM_SET, PARAM_RELOAD, &CSDefOpNotice}}}, - {"CSDefPeace", {{PARAM_SET, PARAM_RELOAD, &CSDefPeace}}}, - {"CSDefPrivate", {{PARAM_SET, PARAM_RELOAD, &CSDefPrivate}}}, - {"CSDefRestricted", {{PARAM_SET, PARAM_RELOAD, &CSDefRestricted}}}, - {"CSDefSecure", {{PARAM_SET, PARAM_RELOAD, &CSDefSecure}}}, - {"CSDefSecureOps", {{PARAM_SET, PARAM_RELOAD, &CSDefSecureOps}}}, - {"CSDefSecureFounder", - {{PARAM_SET, PARAM_RELOAD, &CSDefSecureFounder}}}, - {"CSDefSignKick", {{PARAM_SET, PARAM_RELOAD, &CSDefSignKick}}}, - {"CSDefSignKickLevel", - {{PARAM_SET, PARAM_RELOAD, &CSDefSignKickLevel}}}, - {"CSDefTopicLock", {{PARAM_SET, PARAM_RELOAD, &CSDefTopicLock}}}, - {"CSDefXOP", {{PARAM_SET, PARAM_RELOAD, &CSDefXOP}}}, {"CSExpire", {{PARAM_TIME, PARAM_RELOAD, &CSExpire}}}, {"CSInhabit", {{PARAM_TIME, PARAM_RELOAD, &CSInhabit}}}, {"CSListMax", {{PARAM_POSINT, PARAM_RELOAD, &CSListMax}}}, @@ -1749,30 +1723,30 @@ int read_config(int reload) } } - NSDefFlags = 0; - if (NSDefaults.empty()) NSDefFlags = NI_SECURE | NI_MEMO_SIGNON | NI_MEMO_RECEIVE; - else if (NSDefaults != "none") { - bool hadAutoop = false; - spacesepstream options(NSDefaults); - std::string option; - while (options.GetToken(option)) { - if (option == "kill") NSDefFlags |= NI_KILLPROTECT; - else if (option == "killquick") NSDefFlags |= NI_KILL_QUICK; - else if (option == "secure") NSDefFlags |= NI_SECURE; - else if (option == "private") NSDefFlags |= NI_PRIVATE; - else if (option == "msg") { - if (!UsePrivmsg) alog("msg in <nickserv:defaults> can only be used when UsePrivmsg is set"); - else NSDefFlags |= NI_MSG; - } - else if (option == "hideemail") NSDefFlags |= NI_HIDE_EMAIL; - else if (option == "hideusermask") NSDefFlags |= NI_HIDE_MASK; - else if (option == "hidequit") NSDefFlags |= NI_HIDE_QUIT; - else if (option == "memosignon") NSDefFlags |= NI_MEMO_SIGNON; - else if (option == "memoreceive") NSDefFlags |= NI_MEMO_RECEIVE; - else if (option == "autoop") hadAutoop = true; + NSDefFlags = 0; + if (NSDefaults.empty()) NSDefFlags = NI_SECURE | NI_MEMO_SIGNON | NI_MEMO_RECEIVE; + else if (NSDefaults != "none") { + bool hadAutoop = false; + spacesepstream options(NSDefaults); + std::string option; + while (options.GetToken(option)) { + if (option == "kill") NSDefFlags |= NI_KILLPROTECT; + else if (option == "killquick") NSDefFlags |= NI_KILL_QUICK; + else if (option == "secure") NSDefFlags |= NI_SECURE; + else if (option == "private") NSDefFlags |= NI_PRIVATE; + else if (option == "msg") { + if (!UsePrivmsg) alog("msg in <nickserv:defaults> can only be used when UsePrivmsg is set"); + else NSDefFlags |= NI_MSG; } - if (!hadAutoop) NSDefFlags |= NI_AUTOOP; + else if (option == "hideemail") NSDefFlags |= NI_HIDE_EMAIL; + else if (option == "hideusermask") NSDefFlags |= NI_HIDE_MASK; + else if (option == "hidequit") NSDefFlags |= NI_HIDE_QUIT; + else if (option == "memosignon") NSDefFlags |= NI_MEMO_SIGNON; + else if (option == "memoreceive") NSDefFlags |= NI_MEMO_RECEIVE; + else if (option == "autoop") hadAutoop = true; } + if (!hadAutoop) NSDefFlags |= NI_AUTOOP; + } if (!ServicesRoot) { error(0, @@ -1809,48 +1783,26 @@ int read_config(int reload) MysqlRetryGap = 1; } - if (!CSDefNone && - !CSDefKeepTopic && - !CSDefTopicLock && - !CSDefPrivate && - !CSDefRestricted && - !CSDefSecure && - !CSDefSecureOps && - !CSDefSecureFounder && - !CSDefSignKick && !CSDefSignKickLevel && !CSDefOpNotice) { - CSDefKeepTopic = 1; - CSDefSecure = 1; - CSDefSecureFounder = 1; - CSDefSignKick = 1; - } - - CSDefFlags = 0; - if (!CSDefNone) { - if (CSDefKeepTopic) - CSDefFlags |= CI_KEEPTOPIC; - if (CSDefTopicLock) - CSDefFlags |= CI_TOPICLOCK; - if (CSDefPrivate) - CSDefFlags |= CI_PRIVATE; - if (CSDefRestricted) - CSDefFlags |= CI_RESTRICTED; - if (CSDefSecure) - CSDefFlags |= CI_SECURE; - if (CSDefSecureOps) - CSDefFlags |= CI_SECUREOPS; - if (CSDefSecureFounder) - CSDefFlags |= CI_SECUREFOUNDER; - if (CSDefSignKick) - CSDefFlags |= CI_SIGNKICK; - if (CSDefSignKickLevel) - CSDefFlags |= CI_SIGNKICK_LEVEL; - if (CSDefOpNotice) - CSDefFlags |= CI_OPNOTICE; - if (CSDefXOP) - CSDefFlags |= CI_XOP; - if (CSDefPeace) - CSDefFlags |= CI_PEACE; - } + CSDefFlags = 0; + if (CSDefaults.empty()) CSDefFlags = CI_KEEPTOPIC | CI_SECURE | CI_SECUREFOUNDER | CI_SIGNKICK; + else if (CSDefaults != "none") { + spacesepstream options(CSDefaults); + std::string option; + while (options.GetToken(option)) { + if (option == "keeptopic") CSDefFlags |= CI_KEEPTOPIC; + else if (option == "topiclock") CSDefFlags |= CI_TOPICLOCK; + else if (option == "private") CSDefFlags |= CI_PRIVATE; + else if (option == "restricted") CSDefFlags |= CI_RESTRICTED; + else if (option == "secure") CSDefFlags |= CI_SECURE; + else if (option == "secureops") CSDefFlags |= CI_SECUREOPS; + else if (option == "securefounder") CSDefFlags |= CI_SECUREFOUNDER; + else if (option == "signkick") CSDefFlags |= CI_SIGNKICK; + else if (option == "signkicklevel") CSDefFlags |= CI_SIGNKICK_LEVEL; + else if (option == "opnotice") CSDefFlags |= CI_OPNOTICE; + else if (option == "xop") CSDefFlags |= CI_XOP; + else if (option == "peace") CSDefFlags |= CI_PEACE; + } + } BSDefFlags = 0; if (BSDefDontKickOps) |