[DONE] Drop messages based on nick and body

These are old archives. They are kept for historic purposes only.

Moderators: Gottem, Supporters

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

[DONE] Drop messages based on nick and body

Post by Gottem »

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;
	};
};
Syntax:
TEXTSHUN <ADD/DEL> <nickrgx> <bodyrgx> [expire] <reason>
Also supports the aliases TS and TLINE.

Examples:
  • /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 (credit card or iDEAL, use the custom job fee option in my shop) ;];]
Post Reply