Demote the clones module to inspircd-contrib.

This commit is contained in:
Sadie Powell 2021-06-01 02:53:40 +01:00
parent e8c390e352
commit 1b152be36e
4 changed files with 11 additions and 125 deletions

View File

@ -452,16 +452,16 @@ Sets your real name to the specified real name.
<helpop key="coper" title="Oper Commands" value="
ALLTIME CBAN CHECK CHGHOST CHGIDENT
CHGNAME CLEARCHAN CLOAK CLONES CONNECT
DIE ELINE FILTER GLINE GLOADMODULE
GLOBOPS GRELOADMODULE GUNLOADMODULE KILL KLINE
LOADMODULE LOCKSERV NICKLOCK NICKUNLOCK OJOIN
OPERMOTD QLINE RCONNECT REHASH RELOADMODULE
RESTART RLINE RSQUIT SAJOIN SAKICK
SAMODE SANICK SAPART SAQUIT SATOPIC
SETHOST SETIDENT SETIDLE SHUN SQUIT
SWHOIS TLINE UNLOADMODULE UNLOCKSERV USERIP
WALLOPS ZLINE
CHGNAME CLEARCHAN CLOAK CONNECT DIE
ELINE FILTER GLINE GLOADMODULE GLOBOPS
GRELOADMODULE GUNLOADMODULE KILL KLINE LOADMODULE
LOCKSERV NICKLOCK NICKUNLOCK OJOIN OPERMOTD
QLINE RCONNECT REHASH RELOADMODULE RESTART
RLINE RSQUIT SAJOIN SAKICK SAMODE
SANICK SAPART SAQUIT SATOPIC SETHOST
SETIDENT SETIDLE SHUN SQUIT SWHOIS
TLINE UNLOADMODULE UNLOCKSERV USERIP WALLOPS
ZLINE
">
<helpop key="userip" title="/USERIP <nick> [<nick>]+" value="
@ -543,11 +543,6 @@ Depending on configuration, may announce that you have joined the
channel on official network business.
">
<helpop key="clones" title="/CLONES <limit>" value="
Retrieves a list of users with more clones than the specified
limit.
">
<helpop key="check" title="/CHECK <nick>|<ipmask>|<hostmask>|<channel> [<servername>]" value="
Allows opers to look up advanced information on nicknames, IP addresses,
hostmasks or channels, in a similar way to WHO but in more detail,

View File

@ -550,14 +550,6 @@
# prefix="net-"
# ignorecase="no">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Clones module: Adds an oper command /CLONES for detecting cloned
# users. Warning: This command may be resource intensive when it is
# issued, use with care.
# This module is oper-only.
# To use, CLONES must be in one of your oper class blocks.
#<module name="clones">
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
# Codepage module: Allows using a custom 8-bit codepage for nicknames
# and case mapping.

View File

@ -57,7 +57,7 @@
<class name="SACommands" commands="SAJOIN SAPART SANICK SAQUIT SATOPIC SAKICK SAMODE OJOIN">
<class name="ServerLink" commands="CONNECT SQUIT RCONNECT RSQUIT MKPASSWD ALLTIME SWHOIS LOCKSERV UNLOCKSERV" usermodes="*" chanmodes="*" privs="servers/auspex" snomasks="Cc">
<class name="BanControl" commands="KILL GLINE KLINE ZLINE QLINE ELINE TLINE RLINE CHECK NICKLOCK NICKUNLOCK SHUN CLONES CBAN" usermodes="*" chanmodes="*" snomasks="Xx">
<class name="BanControl" commands="KILL GLINE KLINE ZLINE QLINE ELINE TLINE RLINE CHECK NICKLOCK NICKUNLOCK SHUN CBAN" usermodes="*" chanmodes="*" snomasks="Xx">
<class name="OperChat" commands="WALLOPS GLOBOPS" usermodes="*" chanmodes="*" privs="users/mass-message" snomasks="Gg">
<class name="HostCloak" commands="SETHOST SETIDENT SETIDLE CHGNAME CHGHOST CHGIDENT" usermodes="*" chanmodes="*" privs="users/auspex">

View File

@ -1,101 +0,0 @@
/*
* InspIRCd -- Internet Relay Chat Daemon
*
* Copyright (C) 2013, 2018 Sadie Powell <sadie@witchery.services>
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
* Copyright (C) 2012, 2014 Attila Molnar <attilamolnar@hush.com>
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
* Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
* Copyright (C) 2007, 2010 Craig Edwards <brain@inspircd.org>
* Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
*
* This file is part of InspIRCd. InspIRCd is free software: you can
* redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, version 2.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "inspircd.h"
#include "modules/ircv3_batch.h"
enum
{
// InspIRCd-specific.
RPL_CLONES = 399
};
class CommandClones : public SplitCommand
{
private:
IRCv3::Batch::API batchmanager;
IRCv3::Batch::Batch batch;
public:
CommandClones(Module* Creator)
: SplitCommand(Creator,"CLONES", 1)
, batchmanager(Creator)
, batch("inspircd.org/clones")
{
access_needed = CmdAccess::OPERATOR;
syntax = { "<limit>" };
}
CmdResult HandleLocal(LocalUser* user, const Params& parameters) override
{
unsigned int limit = ConvToNum<unsigned int>(parameters[0]);
// Syntax of a CLONES reply:
// :irc.example.com BATCH +<id> inspircd.org/clones :<min-count>
// @batch=<id> :irc.example.com 399 <client> <local-count> <remote-count> <cidr-mask>
/// :irc.example.com BATCH :-<id>
if (batchmanager)
{
batchmanager->Start(batch);
batch.GetBatchStartMessage().PushParam(limit);
}
for (const auto& [range, counts] : ServerInstance->Users.GetCloneMap())
{
if (counts.global < limit)
continue;
Numeric::Numeric numeric(RPL_CLONES);
numeric.push(counts.local);
numeric.push(counts.global);
numeric.push(range.str());
ClientProtocol::Messages::Numeric numericmsg(numeric, user);
batch.AddToBatch(numericmsg);
user->Send(ServerInstance->GetRFCEvents().numeric, numericmsg);
}
if (batchmanager)
batchmanager->End(batch);
return CmdResult::SUCCESS;
}
};
class ModuleClones : public Module
{
private:
CommandClones cmd;
public:
ModuleClones()
: Module(VF_VENDOR, "Adds the /CLONES command which allows server operators to view IP addresses from which there are more than a specified number of connections.")
, cmd(this)
{
}
};
MODULE_INIT(ModuleClones)