1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 17:14:46 +02:00

Add support for CAP draft/no-implicit-names

https://github.com/unrealircd/unrealircd/pull/265 by Valware
"This is an IRCv3 extension which lets clients opt-out of receiving /names on join.
 This is useful for bots on large channels who do not need to know who is in the channel.
 Specification: https://ircv3.net/specs/extensions/no-implicit-names"

+ module rename from 'no-implicit-names-cap' to 'no-implicit-names'
  (simply because no other modules has that -cap suffix)
+ update to Makefile.windows
This commit is contained in:
Bram Matthys
2023-12-26 14:46:54 +01:00
parent 48d3673a02
commit 600185deba
5 changed files with 75 additions and 1 deletions
+4
View File
@@ -323,6 +323,7 @@ DLL_FILES=\
src/modules/names.dll \
src/modules/netinfo.dll \
src/modules/nick.dll \
src/modules/no-implicit-names.dll \
src/modules/nocodes.dll \
src/modules/cloak_md5.dll \
src/modules/cloak_none.dll \
@@ -1078,6 +1079,9 @@ src/modules/netinfo.dll: src/modules/netinfo.c $(INCLUDES)
src/modules/nick.dll: src/modules/nick.c $(INCLUDES)
$(CC) $(MODCFLAGS) src/modules/nick.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/nick.pdb $(MODLFLAGS)
src/modules/no-implicit-names.dll: src/modules/no-implicit-names.c $(INCLUDES)
$(CC) $(MODCFLAGS) src/modules/no-implicit-names.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/no-implicit-names.pdb $(MODLFLAGS)
src/modules/nocodes.dll: src/modules/nocodes.c $(INCLUDES)
$(CC) $(MODCFLAGS) src/modules/nocodes.c /Fesrc/modules/ /Fosrc/modules/ /Fdsrc/modules/nocodes.pdb $(MODLFLAGS)
+1
View File
@@ -244,6 +244,7 @@ loadmodule "chathistory"; /* CHATHISTORY client command, 005 and a CAP (draft) *
loadmodule "monitor"; /* MONITOR command with functionality similar to WATCH */
loadmodule "extended-monitor"; /* add away status, gecos and userhost changes to MONITOR (draft) */
loadmodule "standard-replies"; /* Standard Replies */
loadmodule "no-implicit-names"; /* Opt out of receiving implicit NAMES when joining a channel */
/*** RPC modules ***
+1
View File
@@ -85,6 +85,7 @@ MODULES= \
real-quit-reason.so \
spamreport.so crule.so \
central-api.so central-blocklist.so \
no-implicit-names.so \
$(GEOIP_CLASSIC_OBJECTS) $(GEOIP_MAXMIND_OBJECTS)
MODULEFLAGS=@MODULEFLAGS@
+2 -1
View File
@@ -270,7 +270,8 @@ void _join_channel(Channel *channel, Client *client, MessageTag *recv_mtags, con
parv[0] = NULL;
parv[1] = channel->name;
parv[2] = NULL;
do_cmd(client, NULL, "NAMES", 2, parv);
if (!HasCapability(client,"draft/no-implicit-names") && !HasCapability(client, "no-implicit-names"))
do_cmd(client, NULL, "NAMES", 2, parv);;
unreal_log(ULOG_INFO, "join", "LOCAL_CLIENT_JOIN", client,
"User $client joined $channel",
+67
View File
@@ -0,0 +1,67 @@
/*
* Unreal Internet Relay Chat Daemon, src/modules/no-implicit-names.c
* (C) 2023 Valware 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"
ModuleHeader MOD_HEADER
= {
"no-implicit-names",
"1.0",
"Opt out of receiving an implicit NAMES list on JOIN",
"UnrealIRCd Team",
"unrealircd-6",
};
#define NO_IMPLICIT_NAMES_CAP_DRAFT "draft/no-implicit-names"
#define NO_IMPLICIT_NAMES_CAP "no-implicit-names"
long CAP_NO_IMPLICIT_NAMES_DRAFT = 0L;
long CAP_NO_IMPLICIT_NAMES = 0L;
MOD_INIT()
{
/** We only add the draft version for now */
ClientCapabilityInfo cap;
memset(&cap, 0, sizeof(cap));
cap.name = NO_IMPLICIT_NAMES_CAP_DRAFT;
if (!ClientCapabilityAdd(modinfo->handle, &cap, &CAP_NO_IMPLICIT_NAMES_DRAFT))
{
return MOD_FAILED;
}
/** This is for the future :D */
/**
memset(&cap, 0, sizeof(cap));
cap.name = NO_IMPLICIT_NAMES_CAP;
ClientCapabilityAdd(modinfo->handle, &cap, &CAP_NO_IMPLICIT_NAMES);
*/
return MOD_SUCCESS;
}
MOD_LOAD()
{
return MOD_SUCCESS;
}
MOD_UNLOAD()
{
return MOD_SUCCESS;
}