bool ServerConfig::ApplyDisabledCommands(const std::string& data)
{
	std::stringstream dcmds(data);
	std::string thiscmd;

	/* Enable everything first */
	const CommandParser::CommandMap& commands = ServerInstance->Parser.GetCommands();
	for (CommandParser::CommandMap::const_iterator x = commands.begin(); x != commands.end(); ++x)
		x->second->Disable(false);

	/* Now disable all the ones which the user wants disabled */
	while (dcmds >> thiscmd)
	{
		Command* handler = ServerInstance->Parser.GetHandler(thiscmd);
		if (handler)
			handler->Disable(true);
	}
	return true;
}
Beispiel #2
0
bool ServerConfig::ApplyDisabledCommands(const std::string& data)
{
	std::stringstream dcmds(data);
	std::string thiscmd;

	/* Enable everything first */
	for (Commandtable::iterator x = ServerInstance->Parser->cmdlist.begin(); x != ServerInstance->Parser->cmdlist.end(); x++)
		x->second->Disable(false);

	/* Now disable all the ones which the user wants disabled */
	while (dcmds >> thiscmd)
	{
		Commandtable::iterator cm = ServerInstance->Parser->cmdlist.find(thiscmd);
		if (cm != ServerInstance->Parser->cmdlist.end())
		{
			cm->second->Disable(true);
		}
	}
	return true;
}
Beispiel #3
0
	virtual void OnRehash(User* user)
	{
		ConfigTag* tag = ServerInstance->Config->ConfValue("shun");
		std::string cmds = tag->getString("enabledcommands");
		std::transform(cmds.begin(), cmds.end(), cmds.begin(), ::toupper);

		if (cmds.empty())
			cmds = "PING PONG QUIT";

		ShunEnabledCommands.clear();

		std::stringstream dcmds(cmds);
		std::string thiscmd;

		while (dcmds >> thiscmd)
		{
			ShunEnabledCommands.insert(thiscmd);
		}

		NotifyOfShun = tag->getBool("notifyuser", true);
		affectopers = tag->getBool("affectopers", false);
	}
Beispiel #4
0
	void ReadConfig(ConfigStatus& status) override
	{
		ConfigTag* tag = ServerInstance->Config->ConfValue("shun");
		std::string cmds = tag->getString("enabledcommands");
		std::transform(cmds.begin(), cmds.end(), cmds.begin(), ::toupper);

		if (cmds.empty())
			cmds = "PING PONG QUIT";

		ShunEnabledCommands.clear();

		irc::spacesepstream dcmds(cmds);
		std::string thiscmd;

		while (dcmds.GetToken(thiscmd))
		{
			ShunEnabledCommands.insert(thiscmd);
		}

		NotifyOfShun = tag->getBool("notifyuser", true);
		affectopers = tag->getBool("affectopers", false);
	}