Code: Select all
# 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
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 $workingchan :[lindex [split $text] 1] has been idle [duration [lindex [split $text] 2]] \[signon [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 "
Actually it would. Note the putserv "whois [split $text 0] [split $text 0]", basicaly being whois nickname nickname - which is how you get the whois idle time request off a network. It works by forwarding the request to the right server and returning a response.Anahel wrote:hmm, it wouldn't work properly in network with more than 1 server, as in most cases "whois" will display sigon/idle time only for people who are on server you both are
Gewan wrote:However, when I drop '!idle nickONchannel', then I will not get anything in return. When I look in the Eggdrop console, I see the following:
[15:18] Tcl error [watch:402]: unmatched open brace in list
Any ideas?
Anything would be of interest.
I'm really thankful!
Code: Select all
putserv "privmsg $workingchan :"[string trimleft [lindex $text 2] :] [lrange [split $text] 3 end]""
Code: Select all
putserv "privmsg $workingchan :"[string trimleft [lindex [split $text] 2] :] [join [lrange [split $text] 3 end]]""
You're welcome.Gewan wrote:First off, thank you _a lot_ willyw, much(!) appreciated.
Good.I have now tested the script. Something's a bit weird though.
When I pull '!idle nicknotonchannel' it returns the perfect string set:
<@Eggdrop> Rapidboy has been idle 2 hours 13 minutes 22 seconds [signon Sun Dec 26 12:17:20 2010]
Also, when I pull '!idle offlinenick' I get:
<@Eggdrop> "No such server"
Will probably define it to something like "<nick> is not online", but function (the important) is flawless. Neat.
This is interesting.However, when I drop '!idle nickONchannel', then I will not get anything in return. When I look in the Eggdrop console, I see the following:
[15:18] Tcl error [watch:402]: unmatched open brace in list
Any ideas?
And thank you for reporting back.Anything would be of interest.
I'm really thankful!
hehehespeechles wrote:Code: Select all
putserv "privmsg $workingchan :"[string trimleft [lindex $text 2] :] [lrange [split $text] 3 end]""
yeah, i didn't notice it, but still "whois nick nick" doesn't work on few networksTrixar_za wrote:Actually it would. Note the putserv "whois [split $text 0] [split $text 0]", basicaly being whois nickname nickname - which is how you get the whois idle time request off a network. It works by forwarding the request to the right server and returning a response.Anahel wrote:hmm, it wouldn't work properly in network with more than 1 server, as in most cases "whois" will display sigon/idle time only for people who are on server you both are
Reference: http://www.irchelp.org/irchelp/misc/cco ... Heading373
I showed you where this was. It is in how you catch the raw reply.willyw wrote:This is interesting.
Procedure watch:402 is called when a Raw 402 is returned.
That's what happens when you have it look for a nick that is not online.
And, you've reported that it works fine for that.
Yet, somehow, at another time when watch:402 was called, it errored?
There's something that I'm not understanding.....
Code: Select all
putserv "privmsg $workingchan :"[string trimleft [lindex $text 2] :] [lrange [split $text] 3 end]""
Great!Gewan wrote: ...
I'm an irssi user, and -- per default -- irssi's auto-completion adds a blank space after nicknames, so I ended up with string '!idle LameIRCer ' instead of '!idle LameIRCer'; notice the lack of blank space in the last example. This was -- of course -- causing the "Not found" return.
Actually, this is 'fine tuning'. To fix it, that is.Now, after executing !idle strings without the ending blank space, script works _flawlessly_. Would it be much pain (an additional 50 lines of code or so*) to add so that script will except/omit any blank space, since no IRCd (that I know of) supports multi-word nicknames, such feature couldn't cause any harm.
However, it's "surplus"
Ready to try something?and really not essential. When triggering the script as it's ment to be '!idle <nick>' it works flawlessly, and it's really not that much pain for the irssi end-user to hit backspace once after auto-completion has kicked in, hehe.
Code: Select all
putserv "whois [split $text 0] [split $text 0]"
Code: Select all
putserv "whois [join [string trimright [split $text 0]]] [join [string trimright [split $text 0]]]"
Code: Select all
"!idle jack[3]"
Code: Select all
"!idle jack[3] "
Code: Select all
"!idle jack[3] "
10 hours? ... whew...Again. Thanks _a lot_ for this brilliant script. IMHO, you guys should post it on the official eggdrop script page. Me and my friends had the idea that this would be a neat feature for our channel, but after Googling for ~10h all I found was several idle scripts, but all those only kept internal track on users on particular channels etc, i.e. not what I was looking for. This one is minimalistic yet pure and brilliant. Will be used on a daily basis in our little group of fellows. You did great!
Cheers!