From f1bfb5ab58d628e16dbc59f34a009864787967b4 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Mon, 16 Jun 2025 08:59:32 +0800 Subject: Add !ignd command like !igd but for ignoring offsite instead of onsite URLs --- atmisc.tcl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/atmisc.tcl b/atmisc.tcl index 1ebcf9c..959597b 100644 --- a/atmisc.tcl +++ b/atmisc.tcl @@ -86,9 +86,7 @@ proc extractRegistrableDomain {domain publicSuffixList} { set PSLfilename "public_suffix_list.dat" set thePSL [loadPublicSuffixList $PSLfilename] -bind pub * "!igd" igd - -proc igd {nick uhost hand chan text} { +proc igDomain {nick uhost hand chan text reStart reEnd} { if {$chan eq "#archivebot"} { if {[isvoice $nick $chan] || [isop $nick $chan]} { global thePSL @@ -96,13 +94,25 @@ proc igd {nick uhost hand chan text} { set hostname [dict get $components "host"] set registrableDomain [extractRegistrableDomain $hostname $thePSL] set escapedDomain [string map { "." "\\." } $registrableDomain] - putserv "PRIVMSG $chan :$nick: ^(http|ftp)s?://(\[^/\]*\[@.\])?$escapedDomain\\.?(:\\d+)?/" + putserv "PRIVMSG $chan :$nick: $reStart$escapedDomain$reEnd" } else { putserv "PRIVMSG #fire-trail :\[atmisc\] ignored \"!igd $text\" from $nick!$uhost in $chan - not a voice or an op" } } } +bind pub * "!igd" igd + +proc igd {nick uhost hand chan text} { + igDomain $nick $uhost $hand $chan $text "^(http|ftp)s?://(\[^/\]*\[@.\])?" "\\.?(:\\d+)?/" +} + +bind pub * "!ignd" ignd + +proc ignd {nick uhost hand chan text} { + igDomain $nick $uhost $hand $chan $text "^(http|ftp)s?://(?!(\[^/\]*\[@.\])?" "\\.?(:\\d+)?/)" +} + bind pub * "!b" bmeme proc bmeme {nick uhost hand chan text} { -- cgit v1.3.1-10-gc9f91