1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2010 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 * ---------------------------------------------------
18 #include "resolvers.h"
21 #include "treeserver.h"
23 #include "treesocket.h"
26 CommandRConnect::CommandRConnect (Module* Creator, SpanningTreeUtilities* Util)
27 : Command(Creator, "RCONNECT", 2), Utils(Util)
30 syntax = "<remote-server-mask> <target-server-mask>";
33 CmdResult CommandRConnect::Handle (const std::vector<std::string>& parameters, User *user)
37 if (!Utils->FindServerMask(parameters[0]))
39 user->WriteServ("NOTICE %s :*** RCONNECT: Server \002%s\002 isn't connected to the network!", user->nick.c_str(), parameters[0].c_str());
42 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());
45 /* Is this aimed at our server? */
46 if (InspIRCd::Match(ServerInstance->Config->ServerName,parameters[0]))
48 /* Yes, initiate the given connect */
49 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());
50 std::vector<std::string> para;
51 para.push_back(parameters[1]);
52 ((ModuleSpanningTree*)(Module*)creator)->HandleConnect(para, user);
57 RouteDescriptor CommandRConnect::GetRouting(User* user, const std::vector<std::string>& parameters)
59 return ROUTE_UNICAST(parameters[0]);