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 ERR_SUMMONDISABLED = 445,
28 ERR_USERSDISABLED = 446
34 class CommandConnect : public Command
37 /** Constructor for connect.
39 CommandConnect(Module* parent)
40 : Command(parent, "CONNECT", 1)
43 syntax = "<servermask>";
47 * @param parameters The parameters to the command
48 * @param user The user issuing the command
49 * @return A value from CmdResult to indicate command success or failure.
51 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
54 * This is handled by the server linking module, if necessary. Do not remove this stub.
56 user->WriteNotice("Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.");
63 class CommandLinks : public Command
66 /** Constructor for links.
68 CommandLinks(Module* parent)
69 : Command(parent, "LINKS", 0, 0)
74 * @param parameters The parameters to the command
75 * @param user The user issuing the command
76 * @return A value from CmdResult to indicate command success or failure.
78 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
80 user->WriteNumeric(RPL_LINKS, ServerInstance->Config->ServerName, ServerInstance->Config->ServerName, InspIRCd::Format("0 %s", ServerInstance->Config->ServerDesc.c_str()));
81 user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list.");
88 class CommandServer : public Command
91 /** Constructor for server.
93 CommandServer(Module* parent)
94 : Command(parent, "SERVER")
96 works_before_reg = true;
100 * @param parameters The parameters to the command
101 * @param user The user issuing the command
102 * @return A value from CmdResult to indicate command success or failure.
104 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
106 if (user->registered == REG_ALL)
108 user->WriteNumeric(ERR_ALREADYREGISTERED, "You are already registered. (Perhaps your IRC client does not have a /SERVER command).");
112 user->WriteNumeric(ERR_NOTREGISTERED, "SERVER", "You may not register as a server (servers have separate ports from clients, change your config)");
120 class CommandSquit : public Command
123 /** Constructor for squit.
125 CommandSquit(Module* parent)
126 : Command(parent, "SQUIT", 1, 2)
129 syntax = "<servermask>";
133 * @param parameters The parameters to the command
134 * @param user The user issuing the command
135 * @return A value from CmdResult to indicate command success or failure.
137 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
139 user->WriteNotice("Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.");
145 : public SplitCommand
148 CommandSummon(Module* Creator)
149 : SplitCommand(Creator, "SUMMON", 1)
153 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE
155 user->WriteNumeric(ERR_SUMMONDISABLED, "SUMMON has been disabled");
161 : public SplitCommand
164 CommandUsers(Module* Creator)
165 : SplitCommand(Creator, "USERS")
169 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE
171 user->WriteNumeric(ERR_USERSDISABLED, "USERS has been disabled");
176 class CoreModStub : public Module
178 CommandConnect cmdconnect;
179 CommandLinks cmdlinks;
180 CommandServer cmdserver;
181 CommandSquit cmdsquit;
182 CommandSummon cmdsummon;
183 CommandUsers cmdusers;
196 Version GetVersion() CXX11_OVERRIDE
198 return Version("Provides stubs for unimplemented commands", VF_VENDOR|VF_CORE);
202 MODULE_INIT(CoreModStub)