X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fmain.cpp;h=967b577b15d03f466df3f3df81f7d29857d8f7ae;hb=d494c188245e1c80c9556a6a7efafd6fe8f4f6de;hp=606f8e6728493e30d1da67fdf2c4f81942b75877;hpb=9cdf47629faeec64edc77ff0729dc55946ed753c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 606f8e672..967b577b1 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -38,6 +38,7 @@ #include "protocolinterface.h" ModuleSpanningTree::ModuleSpanningTree() + : KeepNickTS(false) { Utils = new SpanningTreeUtilities(this); commands = new SpanningTreeCommands(this); @@ -87,7 +88,7 @@ void ModuleSpanningTree::init() loopCall = false; // update our local user count - Utils->TreeRoot->SetUserCount(ServerInstance->Users->local_users.size()); + Utils->TreeRoot->SetUserCount(ServerInstance->Users->LocalUserCount()); } void ModuleSpanningTree::ShowLinks(TreeServer* Current, User* user, int hops) @@ -265,7 +266,7 @@ void ModuleSpanningTree::ConnectServer(Link* x, Autoconnect* y) { bool ipvalid = true; - if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name))) + if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map)) { ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Not connecting to myself."); return; @@ -395,9 +396,9 @@ ModResult ModuleSpanningTree::HandleConnect(const std::vector& para for (std::vector >::iterator i = Utils->LinkBlocks.begin(); i < Utils->LinkBlocks.end(); i++) { Link* x = *i; - if (InspIRCd::Match(x->Name.c_str(),parameters[0])) + if (InspIRCd::Match(x->Name.c_str(),parameters[0], rfc_case_insensitive_map)) { - if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name))) + if (InspIRCd::Match(ServerInstance->Config->ServerName, assign(x->Name), rfc_case_insensitive_map)) { RemoteMessage(user, "*** CONNECT: Server \002%s\002 is ME, not connecting.",x->Name.c_str()); return MOD_RES_DENY; @@ -704,11 +705,12 @@ void ModuleSpanningTree::OnUserPostNick(User* user, const std::string &oldnick) /** IMPORTANT: We don't update the TS if the oldnick is just a case change of the newnick! */ - if (irc::string(user->nick.c_str()) != assign(oldnick)) + if ((irc::string(user->nick.c_str()) != assign(oldnick)) && (!this->KeepNickTS)) user->age = ServerInstance->Time(); params.push_back(ConvToStr(user->age)); Utils->DoOneToMany(user->uuid,"NICK",params); + this->KeepNickTS = false; } else if (!loopCall && user->nick == user->uuid) { @@ -804,6 +806,7 @@ void ModuleSpanningTree::OnUnloadModule(Module* mod) { ServerInstance->PI->SendMetaData(NULL, "modules", "-" + mod->ModuleSourceFile); +restart: unsigned int items = Utils->TreeRoot->ChildCount(); for(unsigned int x = 0; x < items; x++) { @@ -813,6 +816,8 @@ void ModuleSpanningTree::OnUnloadModule(Module* mod) { sock->SendError("SSL module unloaded"); sock->Close(); + // XXX: The list we're iterating is modified by TreeSocket::Squit() which is called by Close() + goto restart; } } @@ -925,6 +930,12 @@ ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg) return MOD_RES_PASSTHRU; } +void ModuleSpanningTree::OnRequest(Request& request) +{ + if (!strcmp(request.id, "rehash")) + Utils->Rehash(); +} + void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const parameterlist &modeline, const std::vector &translate) { TreeSocket* s = (TreeSocket*)opaque;