1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "commands/cmd_whois.h"
16 #include "commands/cmd_stats.h"
19 #include "../transport.h"
21 #include "resolvers.h"
24 #include "treeserver.h"
26 #include "treesocket.h"
29 /* $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/rconnect.h */
31 CommandRConnect::CommandRConnect (InspIRCd* Instance, Module* Callback, SpanningTreeUtilities* Util) : Command(Instance, "RCONNECT", "o", 2), Creator(Callback), Utils(Util)
33 this->source = "m_spanningtree.so";
34 syntax = "<remote-server-mask> <target-server-mask>";
37 CmdResult CommandRConnect::Handle (const std::vector<std::string>& parameters, User *user)
41 if (!Utils->FindServerMask(parameters[0]))
43 user->WriteServ("NOTICE %s :*** RCONNECT: Server \002%s\002 isn't connected to the network!", user->nick.c_str(), parameters[0].c_str());
46 user->WriteServ("NOTICE %s :*** RCONNECT: Sending remote connect to \002%s\002 to connect server \002%s\002.",user->nick.c_str(),parameters[0].c_str(),parameters[1].c_str());
49 /* Is this aimed at our server? */
50 if (InspIRCd::Match(ServerInstance->Config->ServerName,parameters[0]))
52 /* Yes, initiate the given connect */
53 ServerInstance->SNO->WriteToSnoMask('l',"Remote CONNECT from %s matching \002%s\002, connecting server \002%s\002",user->nick.c_str(),parameters[0].c_str(),parameters[1].c_str());
54 std::vector<std::string> para;
55 para.push_back(parameters[1]);
56 std::string cmd("CONNECT");
57 std::string original_command = cmd + " " + parameters[1];
58 Creator->OnPreCommand(cmd, para, user, true, original_command);