X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_stats.cpp;h=6ce733db7c4bdf47fbca37c61240573941f4e058;hb=6b188f1d4ebd00c1e93a0a4ac68af04de0bbaeab;hp=4b30fa5b4ac7a82d046712c03f0429cdfd436b8d;hpb=2e0cc3684df72b2a8de45b354848af43c6b47606;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_stats.cpp b/src/coremods/core_stats.cpp index 4b30fa5b4..6ce733db7 100644 --- a/src/coremods/core_stats.cpp +++ b/src/coremods/core_stats.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2018 Puck Meerburg * Copyright (C) 2018 Dylan Frank - * Copyright (C) 2016-2019 Sadie Powell + * Copyright (C) 2016-2020 Sadie Powell * Copyright (C) 2012-2016 Attila Molnar * Copyright (C) 2012, 2019 Robby * Copyright (C) 2012 ChrisTX @@ -117,10 +117,21 @@ void CommandStats::DoStats(Stats::Context& stats) for (std::vector::const_iterator i = ServerInstance->ports.begin(); i != ServerInstance->ports.end(); ++i) { ListenSocket* ls = *i; - std::string type = ls->bind_tag->getString("type", "clients"); - std::string hook = ls->bind_tag->getString("ssl", "plaintext"); + std::stringstream portentry; - stats.AddRow(249, ls->bind_sa.str() + " (" + type + ", " + hook + ")"); + const std::string type = ls->bind_tag->getString("type", "clients", 1); + portentry << ls->bind_sa.str() << " (type: " << type; + + const std::string hook = ls->bind_tag->getString("hook"); + if (!hook.empty()) + portentry << ", hook: " << hook; + + const std::string sslprofile = ls->bind_tag->getString("sslprofile", ls->bind_tag->getString("ssl")); + if (!sslprofile.empty()) + portentry << ", ssl profile: " << sslprofile; + + portentry << ')'; + stats.AddRow(249, portentry.str()); } } break; @@ -149,7 +160,7 @@ void CommandStats::DoStats(Stats::Context& stats) else param.append(c->host); - row.push(param).push(c->config->getString("port", "*")); + row.push(param).push(c->config->getString("port", "*", 1)); row.push(ConvToStr(c->GetRecvqMax())).push(ConvToStr(c->GetSendqSoftMax())).push(ConvToStr(c->GetSendqHardMax())).push(ConvToStr(c->GetCommandRate())); param = ConvToStr(c->GetPenaltyThreshold()); @@ -185,8 +196,9 @@ void CommandStats::DoStats(Stats::Context& stats) if (!oper->server->IsULine()) { LocalUser* lu = IS_LOCAL(oper); - stats.AddRow(249, oper->nick + " (" + oper->ident + "@" + oper->GetDisplayedHost() + ") Idle: " + - (lu ? ConvToStr(ServerInstance->Time() - lu->idle_lastmsg) + " secs" : "unavailable")); + const std::string idle = lu ? InspIRCd::DurationString(ServerInstance->Time() - lu->idle_lastmsg) : "unavailable"; + stats.AddRow(249, InspIRCd::Format("%s (%s@%s) Idle: %s", oper->nick.c_str(), + oper->ident.c_str(), oper->GetDisplayedHost().c_str(), idle.c_str())); idx++; } }