[DONE] Drop messages based on nick and body

For the old 4.x series

Moderators: Gottem, Supporters

Post Reply
UnrealIRCd coder
Posts: 189
Joined: Fri Aug 19, 2016 5:26 pm
Location: NL

[DONE] Drop messages based on nick and body

Post by Gottem » Sat Mar 11, 2017 9:55 pm

Enables opers to drop messages based on nick and body regexes (so-called T:Lines), similar to badwords and spamfilter but more specific. It only supports (PCRE) regexes because regular wildcards seem ineffective to me. ;] Also, you can't have spaces (due to how IRC works) so you'll have to use \s instead. Unreal creates a case-insensitive match so no worries there, it also tells you if you messed up your regex (and what). Only opers with the new operpriv textshun will be able to use it, although all others will get the notices since these T:Lines are network wide. You'll also get a server notice for when a T:Line is matched. Servers, U:Lines and opers are exempt for obvious reasons.

The expiration stuff is a lil' hacky because there's no "tick" in Unreal. So it only checks for expiration on the PRE*MSG hooks (pre user and channel messages) as well as on a module command (like one of the below examples). These expirations are propagated to other servers. Also, they store it in a ModData struct so it persists through a rehash without the need for a .db file. ;] Furthermore, they sync their known T:Lines upon server linkage. =] Other lines such as G:Lines, Z:Lines are also stored in memory and get resynced during a link so these work pretty similar.

Example config block:

Code: Select all

operclass netadmin-textshun {
	parent netadmin;
	privileges {
TEXTSHUN <ADD/DEL> <nickrgx> <bodyrgx> [expire] <reason>
Also supports the aliases TS and TLINE.

  • /tline add guest.+ h[o0]+m[o0]+ 0 nope => All...
  • /textshun add guest.+ h[o0]+m[o0]+ nope => ...of...
  • /ts del guest.+ .+ => ...these add/delete the same T:Line, with no expiration
  • /tline add guest.+ h[o0]+m[o0]+ 3600 ain't gonna happen => Add a T:Line that expires in an hour
  • /tline add guest.+ h[o0]+m[o0]+ 1h ain't gonna happen => Ditto
  • /tline => Show all T:Lines
  • /ts help => Show built-in help
The nick regex is matched against both nick!user@realhost and nick!user@vhost masks. The timestring stuff like 1h supports up to weeks (so you cannot do 1y).

Get it here.
If you like my modules, pls consider donating (through PayPal) or use the custom job fee option in my shop if you want to donate with credit card or iDEAL ;];]

Post Reply