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


C++ ConvToStr函数代码示例

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


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

示例1: ProcessMessages

	ModResult ProcessMessages(User* user,Channel* dest, const std::string &text)
	{
		if ((!IS_LOCAL(user)) || !dest->IsModeSet(mf))
			return MOD_RES_PASSTHRU;

		if (ServerInstance->OnCheckExemption(user,dest,"flood") == MOD_RES_ALLOW)
			return MOD_RES_PASSTHRU;

		floodsettings *f = mf.ext.get(dest);
		if (f)
		{
			if (f->addmessage(user))
			{
				/* Youre outttta here! */
				f->clear(user);
				if (f->ban)
				{
					std::vector<std::string> parameters;
					parameters.push_back(dest->name);
					parameters.push_back("+b");
					parameters.push_back("*!*@" + user->dhost);
					ServerInstance->Modes->Process(parameters, ServerInstance->FakeClient);
				}

				const std::string kickMessage = "Channel flood triggered (limit is " + ConvToStr(f->lines) +
					" in " + ConvToStr(f->secs) + " secs)";

				dest->KickUser(ServerInstance->FakeClient, user, kickMessage);

				return MOD_RES_DENY;
			}
		}

		return MOD_RES_PASSTHRU;
	}
开发者ID:Cronus89,项目名称:inspircd,代码行数:35,代码来源:m_messageflood.cpp

示例2: SendHeaders

	void SendHeaders(unsigned long size, int response, HTTPHeaders &rheaders)
	{

		WriteData(http_version + " "+ConvToStr(response)+" "+Response(response)+"\r\n");

		time_t local = ServerInstance->Time();
		struct tm *timeinfo = gmtime(&local);
		char *date = asctime(timeinfo);
		date[strlen(date) - 1] = '\0';
		rheaders.CreateHeader("Date", date);

		rheaders.CreateHeader("Server", BRANCH);
		rheaders.SetHeader("Content-Length", ConvToStr(size));

		if (size)
			rheaders.CreateHeader("Content-Type", "text/html");
		else
			rheaders.RemoveHeader("Content-Type");

		/* Supporting Connection: keep-alive causes a whole world of hurt syncronizing timeouts,
		 * so remove it, its not essential for what we need.
		 */
		rheaders.SetHeader("Connection", "Close");

		WriteData(rheaders.GetFormattedHeaders());
		WriteData("\r\n");
	}
开发者ID:krsnapc,项目名称:inspircd,代码行数:27,代码来源:m_httpd.cpp

示例3: OnStats

	ModResult OnStats(Stats::Context& stats) override
	{
		if (stats.GetSymbol() != 'G')
			return MOD_RES_PASSTHRU;

		unsigned int unknown = 0;
		std::map<std::string, unsigned int> results;

		const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
		for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
		{
			std::string* cc = ext.get(*i);
			if (cc)
				results[*cc]++;
			else
				unknown++;
		}

		for (std::map<std::string, unsigned int>::const_iterator i = results.begin(); i != results.end(); ++i)
		{
			stats.AddRow(801, "GeoIPSTATS " + i->first + " " + ConvToStr(i->second));
		}

		if (unknown)
			stats.AddRow(801, "GeoIPSTATS Unknown " + ConvToStr(unknown));

		return MOD_RES_DENY;
	}
开发者ID:Adam-,项目名称:inspircd,代码行数:28,代码来源:m_geoip.cpp

示例4: OnSetAway

    virtual ModResult OnSetAway(User *user, const std::string &awaymsg)
    {
        std::string numeric;
        int inum;

        if (awaymsg.empty())
        {
            numeric = user->nick + " " + user->ident + " " + user->dhost + " " + ConvToStr(ServerInstance->Time()) + " :is no longer away";
            inum = 599;
        }
        else
        {
            numeric = user->nick + " " + user->ident + " " + user->dhost + " " + ConvToStr(ServerInstance->Time()) + " :" + awaymsg;
            inum = 598;
        }

        watchentries::iterator x = whos_watching_me->find(user->nick.c_str());
        if (x != whos_watching_me->end())
        {
            for (std::deque<User*>::iterator n = x->second.begin(); n != x->second.end(); n++)
            {
                (*n)->WriteNumeric(inum, numeric);
            }
        }

        return MOD_RES_PASSTHRU;
    }
开发者ID:Shawn-Smith,项目名称:InspIRCd,代码行数:27,代码来源:m_watch.cpp

示例5: OnUserJoin

