X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;ds=inline;f=src%2Fmodules%2Fm_spanningtree%2Ftreesocket2.cpp;h=918ce21645a88fe151448f26dd607e5ace7e5d83;hb=0f74e88f0996acff1580bcf5f2ea3dc986497339;hp=7ba406b5ec11b50fb907ce7a3d01d8c22932b086;hpb=75d9c67804196c2e4059f3ff89f2ed5ee79a175f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 7ba406b5e..918ce2164 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -14,7 +14,6 @@ #include "inspircd.h" #include "socket.h" #include "xline.h" -#include "../transport.h" #include "socketengine.h" #include "main.h" @@ -23,16 +22,13 @@ #include "link.h" #include "treesocket.h" #include "resolvers.h" -#include "handshaketimer.h" - -/* $ModDep: m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h m_spanningtree/handshaketimer.h */ /* Handle ERROR command */ bool TreeSocket::Error(parameterlist ¶ms) { if (params.size() < 1) return false; - ServerInstance->SNO->WriteToSnoMask('l',"ERROR from %s: %s",(!InboundServerName.empty() ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str()); + ServerInstance->SNO->WriteGlobalSno('l',"ERROR from %s: %s",(!InboundServerName.empty() ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str()); /* we will return false to cause the socket to close. */ return false; } @@ -153,18 +149,23 @@ void TreeSocket::ProcessLine(std::string &line) time_t delta = them - ServerInstance->Time(); if ((delta < -600) || (delta > 600)) { - ServerInstance->SNO->WriteToSnoMask('l',"\2ERROR\2: Your clocks are out by %d seconds (this is more than five minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs((long)delta)); + ServerInstance->SNO->WriteGlobalSno('l',"\2ERROR\2: Your clocks are out by %d seconds (this is more than five minutes). Link aborted, \2PLEASE SYNC YOUR CLOCKS!\2",abs((long)delta)); SendError("Your clocks are out by "+ConvToStr(abs((long)delta))+" seconds (this is more than five minutes). Link aborted, PLEASE SYNC YOUR CLOCKS!"); return; } else if ((delta < -30) || (delta > 30)) { - ServerInstance->SNO->WriteToSnoMask('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs((long)delta)); + ServerInstance->SNO->WriteGlobalSno('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs((long)delta)); } } this->LinkState = CONNECTED; Utils->timeoutlist.erase(this); + if (myautoconnect) + { + myautoconnect->position = -1; + myautoconnect = NULL; + } Link* lnk = Utils->FindLink(InboundServerName); @@ -241,9 +242,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, if (ServerSource) { - who = Utils->ServerUser; - Utils->ServerUser->SetFakeServer(ServerSource->GetName()); - Utils->ServerUser->uuid = ServerSource->GetID(); + who = ServerSource->ServerUser; direction = prefix; } else @@ -300,7 +299,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, } else if (command == "FJOIN") { - this->ForceJoin(prefix,params); + this->ForceJoin(who,params); } else if (command == "STATS") { @@ -310,10 +309,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, { this->Motd(prefix, params); } - else if (command == "MODULES") - { - this->Modules(prefix, params); - } else if (command == "ADMIN") { this->Admin(prefix, params); @@ -340,7 +335,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, } else if (command == "FMODE") { - this->ForceMode(prefix,params); + this->ForceMode(who,params); } else if (command == "FTOPIC") { @@ -359,7 +354,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, TreeServer *s = Utils->FindServer(prefix); if (s && s->bursting) { - ServerInstance->SNO->WriteToSnoMask('l',"Server \002%s\002 has not finished burst, forcing end of burst (send ENDBURST!)", prefix.c_str()); + ServerInstance->SNO->WriteGlobalSno('l',"Server \002%s\002 has not finished burst, forcing end of burst (send ENDBURST!)", prefix.c_str()); s->FinishBurst(); } this->LocalPong(prefix,params); @@ -427,15 +422,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, this->Squit(Utils->FindServer(params[0]),params[1]); } } - else if (command == "MODENOTICE") - { - if (params.size() >= 2) - { - ServerInstance->Users->WriteMode(params[0].c_str(), WM_AND, "*** From %s: %s", - who->nick.c_str(), params[1].c_str()); - } - Utils->DoOneToAllButSender(prefix, command, params, prefix); - } else if (command == "SNONOTICE") { if (params.size() >= 2) @@ -447,29 +433,31 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, else if (command == "BURST") { // Set prefix server as bursting - if (!IS_SERVER(who)) + TreeServer* ServerSource = Utils->FindServer(prefix); + if (!ServerSource) { - ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got BURST from a non-server(?): %s", prefix.c_str()); + ServerInstance->SNO->WriteGlobalSno('l', "WTF: Got BURST from a non-server(?): %s", prefix.c_str()); return; } - route_back_again->bursting = true; + ServerSource->bursting = true; Utils->DoOneToAllButSender(prefix, command, params, prefix); } else if (command == "ENDBURST") { - if (!IS_SERVER(who)) + TreeServer* ServerSource = Utils->FindServer(prefix); + if (!ServerSource) { - ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got ENDBURST from a non-server(?): %s", prefix.c_str()); + ServerInstance->SNO->WriteGlobalSno('l', "WTF: Got ENDBURST from a non-server(?): %s", prefix.c_str()); return; } - route_back_again->FinishBurst(); + ServerSource->FinishBurst(); Utils->DoOneToAllButSender(prefix, command, params, prefix); } else if (command == "ENCAP") { - this->Encap(prefix, params); + this->Encap(who, params); } else if (command == "NICK") { @@ -541,8 +529,7 @@ void TreeSocket::OnTimeout() { if (this->LinkState == CONNECTING) { - ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Connection to \002%s\002 timed out.", myhost.c_str()); - Utils->Creator->ConnectServer(myautoconnect); + ServerInstance->SNO->WriteGlobalSno('l', "CONNECT: Connection to \002%s\002 timed out.", myhost.c_str()); } } @@ -570,10 +557,10 @@ void TreeSocket::Close() if (!quitserver.empty()) { - ServerInstance->SNO->WriteToSnoMask('l', "Connection to '\2%s\2' failed.",quitserver.c_str()); + ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\2%s\2' failed.",quitserver.c_str()); time_t server_uptime = ServerInstance->Time() - this->age; if (server_uptime) - ServerInstance->SNO->WriteToSnoMask('l', "Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str()); + ServerInstance->SNO->WriteGlobalSno('l', "Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str()); } }