From 0632c03ad21882ffab750a093558cf3dd2e90a5e Mon Sep 17 00:00:00 2001 From: brain Date: Sun, 4 Dec 2005 13:39:56 +0000 Subject: Reverted dodgy changes git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2138 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 99 ++---------------------------------------- 1 file changed, 4 insertions(+), 95 deletions(-) (limited to 'src') diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index 6ab7a5953..9992c02d4 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -306,7 +306,6 @@ class TreeSocket : public InspSocket std::string InboundDescription; int num_lost_users; int num_lost_servers; - nspace::hash_map replacements; public: @@ -518,29 +517,6 @@ class TreeSocket : public InspSocket log(DEBUG,"FJOIN detected, our TS=%lu, their TS=%lu",ourTS,TS); - // corect all nicknames that have been force changed due to collision - for (unsigned int usernum = 2; usernum < params.size(); usernum++) - { - log(DEBUG,"Collision translation: In=%s",params[usernum].c_str()); - char* usr = (char*)params[usernum].c_str(); - char permissions = *usr; - switch (permissions) - { - case '@': - case '%': - case '+': - usr++; - break; - } - std::string nickname = this->GetFJoinReplacement(usr); - if ((permissions == '@') || (permissions == '%') || (permissions == '+')) - { - nickname = permissions + nickname; - } - params[usernum] = nickname; - log(DEBUG,"Collision translation: Out=%s",params[usernum].c_str()); - } - // do this first, so our mode reversals are correctly received by other servers // if there is a TS collision. DoOneToAllButSender(source,"FJOIN",params,source); @@ -549,7 +525,6 @@ class TreeSocket : public InspSocket { // process one channel at a time, applying modes. char* usr = (char*)params[usernum].c_str(); - std::string nickname; char permissions = *usr; switch (permissions) { @@ -625,33 +600,6 @@ class TreeSocket : public InspSocket return true; } - bool ClearFJoinReplacement() - { - replacements.clear(); - return true; - } - - void AddFJoinReplacement(std::string oldnick, std::string newnick) - { - nspace::hash_map::iterator iter = replacements.find(oldnick); - if (iter != replacements.end()) - return; - replacements[oldnick] = newnick; - } - - std::string GetFJoinReplacement(std::string nickname) - { - nspace::hash_map::iterator iter = replacements.find(nickname); - if (iter != replacements.end()) - { - return iter->second; - } - else - { - return nickname; - } - } - bool IntroduceClient(std::string source, std::deque params) { if (params.size() < 8) @@ -681,14 +629,8 @@ class TreeSocket : public InspSocket { // nick collision log(DEBUG,"Nick collision on %s!%s@%s: %lu %lu",tempnick,ident.c_str(),host.c_str(),(unsigned long)age,(unsigned long)iter->second->age); - if (iter->second->age >= age) - { - // ours is older than theirs, ours stays. Set a new nick here, send SVSNICK - params[1] = nick = "Guest0"; - this->WriteLine(":"+Srv->GetServerName()+" FNICK "+tempnick+" "+nick); - // temporarily (until end of burst) we auto-replace occurances of the old nick with the new nick - AddFJoinReplacement(tempnick,nick); - } + this->WriteLine(":"+Srv->GetServerName()+" KILL "+tempnick+" :Nickname collision"); + return true; } clientlist[tempnick] = new userrec(); @@ -790,7 +732,7 @@ class TreeSocket : public InspSocket this->SendServers(TreeRoot,s,1); // Send users and their channels this->SendUsers(s); - this->WriteLine("ENDUSERS"); + // TODO: Send everything else (channel modes etc) this->SendChannelModes(s); this->WriteLine("ENDBURST"); } @@ -860,21 +802,6 @@ class TreeSocket : public InspSocket return true; } - bool ForceNick(std::string prefix, std::deque params) - { - if (params.size() != 2) - return true; - std::string oldnick = params[0]; - std::string newnick = params[1]; - userrec* u = Srv->FindNick(oldnick); - if (u) - { - Srv->ChangeUserNick(u,newnick); - DoOneToAllButSender(prefix,"FNICK",params,prefix); - } - return true; - } - bool RemoteRehash(std::string prefix, std::deque params) { if (params.size() < 1) @@ -964,8 +891,6 @@ class TreeSocket : public InspSocket params[3] = ":" + params[3]; DoOneToAllButSender(TreeRoot->GetName(),"SERVER",params,servername); this->DoBurst(Node); - this->SendChannelModes(Node); - this->WriteLine("ENDBURST"); return true; } } @@ -1123,14 +1048,7 @@ class TreeSocket : public InspSocket params.push_back("1"); params.push_back(":"+InboundDescription); DoOneToAllButSender(TreeRoot->GetName(),"SERVER",params,InboundServerName); - } - else if (command == "ENDUSERS") - { - // one server must wait till the other servers list of synched users - // before starting, so we have time to resolve collisions - this->DoBurst(Node); - this->SendChannelModes(Node); - this->WriteLine("ENDBURST"); + this->DoBurst(Node); } else if (command == "ERROR") { @@ -1198,14 +1116,6 @@ class TreeSocket : public InspSocket { return this->RemoteRehash(prefix,params); } - else if (command == "FNICK") - { - return this->ForceNick(prefix,params); - } - else if (command == "ENDBURST") - { - return this->ClearFJoinReplacement(); - } else if (command == "SQUIT") { if (params.size() == 2) @@ -1981,4 +1891,3 @@ extern "C" void * init_module( void ) { return new ModuleSpanningTreeFactory; } - -- cgit v1.2.3