The point of this script is the same as the services version of !seen . It logs most basic IRC events, and whenever you (the user) or someone else types .seen it will tell you when they last saw $nick. You can also use .seenclear to clear all records.
It also includes a flood control, so if anyone tries to flood the .seen command, it will ignore them for 10 seconds.
on *:START: {
If ($hget(lastseen)) { hfree lastseen }
hmake lastseen
If ($isfile($scriptdirlastseen.txt)) { hload lastseen $scriptdirlastseen.txt }
echo -a 3,1.9:15XCept Lastseen v1.0 - Loaded9:3.
}
on *:UNLOAD: { unload.cmds }
on *:EXIT: { unload.cmds }
alias -l unload.cmds {
If (!$isfile($scriptdirlastseen.txt)) { write $scriptdirlastseen.txt }
hsave lastseen $scriptdirlastseen.txt
hfree lastseen
echo -a 3,1.9:15XCept Lastseen v1.0 - Unloaded9:3.
}
on *:NICK: {
hadd -m lastseen $nick Changing nicknames from $nick to $newnick
}
on *:QUIT: {
hadd -m lastseen $nick Quiting IRC with Quit message: $1- (Date: $date / Time: $time $+ )
}
on *:JOIN:#: {
hadd -m lastseen $nick Joining $chan (Date: $date / Time: $time $+ )
}
on *:PART:#: {
hadd -m lastseen $nick Parting $chan (Date: $date / Time: $time $+ )
}
on *:KICK:#: {
hadd -m lastseen $knick Being kicked from $chan (Date: $date / Time: $time $+ )
hadd -m lastseen $nick Kicking $knick from $chan (Date: $date / Time: $time $+ )
}
on *:OP:*: {
hadd -m lastseen $opnick Being OPed in $chan (Date: $date / Time: $time $+ )
hadd -m lastseen $nick OPing $opnick in $chan (Date: $date / Time: $time $+ )
}
on *:DEOP:*: {
hadd -m lastseen $opnick Being DE-OPed in $chan (Date: $date / Time: $time $+ )
hadd -m lastseen $nick DE-OPing $opnick in $chan (Date: $date / Time: $time $+ )
}
on *:HELP:*: {
hadd -m lastseen $opnick Being HELPed in $chan (Date: $date / Time: $time $+ )
hadd -m lastseen $nick HELPing $opnick in $chan (Date: $date / Time: $time $+ )
}
on *:DEHELP:*: {
hadd -m lastseen $hnick Being DE-HELPed in $chan (Date: $date / Time: $time $+ )
hadd -m lastseen $nick DE-HELPing $hnick in $chan (Date: $date / Time: $time $+ )
}
on *:VOICE:*: {
hadd -m lastseen $vnick Being VOICEd in $chan (Date: $date / Time: $time $+ )
hadd -m lastseen $nick VOICing $vnick in $chan (Date: $date / Time: $time $+ )
}
on *:DEVOICE:*: {
hadd -m lastseen $vnick Being DE-VOICEd in $chan (Date: $date / Time: $time $+ )
hadd -m lastseen $nick DE-VOICing $vnick in $chan (Date: $date / Time: $time $+ )
}
on *:TEXT:.seen*:*: {
If ($seenfld($nick) != $true) {
If (!$2) || ($3) { halt }
If ($2 = $nick) { msg $target 3,1.9:15Looking for yourself, eh, $2 $+ ? $+ 9:3. | halt }
If ($target ischan) && ($2 ison $target) { msg $target 3,1.9:15 $+ $2 is on the channel right now!9:3. | halt }
If (!$hget(lastseen,$2)) { msg $target 3,1.9:15 I have not seen $2 $+ 9:3. | halt }
If ($hget(lastseen,$2)) {
msg $target 3,1.9:15I last saw $2 $hget(lastseen,$2) $+ 9:3.
}
}
If ($seenfld($nick) = $true) { .ignore -u10 $nick | .notice 3,1.9:15Added to ignore list for 10secs for flooding9:3. }
}
on *:INPUT:*: {
If ($1 = .seen) && (!$3) && ($2) && (!$ctrlenter) {
haltdef
If ($2 = $me) { msg $target 3,1.9:15Looking for yourself, eh, $2 $+ ? $+ 9:3. | halt }
If ($target ischan) && ($2 ison $target) { msg $target 3,1.9:15 $+ $2 is on the channel right now!9:3. | halt }
If (!$hget(lastseen,$2)) { msg $target 3,1.9:15 I have not seen $2 $+ 9:3. | halt }
If ($hget(lastseen,$2)) {
msg $target 3,1.9:15I last saw $2 $hget(lastseen,$2) $+ 9:3.
}
}
If ($1 = .seenclear) && ($2) && (!$ctrlenter) {
hfree lastseen
msg $active 3,1.9:15Cleared all .seen records9:3.
}
}
alias seenfld {
If (!$1) { halt }
%seen = $false
If (%seenfld. [ $+ [ $1 ] ]) {
If (%seenfld. [ $+ [ $1 ] ] < 5) { inc %seenfld. [ $+ [ $1 ] ] 1 }
If (%seenfld. [ $+ [ $1 ] ] >= 5) { unset %seenfld. [ $+ [ $1 ] ] | %seen = $true }
}
If (%seenfld. [ $+ [ $1 ] ] = $null) {
set -z %seenfld. [ $+ [ $1 ] ] 2
}
return %seen
unset %seen
}