2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2019 Robby <robby@chatbelgie.be>
5 * Copyright (C) 2017-2019 Sadie Powell <sadie@witchery.services>
6 * Copyright (C) 2014-2016 Attila Molnar <attilamolnar@hush.com>
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
31 class CommandCapab : public Command
34 CommandCapab(Module* parent)
35 : Command(parent, "CAPAB")
37 works_before_reg = true;
40 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
42 if (user->registered == REG_NONE)
44 // The CAPAB command is used in the server protocol for negotiating
45 // the protocol version when initiating a server connection. There
46 // is no legitimate reason for a user to send this so we disconnect
47 // users who sent it in order to help out server admins who have
48 // misconfigured their server.
49 ServerInstance->Users->QuitUser(user, "You can not connect a server to a client port. Read " INSPIRCD_DOCS "modules/spanningtree for docs on how to link a server.");
57 class CommandConnect : public Command
60 /** Constructor for connect.
62 CommandConnect(Module* parent)
63 : Command(parent, "CONNECT", 1)
66 syntax = "<servermask>";
70 * @param parameters The parameters to the command
71 * @param user The user issuing the command
72 * @return A value from CmdResult to indicate command success or failure.
74 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
77 * This is handled by the server linking module, if necessary. Do not remove this stub.
79 user->WriteNotice("Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.");
86 class CommandLinks : public Command
89 /** Constructor for links.
91 CommandLinks(Module* parent)
92 : Command(parent, "LINKS", 0, 0)
97 * @param parameters The parameters to the command
98 * @param user The user issuing the command
99 * @return A value from CmdResult to indicate command success or failure.
101 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
103 user->WriteNumeric(RPL_LINKS, ServerInstance->Config->GetServerName(), ServerInstance->Config->GetServerName(), InspIRCd::Format("0 %s", ServerInstance->Config->GetServerDesc().c_str()));
104 user->WriteNumeric(RPL_ENDOFLINKS, '*', "End of /LINKS list.");
111 class CommandSquit : public Command
114 /** Constructor for squit.
116 CommandSquit(Module* parent)
117 : Command(parent, "SQUIT", 1, 2)
120 syntax = "<servermask>";
124 * @param parameters The parameters to the command
125 * @param user The user issuing the command
126 * @return A value from CmdResult to indicate command success or failure.
128 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
130 user->WriteNotice("Look into loading a linking module (like m_spanningtree) if you want this to do anything useful.");
136 : public SplitCommand
139 CommandSummon(Module* Creator)
140 : SplitCommand(Creator, "SUMMON", 1)
144 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE
146 user->WriteNumeric(ERR_SUMMONDISABLED, "SUMMON has been disabled");
152 : public SplitCommand
155 CommandUsers(Module* Creator)
156 : SplitCommand(Creator, "USERS")
160 CmdResult HandleLocal(LocalUser* user, const Params& parameters) CXX11_OVERRIDE
162 user->WriteNumeric(ERR_USERSDISABLED, "USERS has been disabled");
167 class CoreModStub : public Module
170 CommandCapab cmdcapab;
171 CommandConnect cmdconnect;
172 CommandLinks cmdlinks;
173 CommandSquit cmdsquit;
174 CommandSummon cmdsummon;
175 CommandUsers cmdusers;
188 Version GetVersion() CXX11_OVERRIDE
190 return Version("Provides stubs for unimplemented commands", VF_VENDOR|VF_CORE);
194 MODULE_INIT(CoreModStub)