diff options
-rw-r--r-- | data/example.conf | 7 | ||||
-rw-r--r-- | docs/Changes.conf | 3 | ||||
-rw-r--r-- | include/config.h | 2 | ||||
-rw-r--r-- | include/modes.h | 2 | ||||
-rw-r--r-- | src/config.cpp | 1 | ||||
-rw-r--r-- | src/modes.cpp | 11 |
6 files changed, 24 insertions, 2 deletions
diff --git a/data/example.conf b/data/example.conf index c89e9ac25..da5e2c25e 100644 --- a/data/example.conf +++ b/data/example.conf @@ -520,6 +520,13 @@ options mlock = "+nrt" /* + * Modes that will not be allowed to be locked. Oper only modes such as +O + * are always restricted from regular users and is not affected by this. + * Leave blank for no restrictions. + */ + nomlock = "z" + + /* * Modes to set on service bots when they join channels, comment this out for no modes */ botmodes = "ao" diff --git a/docs/Changes.conf b/docs/Changes.conf index ac58669d8..eeb1f06eb 100644 --- a/docs/Changes.conf +++ b/docs/Changes.conf @@ -4,8 +4,9 @@ memoserv:modules added ms_ignore chanserv:modules added cs_clone and cs_mode nickserv:suspendexpire and nickserv:forbidexpire added chanserv:suspendexpire and chanserv:forbidexpire added -added cs_entrymsg +module added cs_entrymsg nickserv:modules added ns_ajoin +options:nomlock added Anope Version 1.9.3 ------------------ diff --git a/include/config.h b/include/config.h index 4a5fc0d97..f923b76b0 100644 --- a/include/config.h +++ b/include/config.h @@ -544,6 +544,8 @@ class CoreExport ServerConfig unsigned NewsCount; /* Default mlock modes */ Anope::string MLock; + /* Unmlockable modes */ + Anope::string NoMLock; /* Default botmodes on channels, defaults to ao */ Anope::string BotModes; /* THe actual modes */ diff --git a/include/modes.h b/include/modes.h index 2ecf6f1ec..868feab81 100644 --- a/include/modes.h +++ b/include/modes.h @@ -195,7 +195,7 @@ class CoreExport ChannelMode : public Mode * NOTE: User CAN be NULL, this is for checking if it can be locked with defcon * @param u The user, or NULL */ - virtual bool CanSet(User *u) const { return true; } + bool CanSet(User *u) const; }; diff --git a/src/config.cpp b/src/config.cpp index 9804161b1..dac22f5ab 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -1084,6 +1084,7 @@ void ServerConfig::Read() {"options", "newscount", "3", new ValueContainerUInt(&this->NewsCount), DT_UINTEGER, NoValidation}, {"options", "ulineservers", "", new ValueContainerString(&UlineServers), DT_STRING, NoValidation}, {"options", "mlock", "+nrt", new ValueContainerString(&this->MLock), DT_STRING, NoValidation}, + {"options", "nomlock", "", new ValueContainerString(&this->NoMLock), DT_STRING, NoValidation}, {"options", "botmodes", "", new ValueContainerString(&this->BotModes), DT_STRING, NoValidation}, {"options", "maxretries", "10", new ValueContainerUInt(&this->MaxRetries), DT_UINTEGER, NoValidation}, {"options", "retrywait", "60", new ValueContainerInt(&this->RetryWait), DT_INTEGER, ValidateNotZero}, diff --git a/src/modes.cpp b/src/modes.cpp index 4f09e0545..bc870cb1b 100644 --- a/src/modes.cpp +++ b/src/modes.cpp @@ -192,6 +192,17 @@ ChannelMode::~ChannelMode() { } +/** Can a user set this mode, used for mlock + * NOTE: User CAN be NULL, this is for checking if it can be locked with defcon + * @param u The user, or NULL + */ +bool ChannelMode::CanSet(User *u) const +{ + if (Config->NoMLock.find(this->ModeChar) != Anope::string::npos) + return false; + return true; +} + /** Default constructor * @param mName The mode name * @param mNameAsString The mode name as a string |