on *^:join:#:{
var %i = 1,%a,%b = $gettok($hget(lastnicks,$site),1,32)
while $ialchan($1,$2,%i).nick { %a = %a $v1 | inc %i }
; %a is set all nicks from $site
if %b && $v1 != $nick { %b = [Last Nick: $v1 $+ ] } | else var %b
; if <lastnick> is the current nick it will not be shown
if $remtok(%a,$nick,32) { %a = [Clones: $v1 $+ ] } | else var %a
; check if there are any clones to display
echo -tic join # · · Joins $nick $+([,$address,] %a %b
hadd -m lastnicks $site $nick $ctime
; update hash table
.timerlastnick 1 3 hsave lastnicks lastnicks.hsh
; save hash table, timer so it isn't saved multiple times if multiple joins
haltdef
}
on *:nick:{
; Update hash table
hadd lastnicks $site $newnick $ctime
}
on *:disconnect:{
hsave lastnicks lastnicks.hsh
}
on *:start:{
hmake lastnicks 10
; Makes table
if $isfile(lastnicks.hsh) { hload lastnicks lastnicks.hsh }
; loads table entries
var %i = 1,%a
while $hget(lastnicks,%i).item {
; loop all entries
%a = $v1
if $gettok($hget(lastnicks,%a),2,32) < $calc($ctime - 604800) { hdel lastnicks %a }
; delete entries not used for more than one week - adjust 604800 for more or less time.
inc %i
}
hsave lastnicks lastnicks.hsh
; resave the table
}