rendered paste bodyproc tsr:echo:msgm {nick uhost hand text} {tsr:echo:pubm $nick $uhost $hand "MSG" $text}
proc tsr:echo:pubm {nick uhost hand chan text} {
global echo echolist echochan echochannel echostrip echofilters listen
if { $chan != "MSG" } {
foreach tags [array names echolist] {set tag ""
foreach mask $echolist($tags) {if {[string match $mask [string tolower $nick!$uhost]]} {set tag $tags; continue}}
if { $tag != "" } {
if {[lsearch [string tolower $listen($tag)] [string tolower $chan]]!=-1} {
if {$echofilters($tag)} {set filters [tsr:echo:checkfilter [string tolower $tag] [string tolower [tsr:echo:strip:all $text]]]} else {set filters 1}
foreach chans $echochan($tag) {if {$echostrip($chans)} {set text [tsr:echo:checkstrip $echostrip($chans) $text]}}
if { $filters } {
foreach put $echo(output) {switch $put {"msg" {set put [str $put msg $text]} "chan" {set put [str $put chan $chan]} "nick" {set put [str $put nick $nick]} "tag" {set put [str $put tag $tag]}}}
foreach echos $echochan($tag) {if {$echochannel([string tolower $echos])} {putchan $echos $put}}
}
}
}
}
}
}