return true;
}
+bool ValidateDisabledUModes(ServerConfig* conf, const char*, const char*, ValueItem &data)
+{
+ memset(conf->DisabledUModes, 0, 64);
+ for (const unsigned char* p = (const unsigned char*)data.GetString(); *p; ++p)
+ {
+ if (*p < 'A' || *p > ('A' + 64)) throw CoreException(std::string("Invalid usermode ")+(char)*p+" was found.");
+ conf->DisabledUModes[*p - 'A'] = 1;
+ }
+ return true;
+}
+
+bool ValidateDisabledCModes(ServerConfig* conf, const char*, const char*, ValueItem &data)
+{
+ memset(conf->DisabledCModes, 0, 64);
+ for (const unsigned char* p = (const unsigned char*)data.GetString(); *p; ++p)
+ {
+ if (*p < 'A' || *p > ('A' + 64)) throw CoreException(std::string("Invalid chanmode ")+(char)*p+" was found.");
+ conf->DisabledCModes[*p - 'A'] = 1;
+ }
+ return true;
+}
+
bool ValidateDnsServer(ServerConfig* conf, const char*, const char*, ValueItem &data)
{
if (!*(data.GetString()))
static char hidemodes[MAXBUF]; /* Modes to not allow listing from users below halfop */
static char exemptchanops[MAXBUF]; /* Exempt channel ops from these modes */
static char announceinvites[MAXBUF]; /* options:announceinvites setting */
+ static char disabledumodes[MAXBUF]; /* Disabled usermodes */
+ static char disabledcmodes[MAXBUF]; /* Disabled chanmodes */
errstr.clear();
include_stack.clear();
{"dns", "timeout", "5", new ValueContainerInt (&this->dns_timeout), DT_INTEGER, NoValidation},
{"options", "moduledir", MOD_PATH, new ValueContainerChar (this->ModPath), DT_CHARPTR, NoValidation},
{"disabled", "commands", "", new ValueContainerChar (this->DisabledCommands), DT_CHARPTR, NoValidation},
+ {"disabled", "usermodes", "", new ValueContainerChar (disabledumodes), DT_CHARPTR, ValidateDisabledUModes},
+ {"disabled", "chanmodes", "", new ValueContainerChar (disabledcmodes), DT_CHARPTR, ValidateDisabledCModes},
{"security", "userstats", "", new ValueContainerChar (this->UserStats), DT_CHARPTR, NoValidation},
{"security", "customversion","", new ValueContainerChar (this->CustomVersion), DT_CHARPTR, NoValidation},
{"security", "hidesplits", "0", new ValueContainerBool (&this->HideSplits), DT_BOOLEAN, NoValidation},
if (abort)
continue;
+ /* If it's disabled, they have to be an oper.
+ */
+ if (IS_LOCAL(user) && !IS_OPER(user) && ((type == MODETYPE_CHANNEL ? ServerInstance->Config->DisabledCModes : ServerInstance->Config->DisabledUModes)[modehandlers[handler_id]->GetModeChar() - 'A']))
+ {
+ user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - %s mode %c has been locked by the administrator",
+ user->nick.c_str(),
+ type == MODETYPE_CHANNEL ? "channel" : "user",
+ modehandlers[handler_id]->GetModeChar());
+ continue;
+ }
+
/* It's an oper only mode, check if theyre an oper. If they arent,
* eat any parameter that came with the mode, and continue to next
*/