diff options
-rw-r--r-- | docs/inspircd.conf.example | 7 | ||||
-rw-r--r-- | src/modules/m_spanningtree.cpp | 27 |
2 files changed, 32 insertions, 2 deletions
diff --git a/docs/inspircd.conf.example b/docs/inspircd.conf.example index 3eaf44224..cf223feac 100644 --- a/docs/inspircd.conf.example +++ b/docs/inspircd.conf.example @@ -534,6 +534,12 @@ # value is set to true, yes or 1, /MAP and /LINKS # # will be flattened when shown to a non-oper. # # # +# hideulines - When you are using m_spanningtree.so, and this # +# value is set to true, yes or 1, then U-lined # +# servers will be hidden in /LINKS and /MAP. For non # +# opers. Please be aware that this will also hide # +# any leaf servers of a U-lined server, e.g. jupes. # +# # <options prefixquit="Quit: " loglevel="default" @@ -548,6 +554,7 @@ hidesplits="no" hidewhois="" flatlinks="no" + hideulines="no" allowhalfop="yes"> diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index d0de86f7a..2be8e16b1 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -126,6 +126,8 @@ void ReadConfiguration(bool rebind); /* Flatten links and /MAP for non-opers */ bool FlatLinks; +/* Hide U-Lined servers in /MAP and /LINKS */ +bool HideULines; /* Imported from xline.cpp for use during netburst */ extern std::vector<KLine> klines; @@ -2422,6 +2424,7 @@ void ReadConfiguration(bool rebind) } } FlatLinks = Conf->ReadFlag("options","flatlinks",0); + HideULines = Conf->ReadFlag("options","hideulines",0); LinkBlocks.clear(); for (int j =0; j < Conf->Enumerate("link"); j++) { @@ -2494,7 +2497,17 @@ class ModuleSpanningTree : public Module } for (unsigned int q = 0; q < Current->ChildCount(); q++) { - ShowLinks(Current->GetChild(q),user,hops+1); + if ((HideULines) && (Srv->IsUlined(Current->GetName()))) + { + if (*user->oper) + { + ShowLinks(Current->GetChild(q),user,hops+1); + } + } + else + { + ShowLinks(Current->GetChild(q),user,hops+1); + } } WriteServ(user->fd,"364 %s %s %s :%d %s",user->nick,Current->GetName().c_str(),Parent.c_str(),(FlatLinks && (!*user->oper)) ? 0 : hops,Current->GetDesc().c_str()); } @@ -2565,7 +2578,17 @@ class ModuleSpanningTree : public Module line++; for (unsigned int q = 0; q < Current->ChildCount(); q++) { - ShowMap(Current->GetChild(q),user,(FlatLinks && (!*user->oper)) ? depth : depth+2,matrix); + if ((HideULines) && (Srv->IsUlined(Current->GetChild(q)->GetName()))) + { + if (*user->oper) + { + ShowMap(Current->GetChild(q),user,(FlatLinks && (!*user->oper)) ? depth : depth+2,matrix); + } + } + else + { + ShowMap(Current->GetChild(q),user,(FlatLinks && (!*user->oper)) ? depth : depth+2,matrix); + } } } } |