#include "inspircd.h"
+#include "core_oper.h"
-/** Handle /OPER.
- */
-class CommandOper : public SplitCommand
+CommandOper::CommandOper(Module* parent)
+ : SplitCommand(parent, "OPER", 2, 2)
{
- public:
- /** Constructor for oper.
- */
- CommandOper ( Module* parent) : SplitCommand(parent,"OPER",2,2) { syntax = "<username> <password>"; }
- /** Handle command.
- * @param parameters The parameters to the command
- * @param user The user issuing the command
- * @return A value from CmdResult to indicate command success or failure.
- */
- CmdResult HandleLocal(const std::vector<std::string>& parameters, LocalUser *user);
-};
+ syntax = "<username> <password>";
+}
CmdResult CommandOper::HandleLocal(const std::vector<std::string>& parameters, LocalUser *user)
{
const std::string userHost = user->ident + "@" + user->host;
const std::string userIP = user->ident + "@" + user->GetIPString();
- OperIndex::iterator i = ServerInstance->Config->oper_blocks.find(parameters[0]);
+ ServerConfig::OperIndex::const_iterator i = ServerInstance->Config->oper_blocks.find(parameters[0]);
if (i != ServerInstance->Config->oper_blocks.end())
{
OperInfo* ifo = i->second;
ServerInstance->Logs->Log("OPER", LOG_DEFAULT, "OPER: Failed oper attempt by %s using login '%s': The following fields did not match: %s", user->GetFullRealHost().c_str(), parameters[0].c_str(), fields.c_str());
return CMD_FAILURE;
}
-
-COMMAND_INIT(CommandOper)