# Dec. 25, 2010
# forum request
#
#
http://forum.egghelp.org/viewtopic.php?t=18208
#
# I'm simply looking for eggdrop to grep the idle time that is reported by '/whois <nick <nick>'
# (twice, if users are on different servers on network). I.e. how long the user has been idle on the server as such.
#
# In my desired script, I would be to type in a channel:
# <Gewan> !idle Ajnag
#
# This would then give something say like:
# <Eggdrop> Ajnag has been idle for 0 days 0 hours 41 mins 32 secs [signon: Sat Dec 25 04:52:53 2010]
#
#
bind pub - "idle" do:whois
setudef flag idle
proc do:whois {nick uhost handle chan text} {
global workingchan
if {"$text" == ""} {
putserv "privmsg $chan :Syntax: idle <nick> "
return
}
bind raw - 317 watch:317
bind raw - 402 watch:402
putserv "whois [split $text 0] [split $text 0]"
set workingchan $chan
}
proc watch:317 {from keyword text} {
global workingchan
putserv "privmsg #gadis :\[4Idle Checking\] 50Nickname 12- 55[lindex [split $text] 1]"
putserv "privmsg #gadis :\[4Idle Checking\] 50Idle 12- 56[duration [lindex [split $text] 2]] \[60signon [ctime [lindex [split $text] 3]]\]"
unbind raw - 317 watch:317
unbind raw - 402 watch:402
}
proc watch:402 {from keyword text} {
global workingchan
putserv "privmsg $workingchan :\"[string trimleft [lindex $text 2] :] [lrange [split $text] 3 end]\""
unbind raw - 317 watch:317
unbind raw - 402 watch:402
}
putlog "Loaded Idle Time determined from WHOIS ...

see:
http://forum.egghelp.org/viewtopic.php?t=18208 "