Пример #1
0
	void DoStatsUptime(CommandSource &source)
	{
		Stats *stats = Serialize::GetObject<Stats *>();
		time_t uptime = Anope::CurTime - Anope::StartTime;
		
		source.Reply(_("Current users: \002{0}\002 (\002{1}\002 ops)"), UserListByNick.size(), OperCount);
		source.Reply(_("Maximum users: \002{0}\002 ({1})"), stats->GetMaxUserCount(), Anope::strftime(stats->GetMaxUserTime(), source.GetAccount()));
		source.Reply(_("Services up \002{0}\002."), Anope::Duration(uptime, source.GetAccount()));
	}
Пример #2
0
	void OnUserConnect(User *u, bool &exempt) override
	{
		Stats *stats = GetStats();

		if (stats && UserListByNick.size() > stats->GetMaxUserCount())
		{
			stats->SetMaxUserCount(UserListByNick.size());
			stats->SetMaxUserTime(Anope::CurTime);

			Server *sserver = u->server;
			if (sserver && sserver->IsSynced())
				Log(this, "maxusers") << "connected - new maximum user count: " << UserListByNick.size();
		}
	}
Пример #3
0
    void DoStats(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request)
    {
        Stats *stats = Serialize::GetObject<Stats *>();

        request.reply("uptime", stringify(Anope::CurTime - Anope::StartTime));
        request.reply("uplinkname", Me->GetLinks().front()->GetName());
        {
            Anope::string buf;
            for (std::set<Anope::string>::iterator it = Servers::Capab.begin(); it != Servers::Capab.end(); ++it)
                buf += " " + *it;
            if (!buf.empty())
                buf.erase(buf.begin());
            request.reply("uplinkcapab", buf);
        }
        request.reply("usercount", stringify(UserListByNick.size()));
        request.reply("maxusercount", stringify(stats ? stats->GetMaxUserCount() : 0));
        request.reply("channelcount", stringify(ChannelList.size()));
    }