void ModuleSpanningTree::OnUserJoin(userrec* user, chanrec* channel, bool &silent)
{
	// Only do this for local users
	if (IS_LOCAL(user))
	{
		if (channel->GetUserCounter() == 1)
		{
			std::deque<std::string> params;
			// set up their permissions and the channel TS with FJOIN.
			// All users are FJOINed now, because a module may specify
			// new joining permissions for the user.
			params.push_back(channel->name);
			params.push_back(ConvToStr(channel->age));
			params.push_back(std::string(channel->GetAllPrefixChars(user))+","+std::string(user->nick));
			Utils->DoOneToMany(ServerInstance->Config->ServerName,"FJOIN",params);
			/* First user in, sync the modes for the channel */
			params.pop_back();
			params.push_back(channel->ChanModes(true));
			Utils->DoOneToMany(ServerInstance->Config->ServerName,"FMODE",params);
		}
		else
		{
			std::deque<std::string> params;
			params.push_back(channel->name);
			params.push_back(ConvToStr(channel->age));
			Utils->DoOneToMany(user->nick,"JOIN",params);
		}
	}
}
开发者ID:TuSuNaMi,项目名称:ircd-sakura,代码行数:29,代码来源:main.cpp

示例6: Handle

	CmdResult Handle (const std::vector<std::string> &parameters, User *src)
	{
		std::map<std::string,int> closed;

		for (LocalUserList::const_iterator u = ServerInstance->Users->local_users.begin(); u != ServerInstance->Users->local_users.end(); ++u)
		{
			LocalUser* user = *u;
			if (user->registered != REG_ALL)
			{
				ServerInstance->Users->QuitUser(user, "Closing all unknown connections per request");
				std::string key = ConvToStr(user->GetIPString())+"."+ConvToStr(user->GetServerPort());
				closed[key]++;
			}
		}

		int total = 0;
		for (std::map<std::string,int>::iterator ci = closed.begin(); ci != closed.end(); ci++)
		{
			src->WriteNotice("*** Closed " + ConvToStr(ci->second) + " unknown " + (ci->second == 1 ? "connection" : "connections") +
				" from [" + ci->first + "]");
			total += ci->second;
		}
		if (total)
			src->WriteNotice("*** " + ConvToStr(total) + " unknown " + (total == 1 ? "connection" : "connections") + " closed");
		else
			src->WriteNotice("*** No unknown connections found");

		return CMD_SUCCESS;
	}
开发者ID:AliSharifi,项目名称:inspircd,代码行数:29,代码来源:m_close.cpp

示例7: OnStats

	ModResult OnStats(char symbol, User* user, string_list &out)
	{
		if (symbol != 'G')
			return MOD_RES_PASSTHRU;

		unsigned int unknown = 0;
		std::map<std::string, unsigned int> results;
		for (LocalUserList::const_iterator i = ServerInstance->Users->local_users.begin(); i != ServerInstance->Users->local_users.end(); ++i)
		{
			std::string* cc = ext.get(*i);
			if (cc)
				results[*cc]++;
			else
				unknown++;
		}

		std::string p = ServerInstance->Config->ServerName + " 801 " + user->nick + " :GeoIPSTATS ";
		for (std::map<std::string, unsigned int>::const_iterator i = results.begin(); i != results.end(); ++i)
		{
			out.push_back(p + i->first + " " + ConvToStr(i->second));
		}

		if (unknown)
			out.push_back(p + "Unknown " + ConvToStr(unknown));

		return MOD_RES_DENY;
	}
开发者ID:Shawn-Smith,项目名称:InspIRCd,代码行数:27,代码来源:m_geoip.cpp

示例8: params

void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by_local, CUList& excepts)
{
	// Only do this for local users
	if (!IS_LOCAL(memb->user))
		return;

	if (created_by_local)
	{
		CmdBuilder params("FJOIN");
		params.push_back(memb->chan->name);
		params.push_back(ConvToStr(memb->chan->age));
		params.push_raw(" +").push_raw(memb->chan->ChanModes(true));
		params.push(memb->modes).push_raw(',').push_raw(memb->user->uuid);
		params.Broadcast();
	}
	else
	{
		CmdBuilder params(memb->user, "IJOIN");
		params.push_back(memb->chan->name);
		if (!memb->modes.empty())
		{
			params.push_back(ConvToStr(memb->chan->age));
			params.push_back(memb->modes);
		}
		params.Broadcast();
	}
}
开发者ID:AliSharifi,项目名称:inspircd,代码行数:27,代码来源:main.cpp

示例9: ExpireLine

void XLineManager::InvokeStats(const std::string &type, int numeric, User* user, string_list &results)
{
    ContainerIter n = lookup_lines.find(type);

    time_t current = ServerInstance->Time();

    LookupIter safei;

    if (n != lookup_lines.end())
    {
        XLineLookup& list = n->second;
        for (LookupIter i = list.begin(); i != list.end(); )
        {
            safei = i;
            safei++;

            if (i->second->duration && current > i->second->expiry)
            {
                ExpireLine(n, i);
            }
            else
                results.push_back(ServerInstance->Config->ServerName+" "+ConvToStr(numeric)+" "+user->nick+" :"+i->second->Displayable()+" "+
                                  ConvToStr(i->second->set_time)+" "+ConvToStr(i->second->duration)+" "+i->second->source+" :"+i->second->reason);
            i = safei;
        }
    }
}
开发者ID:H7-25,项目名称:inspircd,代码行数:27,代码来源:xline.cpp

