mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-09 10:39:02 -04:00
Move the userip module to contrib.
This module only exists for UnrealIRCd compatibility and provides the same functionality as the check module but less useful.
This commit is contained in:
parent
696fd30209
commit
0f84414b39
@ -463,11 +463,7 @@ RCONNECT REHASH RELOADMODULE RESTART RLINE
|
||||
RSQUIT SAJOIN SAKICK SAMODE SANICK
|
||||
SAPART SAQUIT SATOPIC SETHOST SETIDENT
|
||||
SETIDLE SHUN SQUIT SWHOIS TLINE
|
||||
UNLOADMODULE USERIP WALLOPS ZLINE
|
||||
">
|
||||
|
||||
<helpop key="userip" title="/USERIP <nick> [<nick>]+" value="
|
||||
Returns the IP address and nickname of the given user(s).
|
||||
UNLOADMODULE WALLOPS ZLINE
|
||||
">
|
||||
|
||||
<helpop key="tline" title="/TLINE <mask>" value="
|
||||
|
@ -2355,12 +2355,6 @@
|
||||
# pending invites from channels without waiting for the user to join.
|
||||
#<module name="uninvite">
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
# Userip module: Adds the /USERIP command.
|
||||
# Allows users to query their own IP, also allows opers to query the IP
|
||||
# of anyone else.
|
||||
#<module name="userip">
|
||||
|
||||
#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
|
||||
# Vhost module: Adds the VHOST command which allows for adding virtual
|
||||
# hosts which are accessible using a username and password in the config.
|
||||
|
@ -1,108 +0,0 @@
|
||||
/*
|
||||
* InspIRCd -- Internet Relay Chat Daemon
|
||||
*
|
||||
* Copyright (C) 2013, 2017-2018 Sadie Powell <sadie@witchery.services>
|
||||
* Copyright (C) 2012-2014, 2016 Attila Molnar <attilamolnar@hush.com>
|
||||
* Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
|
||||
* Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
|
||||
* Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
|
||||
* Copyright (C) 2007-2009 Robin Burchell <robin+git@viroteck.net>
|
||||
* Copyright (C) 2007-2008 Dennis Friis <peavey@inspircd.org>
|
||||
* Copyright (C) 2005-2007 Craig Edwards <brain@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/isupport.h"
|
||||
|
||||
enum
|
||||
{
|
||||
// From UnrealIRCd.
|
||||
RPL_USERIP = 340,
|
||||
};
|
||||
|
||||
class CommandUserip final
|
||||
: public Command
|
||||
{
|
||||
private:
|
||||
UserModeReference hideopermode;
|
||||
|
||||
public:
|
||||
CommandUserip(Module* Creator)
|
||||
: Command(Creator,"USERIP", 1)
|
||||
, hideopermode(Creator, "hideoper")
|
||||
{
|
||||
allow_empty_last_param = false;
|
||||
syntax = { "<nick> [<nick>]+" };
|
||||
}
|
||||
|
||||
CmdResult Handle(User* user, const Params& parameters) override
|
||||
{
|
||||
const bool has_privs = user->HasPrivPermission("users/auspex");
|
||||
|
||||
std::string retbuf;
|
||||
|
||||
size_t paramcount = std::min<size_t>(parameters.size(), 5);
|
||||
for (size_t i = 0; i < paramcount; ++i)
|
||||
{
|
||||
User *u = ServerInstance->Users.FindNick(parameters[i]);
|
||||
if ((u) && (u->registered == REG_ALL))
|
||||
{
|
||||
retbuf += u->nick;
|
||||
|
||||
if (u->IsOper())
|
||||
{
|
||||
// XXX: +H hidden opers must not be shown as opers
|
||||
if ((u == user) || (has_privs) || (!u->IsModeSet(hideopermode)))
|
||||
retbuf += '*';
|
||||
}
|
||||
|
||||
retbuf += '=';
|
||||
retbuf += (u->IsAway() ? '-' : '+');
|
||||
retbuf += u->ident;
|
||||
retbuf += '@';
|
||||
retbuf += (u == user || has_privs ? u->GetIPString() : "255.255.255.255");
|
||||
retbuf += ' ';
|
||||
}
|
||||
}
|
||||
|
||||
user->WriteNumeric(RPL_USERIP, retbuf);
|
||||
|
||||
return CmdResult::SUCCESS;
|
||||
}
|
||||
};
|
||||
|
||||
class ModuleUserIP final
|
||||
: public Module
|
||||
, public ISupport::EventListener
|
||||
{
|
||||
private:
|
||||
CommandUserip cmd;
|
||||
|
||||
public:
|
||||
ModuleUserIP()
|
||||
: Module(VF_VENDOR, "Adds the /USERIP command which allows users to find out the IP address of one or more connected users.")
|
||||
, ISupport::EventListener(this)
|
||||
, cmd(this)
|
||||
{
|
||||
}
|
||||
|
||||
void OnBuildISupport(ISupport::TokenMap& tokens) override
|
||||
{
|
||||
tokens["USERIP"];
|
||||
}
|
||||
};
|
||||
|
||||
MODULE_INIT(ModuleUserIP)
|
Loading…
x
Reference in New Issue
Block a user