/*
* InspIRCd -- Internet Relay Chat Daemon
*
- * Copyright (C) 2017 Peter Powell <petpow@saberuk.com>
+ * Copyright (C) 2019 Robby <robby@chatbelgie.be>
+ * Copyright (C) 2018-2020 Sadie Powell <sadie@witchery.services>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
AntiCapsMode(Module* Creator)
: ParamMode<AntiCapsMode, SimpleExtItem<AntiCapsSettings> >(Creator, "anticaps", 'B')
{
+ syntax = "{ban|block|mute|kick|kickban}:<minlen>:<percent>";
}
ModeAction OnSet(User* source, Channel* channel, std::string& parameter) CXX11_OVERRIDE
// Attempt to parse the method.
if (!ParseMethod(stream, method) || !ParseMinimumLength(stream, minlen) || !ParsePercent(stream, percent))
{
- source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter, "Invalid anticaps mode parameter. Syntax: <ban|block|mute|kick|kickban>:{minlen}:{percent}."));
+ source->WriteNumeric(Numerics::InvalidModeParameter(channel, this, parameter));
return MODEACTION_DENY;
}
out.push_back(':');
out.append(ConvToStr(acs->minlen));
out.push_back(':');
- out.append(ConvToStr(acs->percent));
+ out.append(ConvNumeric(acs->percent));
}
};
void InformUser(Channel* channel, User* user, const std::string& message)
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, channel, message + " and was blocked.");
+ user->WriteNumeric(Numerics::CannotSendTo(channel, message + " and was blocked."));
}
public:
ConfigTag* tag = ServerInstance->Config->ConfValue("anticaps");
uppercase.reset();
- const std::string upper = tag->getString("uppercase", "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ const std::string upper = tag->getString("uppercase", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", 1);
for (std::string::const_iterator iter = upper.begin(); iter != upper.end(); ++iter)
uppercase.set(static_cast<unsigned char>(*iter));
Version GetVersion() CXX11_OVERRIDE
{
- return Version("Provides support for punishing users that send capitalised messages.", VF_COMMON|VF_VENDOR);
+ return Version("Adds channel mode B (anticaps) which allows channels to block messages which are excessively capitalised.", VF_COMMON|VF_VENDOR);
}
};