on *:text:*:#: {
if (http:// isin $1-) {
sockclose linkchecker
set %link $remove($matchtok($1-,http://,1,32),http://)
set %linkchan $chan
set %actlink $matchtok($1-,http://,1,32)
if (/ !isin %link) { set %link %link $+ / }
sockopen linkchecker $remove($left(%link,$pos(%link,/,1)),/) 80
halt
}
if (www. isin $1-) {
sockclose linkchecker
set %link $matchtok($1-,www.,1,32)
set %linkchan $chan
set %actlink $matchtok($1-,www.,1,32)
if (/ !isin %link) { set %link %link $+ / }
sockopen linkchecker $remove($left(%link,$pos(%link,/,1)),/) 80
halt
}
}
on *:sockopen:linkchecker: {
if $sockerr > 0 { sockclose $sockname | halt }
sockwrite -n $sockname GET / $+ $right(%link,$calc($len(%link)- $pos(%link,/,1))) HTTP/1.1
sockwrite -n $sockname Host: $remove($left(%link,$pos(%link,/,1)),/)
sockwrite -n $sockname $crlf
}
on *:sockread:linkchecker: {
if $sockerr > 0 { sockclose $sockname | halt }
sockread %linkh
if (%delbug != $null) && ($len(%linkch) <= 150) && (</title> !isin %linkh) { set %linkch %linkch %linkh }
if (%delbug != $null) && (</title> isin %linkh) {
msg %linkchan 13 $+ $replace(%linkch,",",',',&,&,<,<,>,>,©,©,®,®,™,™,€,€,£,£,¥,¥) (4 %actlink )
unset %delbug
sockclose $sockname
halt
}
if (<title> isin %linkh) {
set %linkch $remove($left(%linkh,$pos(%linkh,</title>,1)),</title>)
set %linkch $right(%linkch,$calc($len(%linkch)- $pos(%linkch,<title>,1) -6))
set %linkch $left(%linkch,$calc($len(%linkch)-1))
set %delbug 1
if (%linkch != $null) {
msg %linkchan 13 $+ $replace(%linkch,",",',',&,&,<,<,>,>,©,©,®,®,™,™,€,€,£,£,¥,¥) (4 %actlink )
sockclose $sockname
unset %delbug
halt
}
}
}