mirror of
https://github.com/pissnet/pissircd.git
synced 2025-07-13 06:32:24 +01:00

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
105 lines
2.5 KiB
C
105 lines
2.5 KiB
C
/*
|
|
* Bot user mode (User mode +B)
|
|
* (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 IsBot(cptr) (cptr->umodes & UMODE_BOT)
|
|
|
|
/* Module header */
|
|
ModuleHeader MOD_HEADER
|
|
= {
|
|
"usermodes/bot",
|
|
"4.2",
|
|
"User Mode +B",
|
|
"UnrealIRCd Team",
|
|
"unrealircd-6",
|
|
};
|
|
|
|
/* Global variables */
|
|
long UMODE_BOT = 0L;
|
|
|
|
/* Forward declarations */
|
|
int bot_whois(Client *client, Client *acptr, NameValuePrioList **list);
|
|
int bot_who_status(Client *client, Client *acptr, Channel *channel, Member *cm, const char *status, int cansee);
|
|
int bot_umode_change(Client *client, long oldmode, long newmode);
|
|
|
|
MOD_TEST()
|
|
{
|
|
return MOD_SUCCESS;
|
|
}
|
|
|
|
MOD_INIT()
|
|
{
|
|
UmodeAdd(modinfo->handle, 'B', UMODE_GLOBAL, 0, NULL, &UMODE_BOT);
|
|
ISupportAdd(modinfo->handle, "BOT", "B");
|
|
|
|
HookAdd(modinfo->handle, HOOKTYPE_WHOIS, 0, bot_whois);
|
|
HookAdd(modinfo->handle, HOOKTYPE_WHO_STATUS, 0, bot_who_status);
|
|
HookAdd(modinfo->handle, HOOKTYPE_UMODE_CHANGE, 0, bot_umode_change);
|
|
|
|
MARK_AS_OFFICIAL_MODULE(modinfo);
|
|
return MOD_SUCCESS;
|
|
}
|
|
|
|
MOD_LOAD()
|
|
{
|
|
return MOD_SUCCESS;
|
|
}
|
|
|
|
MOD_UNLOAD()
|
|
{
|
|
return MOD_SUCCESS;
|
|
}
|
|
|
|
int bot_whois(Client *client, Client *target, NameValuePrioList **list)
|
|
{
|
|
char buf[512];
|
|
|
|
if (!IsBot(target))
|
|
return 0;
|
|
|
|
if (whois_get_policy(client, target, "bot") == WHOIS_CONFIG_DETAILS_NONE)
|
|
return 0;
|
|
|
|
add_nvplist_numeric(list, 0, "bot", client, RPL_WHOISBOT, target->name, NETWORK_NAME);
|
|
|
|
return 0;
|
|
}
|
|
|
|
int bot_who_status(Client *client, Client *target, Channel *channel, Member *cm, const char *status, int cansee)
|
|
{
|
|
if (IsBot(target))
|
|
return 'B';
|
|
|
|
return 0;
|
|
}
|
|
|
|
int bot_umode_change(Client *client, long oldmode, long newmode)
|
|
{
|
|
if ((newmode & UMODE_BOT) && !(oldmode & UMODE_BOT) && MyUser(client))
|
|
{
|
|
/* now +B */
|
|
const char *parv[2];
|
|
parv[0] = client->name;
|
|
parv[1] = NULL;
|
|
do_cmd(client, NULL, "BOTMOTD", 1, parv);
|
|
}
|
|
|
|
return 0;
|
|
}
|