mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
m_spanningtree Use iterators in CAPAB handler and when generating reply to spanningtree related /stats, use std::find() in TreeServer::DelChild()
This commit is contained in:
parent
a3313987f3
commit
6b929c6dbb
@ -37,12 +37,12 @@ std::string TreeSocket::MyModules(int filter)
|
||||
|
||||
std::string capabilities;
|
||||
sort(modlist.begin(),modlist.end());
|
||||
for (unsigned int i = 0; i < modlist.size(); i++)
|
||||
for (std::vector<std::string>::const_iterator i = modlist.begin(); i != modlist.end(); ++i)
|
||||
{
|
||||
if (i)
|
||||
if (i != modlist.begin())
|
||||
capabilities.push_back(proto_version > 1201 ? ' ' : ',');
|
||||
capabilities.append(modlist[i]);
|
||||
Module* m = ServerInstance->Modules->Find(modlist[i]);
|
||||
capabilities.append(*i);
|
||||
Module* m = ServerInstance->Modules->Find(*i);
|
||||
if (m && proto_version > 1201)
|
||||
{
|
||||
Version v = m->GetVersion();
|
||||
|
@ -33,11 +33,12 @@ ModResult ModuleSpanningTree::OnStats(char statschar, User* user, string_list &r
|
||||
{
|
||||
if ((statschar == 'c') || (statschar == 'n'))
|
||||
{
|
||||
for (unsigned int i = 0; i < Utils->LinkBlocks.size(); i++)
|
||||
for (std::vector<reference<Link> >::iterator i = Utils->LinkBlocks.begin(); i != Utils->LinkBlocks.end(); ++i)
|
||||
{
|
||||
results.push_back(std::string(ServerInstance->Config->ServerName)+" 213 "+user->nick+" "+statschar+" *@"+(Utils->LinkBlocks[i]->HiddenFromStats ? "<hidden>" : Utils->LinkBlocks[i]->IPAddr)+" * "+Utils->LinkBlocks[i]->Name.c_str()+" "+ConvToStr(Utils->LinkBlocks[i]->Port)+" "+(Utils->LinkBlocks[i]->Hook.empty() ? "plaintext" : Utils->LinkBlocks[i]->Hook));
|
||||
Link* L = *i;
|
||||
results.push_back(std::string(ServerInstance->Config->ServerName)+" 213 "+user->nick+" "+statschar+" *@"+(L->HiddenFromStats ? "<hidden>" : L->IPAddr)+" * "+(*i)->Name.c_str()+" "+ConvToStr(L->Port)+" "+(L->Hook.empty() ? "plaintext" : L->Hook));
|
||||
if (statschar == 'c')
|
||||
results.push_back(std::string(ServerInstance->Config->ServerName)+" 244 "+user->nick+" H * * "+Utils->LinkBlocks[i]->Name.c_str());
|
||||
results.push_back(std::string(ServerInstance->Config->ServerName)+" 244 "+user->nick+" H * * "+L->Name.c_str());
|
||||
}
|
||||
return MOD_RES_DENY;
|
||||
}
|
||||
|
@ -321,13 +321,11 @@ void TreeServer::AddChild(TreeServer* Child)
|
||||
|
||||
bool TreeServer::DelChild(TreeServer* Child)
|
||||
{
|
||||
for (std::vector<TreeServer*>::iterator a = Children.begin(); a != Children.end(); a++)
|
||||
std::vector<TreeServer*>::iterator it = std::find(Children.begin(), Children.end(), Child);
|
||||
if (it != Children.end())
|
||||
{
|
||||
if (*a == Child)
|
||||
{
|
||||
Children.erase(a);
|
||||
return true;
|
||||
}
|
||||
Children.erase(it);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user