]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree.cpp
Clean up ghosts on nick collision
[user/henk/code/inspircd.git] / src / modules / m_spanningtree.cpp
index da617c8717bc96691acf0e77556e4905061e092d..ca25fe4a689938d2b09bed10e10cfcbf55f66043 100644 (file)
@@ -1179,7 +1179,7 @@ class TreeSocket : public InspSocket
                for (chan_hash::iterator c = chanlist.begin(); c != chanlist.end(); c++)
                {
                        SendFJoins(Current, c->second);
-                       snprintf(data,MAXBUF,":%s FMODE %s +%s",Srv->GetServerName().c_str(),c->second->name,chanmodes(c->second));
+                       snprintf(data,MAXBUF,":%s FMODE %s +%s",Srv->GetServerName().c_str(),c->second->name,chanmodes(c->second,true));
                        this->WriteLine(data);
                        if (*c->second->topic)
                        {
@@ -2126,6 +2126,32 @@ class TreeSocket : public InspSocket
                                        }
                                        if (who)
                                        {
+                                               if ((command == "NICK") && (params.size() > 0))
+                                               {
+                                                       /* On nick messages, check that the nick doesnt
+                                                        * already exist here. If it does, kill their copy,
+                                                        * and our copy.
+                                                        */
+                                                       userrec* x = Srv->FindNick(params[0]);
+                                                       if (x)
+                                                       {
+                                                               std::deque<std::string> p;
+                                                               p.push_back(params[0]);
+                                                               p.push_back("Nickname collision ("+prefix+" -> "+params[0]+")");
+                                                               DoOneToMany(Srv->GetServerName(),"KILL",p);
+                                                               p.clear();
+                                                               p.push_back(prefix);
+                                                               p.push_back("KILL "+prefix+" :Nickname collision");
+                                                               DoOneToMany(Srv->GetServerName(),"KILL",p);
+                                                               Srv->QuitUser(x,"Nickname collision ("+prefix+" -> "+params[0]+")");
+                                                               userrec* y = Srv->FindNick(prefix);
+                                                               if (y)
+                                                               {
+                                                                       Srv->QuitUser(y,"Nickname collision");
+                                                               }
+                                                               return DoOneToAllButSenderRaw(line,sourceserv,prefix,command,params);
+                                                       }
+                                               }
                                                // its a user
                                                target = who->server;
                                                char* strparams[127];
@@ -3259,7 +3285,7 @@ class ModuleSpanningTree : public Module
                        if (params->size() < 3)
                                return;
                        (*params)[2] = ":" + (*params)[2];
-                       DoOneToMany(Srv->GetServerName(),"METADATA ",*params);
+                       DoOneToMany(Srv->GetServerName(),"METADATA",*params);
                }
        }