示例10: ModeSet

	ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string &parameter)
	{
		floodsettings* x;
		if (channel->GetExt("flood",x))
			return std::make_pair(true, (x->ban ? "*" : "")+ConvToStr(x->lines)+":"+ConvToStr(x->secs));
		else
			return std::make_pair(false, parameter);
	}
开发者ID:TuSuNaMi,项目名称:ircd-sakura,代码行数:8,代码来源:m_messageflood.cpp

示例11: sizeof

std::string CommandWhowas::GetStats()
{
	int whowas_size = 0;
	int whowas_bytes = 0;
	for (whowas_users::iterator i = whowas.begin(); i != whowas.end(); ++i)
	{
		whowas_set* n = i->second;
		whowas_size += n->size();
		whowas_bytes += (sizeof(whowas_set) + ( sizeof(WhoWasGroup) * n->size() ) );
	}
	return "Whowas entries: " +ConvToStr(whowas_size)+" ("+ConvToStr(whowas_bytes)+" bytes)";
}
开发者ID:AliSharifi,项目名称:inspircd,代码行数:12,代码来源:cmd_whowas.cpp

示例12: SendTopic

void SpanningTreeProtocolInterface::SendTopic(Channel* channel, std::string &topic)
{
	parameterlist params;

	params.push_back(channel->name);
	params.push_back(ConvToStr(channel->age));
	params.push_back(ConvToStr(ServerInstance->Time()));
	params.push_back(ServerInstance->Config->ServerName);
	params.push_back(":" + topic);

	Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FTOPIC", params);
}
开发者ID:m4z,项目名称:inspircd,代码行数:12,代码来源:protocolinterface.cpp

示例13: return

std::string ModuleSpanningTree::TimeToStr(time_t secs)
{
	time_t mins_up = secs / 60;
	time_t hours_up = mins_up / 60;
	time_t days_up = hours_up / 24;
	secs = secs % 60;
	mins_up = mins_up % 60;
	hours_up = hours_up % 24;
	return ((days_up ? (ConvToStr(days_up) + "d") : "")
			+ (hours_up ? (ConvToStr(hours_up) + "h") : "")
			+ (mins_up ? (ConvToStr(mins_up) + "m") : "")
			+ ConvToStr(secs) + "s");
}
开发者ID:Adam-,项目名称:inspircd,代码行数:13,代码来源:main.cpp

示例14: DoCommand

	void DoCommand(std::string newline, userrec* user, chanrec *c,const std::string &original_line)
	{
		for (int v = 1; v < 10; v++)
		{
			std::string var = "$";
			var.append(ConvToStr(v));
			var.append("-");
			std::string::size_type x = newline.find(var);

			while (x != std::string::npos)
			{
				newline.erase(x, var.length());
				newline.insert(x, GetVar(var, original_line));
				x = newline.find(var);
			}

			var = "$";
			var.append(ConvToStr(v));
			x = newline.find(var);

			while (x != std::string::npos)
			{
				newline.erase(x, var.length());
				newline.insert(x, GetVar(var, original_line));
				x = newline.find(var);
			}
		}

		/* Special variables */
		SearchAndReplace(newline, "$nick", user->nick);
		SearchAndReplace(newline, "$ident", user->ident);
		SearchAndReplace(newline, "$host", user->host);
		SearchAndReplace(newline, "$vhost", user->dhost);
		SearchAndReplace(newline, "$chan", c->name);

		/* Unescape any variable names in the user text before sending */
		SearchAndReplace(newline, "\r", "$");

		irc::tokenstream ss(newline);
		const char* parv[127];
		int x = 0;

		while (ss.GetToken(pars[x]))
		{
			parv[x] = pars[x].c_str();
			x++;
		}

		ServerInstance->Parser->CallHandler(parv[0], &parv[1], x-1, user);
	}
开发者ID:Adam-,项目名称:inspircd-extras,代码行数:50,代码来源:m_fantasy.cpp

示例15: params

void ModuleSpanningTree::OnUserJoin(Membership* memb, bool sync, bool created_by_local, CUList& excepts)
{
	// Only do this for local users
	if (!IS_LOCAL(memb->user))
		return;

	// Assign the current membership id to the new Membership and increase it
	memb->id = currmembid++;

	if (created_by_local)
	{
		CommandFJoin::Builder params(memb->chan);
		params.add(memb);
		params.finalize();
		params.Broadcast();
	}
	else
	{
		CmdBuilder params(memb->user, "IJOIN");
		params.push_back(memb->chan->name);
		params.push_int(memb->id);
		if (!memb->modes.empty())
		{
			params.push_back(ConvToStr(memb->chan->age));
			params.push_back(memb->modes);
		}
		params.Broadcast();
	}
}
开发者ID:Adam-,项目名称:inspircd,代码行数:29,代码来源:main.cpp


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