当前位置: 首页>>代码示例>>C++>>正文


C++ ConfigTag类代码示例

本文整理汇总了C++中ConfigTag的典型用法代码示例。如果您正苦于以下问题:C++ ConfigTag类的具体用法?C++ ConfigTag怎么用?C++ ConfigTag使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ConfigTag类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: NickMatchesEveryone

bool InspIRCd::NickMatchesEveryone(const std::string &nick, User* user)
{
	long matches = 0;

	ConfigTag* insane = Config->ConfValue("insane");

	if (insane->getBool("nickmasks"))
		return false;

	float itrigger = insane->getFloat("trigger", 95.5);

	for (user_hash::iterator u = this->Users->clientlist->begin(); u != this->Users->clientlist->end(); u++)
	{
		if (InspIRCd::Match(u->second->nick, nick))
			matches++;
	}

	if (!matches)
		return false;

	float percent = ((float)matches / (float)this->Users->clientlist->size()) * 100;
	if (percent > itrigger)
	{
		SNO->WriteToSnoMask('a', "\2WARNING\2: %s tried to set a Q line mask of %s, which covers %.2f%% of the network!",user->nick.c_str(),nick.c_str(),percent);
		return true;
	}
	return false;
}
开发者ID:GeeksIRC,项目名称:inspircd,代码行数:28,代码来源:commands.cpp

示例2: ReadConfig

	void ReadConfig(ConfigStatus& status) override
	{
		ConfigTag* tag = ServerInstance->Config->ConfValue("rline");

		MatchOnNickChange = tag->getBool("matchonnickchange");
		ZlineOnMatch = tag->getBool("zlineonmatch");
		std::string newrxengine = tag->getString("engine");

		factory = rxfactory ? (rxfactory.operator->()) : NULL;

		if (newrxengine.empty())
			rxfactory.SetProvider("regex");
		else
			rxfactory.SetProvider("regex/" + newrxengine);

		if (!rxfactory)
		{
			if (newrxengine.empty())
				ServerInstance->SNO.WriteToSnoMask('a', "WARNING: No regex engine loaded - R-line functionality disabled until this is corrected.");
			else
				ServerInstance->SNO.WriteToSnoMask('a', "WARNING: Regex engine '%s' is not loaded - R-line functionality disabled until this is corrected.", newrxengine.c_str());

			ServerInstance->XLines->DelAll(f.GetType());
		}
		else if ((!initing) && (rxfactory.operator->() != factory))
		{
			ServerInstance->SNO.WriteToSnoMask('a', "Regex engine has changed, removing all R-lines.");
			ServerInstance->XLines->DelAll(f.GetType());
		}

		initing = false;
	}
开发者ID:aszrul,项目名称:inspircd,代码行数:32,代码来源:m_rline.cpp

示例3: OnEvent

    void OnEvent(Event& event)
    {
        std::stringstream data("");

        if (event.id == "httpd_url")
        {
            ServerInstance->Logs->Log("m_http_stats", LOG_DEBUG,"Handling httpd event");
            HTTPRequest* http = (HTTPRequest*)&event;

            if ((http->GetURI() == "/config") || (http->GetURI() == "/config/"))
            {
                data << "<html><head><title>InspIRCd Configuration</title></head><body>";
                data << "<h1>InspIRCd Configuration</h1><p>";

                for (ConfigDataHash::iterator x = ServerInstance->Config->config_data.begin(); x != ServerInstance->Config->config_data.end(); ++x)
                {
                    data << "&lt;" << x->first << " ";
                    ConfigTag* tag = x->second;
                    for (std::vector<KeyVal>::const_iterator j = tag->getItems().begin(); j != tag->getItems().end(); j++)
                    {
                        data << Sanitize(j->first) << "=&quot;" << Sanitize(j->second) << "&quot; ";
                    }
                    data << "&gt;<br>";
                }

                data << "</body></html>";
                /* Send the document back to m_httpd */
                HTTPDocumentResponse response(this, *http, &data, 200);
                response.headers.SetHeader("X-Powered-By", "m_httpd_config.so");
                response.headers.SetHeader("Content-Type", "text/html");
                response.Send();
            }
        }
    }
开发者ID:bandicot,项目名称:inspircd,代码行数:34,代码来源:m_httpd_config.cpp

示例4: Handle

CmdResult CommandRules::Handle (const std::vector<std::string>& parameters, User *user)
{
	if (parameters.size() > 0 && parameters[0] != ServerInstance->Config->ServerName)
		return CMD_SUCCESS;

	ConfigTag* tag = NULL;
	if (IS_LOCAL(user))
		tag = user->GetClass()->config;
	std::string rules_name = tag->getString("rules", "rules");
	ConfigFileCache::iterator rules = ServerInstance->Config->Files.find(rules_name);
	if (rules == ServerInstance->Config->Files.end())
	{
		user->SendText(":%s %03d %s :RULES file is missing.",
			ServerInstance->Config->ServerName.c_str(), ERR_NORULES, user->nick.c_str());
		return CMD_SUCCESS;
	}
	user->SendText(":%s %03d %s :%s server rules:", ServerInstance->Config->ServerName.c_str(),
		RPL_RULESTART, user->nick.c_str(), ServerInstance->Config->ServerName.c_str());

	for (file_cache::iterator i = rules->second.begin(); i != rules->second.end(); i++)
		user->SendText(":%s %03d %s :- %s", ServerInstance->Config->ServerName.c_str(), RPL_RULES, user->nick.c_str(),i->c_str());

	user->SendText(":%s %03d %s :End of RULES command.", ServerInstance->Config->ServerName.c_str(), RPL_RULESEND, user->nick.c_str());

	return CMD_SUCCESS;
}
开发者ID:Paciik,项目名称:inspircd,代码行数:26,代码来源:cmd_rules.cpp

