diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cmd_stats.cpp | 22 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 22 |
2 files changed, 12 insertions, 32 deletions
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp index 5c047f89b..5a22a2b4c 100644 --- a/src/cmd_stats.cpp +++ b/src/cmd_stats.cpp @@ -61,24 +61,14 @@ DllExport void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, /* stats p (show listening ports and registered clients on each) */ case 'p': { - std::map<int,int> pc; - for (std::vector<userrec*>::const_iterator i = ServerInstance->local_users.begin(); i != ServerInstance->local_users.end(); i++) - { - userrec* t = (userrec*)(*i); - if (t->registered == REG_ALL) - pc[t->GetPort()]++; - } for (size_t i = 0; i < ServerInstance->Config->ports.size(); i++) { - if (pc[ServerInstance->Config->ports[i]->GetPort()] >= 0) - { - std::string ip = ServerInstance->Config->ports[i]->GetIP(); - if (ip.empty()) - ip = "*"; - results.push_back(sn+" 249 "+user->nick+" :"+ ip + ":"+ConvToStr(ServerInstance->Config->ports[i]->GetPort())+" (" + - ConvToStr(pc[ServerInstance->Config->ports[i]->GetPort()])+" client" + (pc[ServerInstance->Config->ports[i]->GetPort()] != 1 ? "s" : "") + "), "+ - ServerInstance->Config->ports[i]->GetDescription()); - } + std::string ip = ServerInstance->Config->ports[i]->GetIP(); + if (ip.empty()) + ip = "*"; + + results.push_back(sn+" 249 "+user->nick+" :"+ ip + ":"+ConvToStr(ServerInstance->Config->ports[i]->GetPort())+" (client, " + + ServerInstance->Config->ports[i]->GetDescription() + ")"); } } break; diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index bebb69012..9e188b49d 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -661,22 +661,12 @@ int ModuleSpanningTree::OnStats(char statschar, userrec* user, string_list &resu for (unsigned int i = 0; i < Utils->Bindings.size(); i++) { - /* - * XXX - todo: - * we need to remove duplicate ports from this list, and possibly also - * show the correct number of servers on the port. - * - * XXX also, this doesn't currently work, as something is not initialising ->port, so it's 0 all the time. - * - */ - if (Utils->Bindings[i]->port) - { - std::string ip = Utils->Bindings[i]->IP; - if (ip.empty()) - ip = "*"; - results.push_back(ConvToStr(ServerInstance->Config->ServerName) + " 249 "+user->nick+" :" + ip + ":" + ConvToStr(Utils->Bindings[i]->port)+" (X servers) "+ - ServerInstance->Config->ports[i]->GetDescription()); - } + std::string ip = Utils->Bindings[i]->IP; + if (ip.empty()) + ip = "*"; + + results.push_back(ConvToStr(ServerInstance->Config->ServerName) + " 249 "+user->nick+" :" + ip + ":" + ConvToStr(Utils->Bindings[i]->port)+ + " (server, " + ServerInstance->Config->ports[i]->GetDescription() + ")"); } } return 0; |