aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--atmisc.tcl18
1 files 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} {