示例5: SetPenalties

		void SetPenalties()
		{
			ConfigTagList tags = ServerInstance->Config->ConfTags("penalty");
			for (ConfigIter i = tags.first; i != tags.second; ++i)
			{
				ConfigTag* tag = i->second;
				
				std::string name = tag->getString("name");
				int penalty = (int)tag->getInt("value", 1);
				
				Command* command = ServerInstance->Parser->GetHandler(name);
				if (command == NULL)
				{
					ServerInstance->Logs->Log("m_custompenalty", DEFAULT, "Warning: unable to find command: " + name);
					continue;	
				}
				if (penalty < 0)
				{
					ServerInstance->Logs->Log("m_custompenalty", DEFAULT, "Warning: unable to set a negative penalty for " + name);
					continue;	
				}
				
				ServerInstance->Logs->Log("m_custompenalty", DEBUG, "Setting the penalty for %s to %d", name.c_str(), penalty);
				command->Penalty = penalty;
			}
		}
开发者ID:AntiDjin,项目名称:inspircd-extras,代码行数:26,代码来源:m_custompenalty.cpp

示例6: OnRehash

	void OnRehash(User* user)
	{
		ConfigTag* tag = ServerInstance->Config->ConfValue("timedstaticquit");
		this->quitmsg = tag->getString("quitmsg", "Client Quit");
		int duration = ServerInstance->Duration(tag->getString("mintime", "5m")); /* Duration is in the user-friendly format (1y2w3d4h5m6s) */
		this->mintime = duration <= 0 ? 1 : duration;                             /* The minimum time needs to be at least 1 second */
	}
开发者ID:Canternet,项目名称:inspircd-extras,代码行数:7,代码来源:m_timedstaticquit.cpp

示例7: ReadConfig

	void ReadConfig(ConfigStatus& status) override
	{
		ConfigTag* tag = ServerInstance->Config->ConfValue("channames");
		std::string denyToken = tag->getString("denyrange");
		std::string allowToken = tag->getString("allowrange");

		if (!denyToken.compare(0, 2, "0-"))
			denyToken[0] = '1';
		if (!allowToken.compare(0, 2, "0-"))
			allowToken[0] = '1';

		allowedmap.set();

		irc::portparser denyrange(denyToken, false);
		int denyno = -1;
		while (0 != (denyno = denyrange.GetToken()))
			allowedmap[denyno & 0xFF] = false;

		irc::portparser allowrange(allowToken, false);
		int allowno = -1;
		while (0 != (allowno = allowrange.GetToken()))
			allowedmap[allowno & 0xFF] = true;

		allowedmap[0x07] = false; // BEL
		allowedmap[0x20] = false; // ' '
		allowedmap[0x2C] = false; // ','

		ValidateChans();
	}
开发者ID:Adam-,项目名称:inspircd,代码行数:29,代码来源:m_channames.cpp

示例8: DoRehash

void ListModeBase::DoRehash()
{
    ConfigTagList tags = ServerInstance->Config->ConfTags(configtag);

    limitlist oldlimits = chanlimits;
    chanlimits.clear();

    for (ConfigIter i = tags.first; i != tags.second; i++)
    {
        // For each <banlist> tag
        ConfigTag* c = i->second;
        ListLimit limit(c->getString("chan"), c->getInt("limit"));

        if (limit.mask.size() && limit.limit > 0)
            chanlimits.push_back(limit);
    }

    if (chanlimits.empty())
        chanlimits.push_back(ListLimit("*", 64));

    // Most of the time our settings are unchanged, so we can avoid iterating the chanlist
    if (oldlimits == chanlimits)
        return;

    for (chan_hash::const_iterator i = ServerInstance->chanlist->begin(); i != ServerInstance->chanlist->end(); ++i)
    {
        ChanData* cd = extItem.get(i->second);
        if (cd)
            cd->maxitems = -1;
    }
}
开发者ID:pombredanne,项目名称:inspircd,代码行数:31,代码来源:listmode.cpp

