From de0ba7eff9560f79b5be464034fd372de1c44031 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 30 Nov 2005 13:03:17 +0000 Subject: Added TS nick collision stuff (ugh) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2049 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index df2939f76..0991dacdd 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -557,7 +557,31 @@ class TreeSocket : public InspSocket { // nick collision log(DEBUG,"Nick collision on %s!%s@%s",tempnick,ident.c_str(),host.c_str()); - return true; + if (age <= iter->second->age) + { + // remote client is older + // if hosts are identical, kill the remote, + // else kill the local. We must send KILL for + // removal of remote users. + if (!strcmp(iter->second->host,host.c_str())) + { + // kill the remote by sending KILL, + // and ABORT to stop it being introduced here. + this->WriteLine(":"+Srv->GetServerName()+" KILL "+tempnick+" :Killed (Nickname collision from "+Srv->GetServerName()+")"); + return true; + } + else + { + // kill our local and continue to let the remote be introduced + Srv->QuitUser(iter->second,"Killed (Nickname collision from "+source+")"); + } + } + else + { + // remote is newer, kill it and bail to stop it being introduced + this->WriteLine(":"+Srv->GetServerName()+" KILL "+tempnick+" :Killed (Nickname collision from "+Srv->GetServerName()+")"); + return true; + } } clientlist[tempnick] = new userrec(); -- cgit v1.2.3