#include "resolvers.h"
/* Handle ERROR command */
-bool TreeSocket::Error(parameterlist ¶ms)
+void 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());
- /* we will return false to cause the socket to close. */
- return false;
+ std::string msg = params.size() ? params[0] : "";
+ SetError("received ERROR " + msg);
}
void TreeSocket::Split(const std::string& line, std::string& prefix, std::string& command, parameterlist& params)
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);
if (ServerSource)
{
- who = Utils->ServerUser;
- Utils->ServerUser->SetFakeServer(ServerSource->GetName());
- Utils->ServerUser->uuid = ServerSource->GetID();
+ who = ServerSource->ServerUser;
direction = prefix;
}
else
}
else if (command == "FJOIN")
{
- this->ForceJoin(prefix,params);
+ this->ForceJoin(who,params);
}
else if (command == "STATS")
{
}
else if (command == "FMODE")
{
- this->ForceMode(prefix,params);
+ this->ForceMode(who,params);
}
else if (command == "FTOPIC")
{
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);
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)
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")
{
{
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());
}
}
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());
}
}