pissircd/src/modules/chanmodes
Bram Matthys 9691a6d819
Create TextAnalysis framework (hook), this counts the unicode block
switches like antimixedutf8 did, and counts the number of characters
used per unicode block. Potentially more can be added later, this is
flexible and modules can add stuff (..well not yet.. the struct is
missing some members..).

Use it from antimixedutf8 so that it now uses the new code, which is
similar to what I made and then reverted in July 2023:
3e2f668f10
..except that it now calculated in src/modules/utf8functions.c.
But yeah, this needs more testing and possibly (default) score
adjustments to deal with false positives !! And a warning in release notes :D

Put the text analysis in ClientContext member textanalysis,
so typically accessed through clictx->textanalysis.
Note that this struct can (and often is) NULL, for example if it is
a remote client, if it is not a PRIVMSG/NOTICE (will improve later)
or if the utf8functions module is not loaded (to keep things optional).

BREAKING CHANGE is that ClientContext is now passed in the
HOOKTYPE_CAN_SEND_TO_CHANNEL and HOOKTYPE_CAN_SEND_TO_USER hooks.

So HOOKTYPE_CAN_SEND_TO_USER prototype changed from:
int hooktype_can_send_to_user(Client *client, Client *target, const char **text, const char **errmsg, SendType sendtype);
To:
int hooktype_can_send_to_user(Client *client, Client *target, const char **text, const char **errmsg, SendType sendtype, ClientContext *clictx);

And HOOKTYPE_CAN_SEND_TO_CHANNEL prototype changes from:
int hooktype_can_send_to_channel(Client *client, Channel *channel, Membership *member, const char **text, const char **errmsg, SendType sendtype);
To:
int hooktype_can_send_to_channel(Client *client, Channel *channel, Membership *member, const char **text, const char **errmsg, SendType sendtype, ClientContext *clictx);

A side-affect of this change for antimixedutf8 purposes is that,
while the analysis is only done once per line, the 'actions' are
performed for each target, so the action will run 4 times for
"PRIVMSG a,b,c,d :text" although that may not be important in
practice. Just mentioning.
2025-03-23 11:44:24 +01:00
..
censor.c Create TextAnalysis framework (hook), this counts the unicode block 2025-03-23 11:44:24 +01:00
chanadmin.c Rename find_person() to find_user() to be consistent in the naming that 2021-09-25 16:44:11 +02:00
chanop.c Get rid of has_voice(), is_half_op(), is_skochanop(), is_chan_op(), is_chanadmin(), 2021-09-25 08:00:57 +02:00
chanowner.c Rename find_person() to find_user() to be consistent in the naming that 2021-09-25 16:44:11 +02:00
delayjoin.c In HOOKTYPE_PRE_CHANMSG the mtags is now a MessageTag **, 2023-08-19 17:26:14 +02:00
floodprot.c Create TextAnalysis framework (hook), this counts the unicode block 2025-03-23 11:44:24 +01:00
halfop.c Fix channel ops unable to -h someone, even though they could +h. 2022-03-18 07:26:53 +01:00
history.c Update cmode.free_param definition to fix memleak due to yesterdays commit. 2023-04-02 08:24:00 +02:00
inviteonly.c Update HOOKTYPE_CAN_JOIN and HOOKTYPE_CAN_JOIN_LIMITEXCEEDED to take 2021-09-12 16:09:36 +02:00
isregistered.c Update channel mode API to use more consts 2021-09-10 14:06:57 +02:00
issecure.c Fix server notice about setting -Z, it was sent from the SID instead of server name (#263) 2023-11-20 15:28:23 +00:00
key.c Update cmode.free_param definition to fix memleak due to yesterdays commit. 2023-04-02 08:24:00 +02:00
limit.c Update cmode.free_param definition to fix memleak due to yesterdays commit. 2023-04-02 08:24:00 +02:00
link.c Fix b->ban_type not being set properly at all places (BanContext). 2024-09-09 16:44:57 +02:00
Makefile.in Modularize member modes (vhoaq). 2021-09-13 18:44:18 +02:00
moderated.c Create TextAnalysis framework (hook), this counts the unicode block 2025-03-23 11:44:24 +01:00
nocolor.c Create TextAnalysis framework (hook), this counts the unicode block 2025-03-23 11:44:24 +01:00
noctcp.c Create TextAnalysis framework (hook), this counts the unicode block 2025-03-23 11:44:24 +01:00
noexternalmsgs.c Create TextAnalysis framework (hook), this counts the unicode block 2025-03-23 11:44:24 +01:00
noinvite.c Update HOOKTYPE_PRE_KNOCK to include reason (not used, though) 2021-09-25 17:08:53 +02:00
nokick.c Modularize member modes (vhoaq). 2021-09-13 18:44:18 +02:00
noknock.c Update HOOKTYPE_PRE_KNOCK to include reason (not used, though) 2021-09-25 17:08:53 +02:00
nonickchange.c Get rid of has_voice(), is_half_op(), is_skochanop(), is_chan_op(), is_chanadmin(), 2021-09-25 08:00:57 +02:00
nonotice.c Create TextAnalysis framework (hook), this counts the unicode block 2025-03-23 11:44:24 +01:00
operonly.c Make /INVITE bypass (nearly) all channel mode restrictions, as it used to be 2022-08-06 15:52:16 +02:00
permanent.c Fix cut-off and expansion issues with MODE, which is a possible problem when 2021-11-19 13:53:21 +01:00
private.c Massively rename Cmode.flag to Cmode.letter. 2021-08-22 18:45:13 +02:00
regonly.c Update HOOKTYPE_CAN_JOIN and HOOKTYPE_CAN_JOIN_LIMITEXCEEDED to take 2021-09-12 16:09:36 +02:00
regonlyspeak.c Create TextAnalysis framework (hook), this counts the unicode block 2025-03-23 11:44:24 +01:00
secret.c Massively rename Cmode.flag to Cmode.letter. 2021-08-22 18:45:13 +02:00
secureonly.c Add JOIN/PART/KICK logging (snomask 'j'). 2021-09-24 16:08:41 +02:00
stripcolor.c Create TextAnalysis framework (hook), this counts the unicode block 2025-03-23 11:44:24 +01:00
topiclimit.c Add HOOKTYPE_CAN_SET_TOPIC, which works similar to HOOKTYPE_CAN_KICK. 2021-09-25 09:04:19 +02:00
voice.c Rename find_person() to find_user() to be consistent in the naming that 2021-09-25 16:44:11 +02:00