1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 19:43:13 +02:00
Files
unrealircd/src/modules/usermodes/showwhois.c
T
Bram Matthys 520804edc2 Add set::whois-detail which allows you to configure which items
to expose to which users and in what detail.

The default configuration is as follows:

set {
	whois-details {
		basic		{ everyone full; }
		modes		{ everyone none;	self full;	oper full; }
		realhost	{ everyone none;	self full;	oper full; }
		registered-nick	{ everyone full; }
		channels	{ everyone limited;	self full;	oper full; }
		server		{ everyone full; }
		away		{ everyone full; }
		oper		{ everyone limited;	self full;	oper full; }
		secure		{ everyone limited;	self full;	oper full; }
		bot		{ everyone full; }
		services	{ everyone full; }
		reputation	{ everyone none;	self none;	oper full; }
		geo		{ everyone none;	self none;	oper full; }
		certfp		{ everyone full; }
		shunned		{ everyone none;	self none;	oper full; }
		account		{ everyone full; }
		swhois		{ everyone full; }
		idle		{ everyone limited;	self full;	oper full; }
	}
}

Oh, yeah, and for "secure" this also adds displaying of the TLS cipher
in /WHOIS for ircops and self by default. For all others it is limited
to just "is using a Secure Connection".

This also removes the newly added set::geoip::whois-for-anyone since
it is now configured via set::whois-details::geo.

Module coders: HOOKTYPE_WHOIS changed and you may no longer send
directly to the client from this hook. Instead, you should use
add to the NameValuePrioList, usually via the functions
add_nvplist_numeric() and add_nvplist_numeric_fmt().
For inspiration see bot_whois in src/modules/usermodes/bot.c
and reputation_whois in src/modules/reputation.c
2021-09-27 17:27:26 +02:00

77 lines
1.8 KiB
C

/*
* Show when someone does a /WHOIS on you (User mode +W)
* (C) Copyright 2000-.. Bram Matthys (Syzop) and the UnrealIRCd team
*
* This program 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; either version 1, or (at your option)
* any later version.
*
* 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, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "unrealircd.h"
#define IsWhois(cptr) (cptr->umodes & UMODE_SHOWWHOIS)
/* Module header */
ModuleHeader MOD_HEADER
= {
"usermodes/showwhois",
"4.2",
"User Mode +W",
"UnrealIRCd Team",
"unrealircd-6",
};
/* Global variables */
long UMODE_SHOWWHOIS = 0L;
/* Forward declarations */
int showwhois_whois(Client *requester, Client *target, NameValuePrioList **list);
MOD_TEST()
{
return MOD_SUCCESS;
}
MOD_INIT()
{
UmodeAdd(modinfo->handle, 'W', UMODE_GLOBAL, 1, umode_allow_opers, &UMODE_SHOWWHOIS);
HookAdd(modinfo->handle, HOOKTYPE_WHOIS, 0, showwhois_whois);
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}
MOD_LOAD()
{
return MOD_SUCCESS;
}
MOD_UNLOAD()
{
return MOD_SUCCESS;
}
int showwhois_whois(Client *requester, Client *target, NameValuePrioList **list)
{
if (IsWhois(target) && (requester != target))
{
sendnotice(target,
"*** %s (%s@%s) did a /whois on you.",
requester->name,
requester->user->username, requester->user->realhost);
}
return 0;
}