
# Lets maskhost (used by most scripts to select banmask/usermask)
# return *!*@HOST if the thing you set here matches the host
# Usable most likely on Quakenet and Undernet
# to handle *!*@*.users.network.org masks correctly


set ::fakehostmasks {
	*.users.quakenet.org
	*.users.undernet.org
	*!~*
}

if {[info commands maskhost_r] != "maskhost_r"} {
	rename maskhost maskhost_r
}
proc maskhost {host} {
	global fakehostmasks
	foreach fmask [split $fakehostmasks \n] {
		set fmask [string trim $fmask]
		if {$fmask == ""} { continue }
		regsub -all {\\} $fmask {\\\\} fmask
		regsub -all {\[} $fmask {\\\[} fmask
		regsub -all {\]} $fmask {\\\]} fmask
		if {[string match $fmask $host]} {
			return *!*@[lindex [split $host @] end]
		}
	}
	return [maskhost_r $host]
}