示例9: HandleRequest

	ModResult HandleRequest(HTTPRequest* http)
	{
		std::stringstream data("");

		{
			ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Handling httpd event");

			if ((http->GetURI() == "/config") || (http->GetURI() == "/config/"))
			{
				data << "<html><head><title>InspIRCd Configuration</title></head><body>";
				data << "<h1>InspIRCd Configuration</h1><p>";

				for (ConfigDataHash::iterator x = ServerInstance->Config->config_data.begin(); x != ServerInstance->Config->config_data.end(); ++x)
				{
					data << "&lt;" << x->first << " ";
					ConfigTag* tag = x->second;
					for (std::vector<KeyVal>::const_iterator j = tag->getItems().begin(); j != tag->getItems().end(); j++)
					{
						data << Sanitize(j->first) << "=&quot;" << Sanitize(j->second) << "&quot; ";
					}
					data << "&gt;<br>";
				}

				data << "</body></html>";
				/* Send the document back to m_httpd */
				HTTPDocumentResponse response(this, *http, &data, 200);
				response.headers.SetHeader("X-Powered-By", MODNAME);
				response.headers.SetHeader("Content-Type", "text/html");
				API->SendResponse(response);
				return MOD_RES_DENY; // Handled
			}
		}
		return MOD_RES_PASSTHRU;
	}
开发者ID:Canternet,项目名称:inspircd,代码行数:34,代码来源:m_httpd_config.cpp

示例10: OnRehash

	void OnRehash(User* user)
	{
		ConfigTag *tag = ServerInstance->Config->ConfValue("connthrottle");

		throttle_num = tag->getInt("num", 1);
		throttle_time = tag->getInt("time", 1);
	}
开发者ID:inspircd,项目名称:inspircd-extras,代码行数:7,代码来源:m_conn_throttle.cpp

示例11: OnRehash

	void OnRehash(User* user)
	{
		ConfigTag* tag = ServerInstance->Config->ConfValue("requirectcp");
		ctcp = tag->getString("ctcp", "VERSION");
		declined = tag->getString("declined", "You have been blocked!Please get a better client.");
		accepted = tag->getString("accepted", "Howdy buddy,you are authorized to use this server!");
	}
开发者ID:Canternet,项目名称:inspircd-extras,代码行数:7,代码来源:m_requirectcp.cpp

示例12: ReadConfig

	void ReadConfig(ConfigStatus& status) override
	{
		ConfigTag* tag = ServerInstance->Config->ConfValue("showwhois");

		sw.SetOperOnly(tag->getBool("opersonly", true));
		ShowWhoisFromOpers = tag->getBool("showfromopers", true);
	}
开发者ID:Adam-,项目名称:inspircd,代码行数:7,代码来源:m_showwhois.cpp

示例13: Handle

	CmdResult Handle (const std::vector<std::string> &parameters, User *user)
	{
		ConfigTagList tags = ServerInstance->Config->ConfTags("vhost");
		for(ConfigIter i = tags.first; i != tags.second; ++i)
		{
			ConfigTag* tag = i->second;
			std::string mask = tag->getString("host");
			std::string username = tag->getString("user");
			std::string pass = tag->getString("pass");
			std::string hash = tag->getString("hash");

			if (parameters[0] == username && !ServerInstance->PassCompare(user, pass, parameters[1], hash))
			{
				if (!mask.empty())
				{
					user->WriteServ("NOTICE "+user->nick+" :Setting your VHost: " + mask);
					user->ChangeDisplayedHost(mask.c_str());
					return CMD_SUCCESS;
				}
			}
		}

		user->WriteServ("NOTICE "+user->nick+" :Invalid username or password.");
		return CMD_FAILURE;
	}
开发者ID:asterIRC,项目名称:twirlircd,代码行数:25,代码来源:m_vhost.cpp

示例14: ReadConfig

		void ReadConfig()
		{
			helpop_map.clear();

			ConfigTagList tags = ServerInstance->Config->ConfTags("helpop");
			for(ConfigIter i = tags.first; i != tags.second; ++i)
			{
				ConfigTag* tag = i->second;
				irc::string key = assign(tag->getString("key"));
				std::string value;
				tag->readString("value", value, true); /* Linefeeds allowed */

				if (key == "index")
				{
					throw ModuleException("m_helpop: The key 'index' is reserved for internal purposes. Please remove it.");
				}

				helpop_map[key] = value;
			}

			if (helpop_map.find("start") == helpop_map.end())
			{
				// error!
				throw ModuleException("m_helpop: Helpop file is missing important entry 'start'. Please check the example conf.");
			}
			else if (helpop_map.find("nohelp") == helpop_map.end())
			{
				// error!
				throw ModuleException("m_helpop: Helpop file is missing important entry 'nohelp'. Please check the example conf.");
			}

		}
开发者ID:krsnapc,项目名称:inspircd,代码行数:32,代码来源:m_helpop.cpp

示例15: OnRehash

	void OnRehash(User* user)
	{
		ConfigTag* tag = ServerInstance->Config->ConfValue("passforward");
		nickrequired = tag->getString("nick", "NickServ");
		forwardmsg = tag->getString("forwardmsg", "NOTICE * :*** Sending services password as an ENCAP SASL message over the network");
		forwardcmd = tag->getString("cmd", "$b64p");
	}
开发者ID:asterIRC,项目名称:twirlircd,代码行数:7,代码来源:m_pass2sasl.cpp


注:本文中的ConfigTag类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。