on !*:JOIN:#:{ whois_on_join $nick }
raw 311:*:{
var %table whois_on_join. $+ $network | if ($hget(%table,$2)) hadd %table $2 $2
}
raw 318:*:{
var %table whois_on_join. $+ $network , %table2 whois_on_join2. $+ $network | if ($hget(%table,$2) == $2) hdel %table $2 | hdel %table2 1.lastwhois
}
on *:CONNECT:{ var %table whois_on_join. $+ $network , %table2 whois_on_join2. $+ $network | hfree -w %table | hfree -w %table2 | hmake %table 1 | hmake %table2 101 }
ON *:NICK:{
var %table whois_on_join. $+ $network | if (!$hget(%table,$nick)) return
hadd %table $newnick $hget(%table,$nick) | hdel %table $nick
}
/*
{
Find the place in the script using these 3 times, and change them as you decide is appropriate
The 15 on the last line of script is the timer's interval.
The 5 in -mu5 uses 1recent.nick to block adding to que if already added within the past 5 seconds (mainly for sharing 2+ channels with nick)
The 1 in -mu1 uses 1.lastwhois to prevent timer from doing repeat /whois within 1 sec of a /whois performed on that nick during ON JOIN, if the previous /whois isn't finished
nick isn't removed from que until raw-311/318 shows successful whois is done.
hooks raw-311 to make sure that 318 didn't end the "rate limited" or "No such nick/channel" message
doesn't block adding nick if whois'ed prior to nick change
}
*/
alias whois_on_join {
var %table whois_on_join. $+ $network , %table2 whois_on_join2. $+ $network
if ($ctimer != %table) {
if ($1 == $null) return
if ($hget(%table,$1)) { goto exit }
if ($hget(%table2,1recent. $+ $1)) { goto exit }
hadd -m1 %table $1 1 | hadd -mu5 %table2 1recent. $+ $1 1
if ($hget(%table,2).item == $null) { var %nick $1 | goto into }
goto exit
}
:next_whois
var %t $hget(%table,0).item | if (%t == 0) return
var %nick $hget(%table,%t).item
if ($hget(%table2,1.lastwhois) == %nick) return
:into
if (!$comchan(%nick,1)) { hdel %table %nick | goto next_whois }
!whois %nick %nick | hadd -mu1 %table2 1.lastwhois %nick
:exit
if (!$timer(%table)) .timer $+ %table 0 15 whois_on_join
}