+enum
+{
+ // From RFC 1459.
+ ERR_SUMMONDISABLED = 445,
+ ERR_USERSDISABLED = 446
+};
+
+class CommandCapab : public Command
+{
+ public:
+ CommandCapab(Module* parent)
+ : Command(parent, "CAPAB")
+ {
+ works_before_reg = true;
+ }
+
+ CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
+ {
+ if (user->registered == REG_NONE)
+ {
+ // The CAPAB command is used in the server protocol for negotiating
+ // the protocol version when initiating a server connection. There
+ // is no legitimate reason for a user to send this so we disconnect
+ // users who sent it in order to help out server admins who have
+ // misconfigured their server.
+ 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.");
+ }
+ return CMD_FAILURE;
+ }
+};