#include "inspircd.h"
-#include "socket.h"
-#include "xline.h"
-#include "socketengine.h"
#include "main.h"
#include "utils.h"
#include "treeserver.h"
-#include "link.h"
#include "treesocket.h"
#include "resolvers.h"
ServerInstance->SNO->WriteGlobalSno('l',"\2WARNING\2: Your clocks are out by %d seconds. Please consider synching your clocks.", abs((long)delta));
}
}
+
+ // Check for duplicate server name/sid again, it's possible that a new
+ // server was introduced while we were waiting for them to send BURST.
+ // (we do not reserve their server name/sid when they send SERVER, we do it now)
+ if (!CheckDuplicate(capab->name, capab->sid))
+ return;
+
this->LinkState = CONNECTED;
Utils->timeoutlist.erase(this);
+ linkID = capab->name;
+
+ MyRoot = new TreeServer(Utils, capab->name, capab->description, capab->sid, Utils->TreeRoot, this, capab->hidden);
+ Utils->TreeRoot->AddChild(MyRoot);
+
MyRoot->bursting = true;
this->DoBurst(MyRoot);
* crossing the users QUIT further upstream from the server. Thanks jilles!
*/
- if ((prefix.length() == UUID_LENGTH-1) && (isdigit(prefix[0])) &&
+ if ((prefix.length() == UIDGenerator::UUID_LENGTH) && (isdigit(prefix[0])) &&
((command == "FMODE") || (command == "MODE") || (command == "KICK") || (command == "TOPIC") || (command == "KILL") || (command == "ADDLINE") || (command == "DELLINE")))
{
/* Special case, we cannot drop these commands as they've been committed already on a
if ((!route_back_again) || (route_back_again->GetSocket() != this))
{
if (route_back_again)
- ServerInstance->Logs->Log("m_spanningtree",LOG_DEBUG,"Protocol violation: Fake direction '%s' from connection '%s'",
+ ServerInstance->Logs->Log("m_spanningtree", LOG_DEBUG, "Protocol violation: Fake direction '%s' from connection '%s'",
prefix.c_str(),linkID.c_str());
return;
}
- /*
- * First up, check for any malformed commands (e.g. MODE without a timestamp)
- * and rewrite commands where necessary (SVSMODE -> MODE for services). -- w
- */
- if (command == "SVSMODE") // This isn't in an "else if" so we still force FMODE for changes on channels.
- command = "MODE";
+ // Translate commands coming from servers using an older protocol
+ if (proto_version < ProtocolVersion)
+ {
+ if (!PreProcessOldProtocolMessage(who, command, params))
+ return;
+ }
// TODO move all this into Commands
if (command == "MAP")
return;
}
}
- who->ForceNickChange(params[0].c_str());
- Utils->RouteCommand(route_back_again, command, params, who);
+ who->ForceNickChange(params[0]);
+ Utils->DoOneToAllButSender(prefix, command, params, prefix);
}
else
{
if (!cmd)
{
- irc::stringjoiner pmlist(" ", params, 0, params.size() - 1);
+ irc::stringjoiner pmlist(params);
ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Unrecognised S2S command :%s %s %s",
who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str());
SendError("Unrecognised command '" + command + "' -- possibly loaded mismatched modules");
if (params.size() < cmd->min_params)
{
- irc::stringjoiner pmlist(" ", params, 0, params.size() - 1);
+ irc::stringjoiner pmlist(params);
ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Insufficient parameters for S2S command :%s %s %s",
who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str());
SendError("Insufficient parameters for command '" + command + "'");
if (res == CMD_INVALID)
{
- irc::stringjoiner pmlist(" ", params, 0, params.size() - 1);
+ irc::stringjoiner pmlist(params);
ServerInstance->Logs->Log("m_spanningtree", LOG_SPARSE, "Error handling S2S command :%s %s %s",
who->uuid.c_str(), command.c_str(), pmlist.GetJoined().c_str());
SendError("Error handling '" + command + "' -- possibly loaded mismatched modules");
}
else if (res == CMD_SUCCESS)
- Utils->RouteCommand(route_back_again, command, params, who);
+ Utils->RouteCommand(route_back_again, cmd, params, who);
}
}