2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
5 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
6 * Copyright (C) 2007 Robin Burchell <robin+git@viroteck.net>
8 * This file is part of InspIRCd. InspIRCd is free software: you can
9 * redistribute it and/or modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation, version 2.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 class CommandConnect : public Command
30 /** Constructor for connect.
32 CommandConnect(Module* parent)
33 : Command(parent, "CONNECT", 1)
36 syntax = "<servername>";
40 * @param parameters The parameters to the command
41 * @param user The user issuing the command
42 * @return A value from CmdResult to indicate command success or failure.
44 CmdResult Handle(const std::vector<std::string>& parameters, User* user)
47 * This is handled by the server linking module, if necessary. Do not remove this stub.
49 user->WriteServ( "NOTICE %s :Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.", user->nick.c_str());
56 class CommandLinks : public Command
59 /** Constructor for links.
61 CommandLinks(Module* parent)
62 : Command(parent, "LINKS", 0, 0)
67 * @param parameters The parameters to the command
68 * @param user The user issuing the command
69 * @return A value from CmdResult to indicate command success or failure.
71 CmdResult Handle(const std::vector<std::string>& parameters, User* user)
73 user->WriteNumeric(RPL_LINKS, "%s %s :0 %s", ServerInstance->Config->ServerName.c_str(),ServerInstance->Config->ServerName.c_str(),ServerInstance->Config->ServerDesc.c_str());
74 user->WriteNumeric(RPL_ENDOFLINKS, "* :End of /LINKS list.");
81 class CommandServer : public Command
84 /** Constructor for server.
86 CommandServer(Module* parent)
87 : Command(parent, "SERVER")
89 works_before_reg = true;
93 * @param parameters The parameters to the command
94 * @param user The user issuing the command
95 * @return A value from CmdResult to indicate command success or failure.
97 CmdResult Handle(const std::vector<std::string>& parameters, User* user)
99 if (user->registered == REG_ALL)
101 user->WriteNumeric(ERR_ALREADYREGISTERED, ":You are already registered. (Perhaps your IRC client does not have a /SERVER command).");
105 user->WriteNumeric(ERR_NOTREGISTERED, "SERVER :You may not register as a server (servers have separate ports from clients, change your config)");
113 class CommandSquit : public Command
116 /** Constructor for squit.
118 CommandSquit(Module* parent)
119 : Command(parent, "SQUIT", 1, 2)
122 syntax = "<servername>";
126 * @param parameters The parameters to the command
127 * @param user The user issuing the command
128 * @return A value from CmdResult to indicate command success or failure.
130 CmdResult Handle(const std::vector<std::string>& parameters, User* user)
132 user->WriteServ("NOTICE %s :Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.", user->nick.c_str());
137 class CoreModStub : public Module
139 CommandConnect cmdconnect;
140 CommandLinks cmdlinks;
141 CommandServer cmdserver;
142 CommandSquit cmdsquit;
146 : cmdconnect(this), cmdlinks(this), cmdserver(this), cmdsquit(this)
152 return Version("Provides the stub commands CONNECT, LINKS, SERVER and SQUIT", VF_VENDOR|VF_CORE);
156 MODULE_INIT(CoreModStub)