#
# raw 352 risposta al WHO "vanilla"
#
# raw 354 risposta al WHOX che è la versione "extended"
#
#
#
# nel RFC 1459 ( https://www.rfc-editor.org/rfc/rfc1459.txt )
# 402 ERR_NOSUCHSERVER
# 352 RPL_WHOREPLY
# 315 RPL_ENDOFWHO
#
bind pub - !testraw ldm:who
proc ldm:who {nick host hand chan arg} {
set nickname [stripcodes * $arg]
set nickname [string trim $nickname]
set arguments [llength $nickname]
if { $arguments > 1 } {
puthelp "PRIVMSG $chan :specificare un utente alla volta"
return
} elseif { $arguments == 0 } {
puthelp "PRIVMSG $chan :specificare il nickname"
return
}
if { ![onchan $nickname $chan] } {
puthelp "PRIVMSG $chan :nickname non trovato"
return
}
putserv "WHO $nickname"
# bind raw - "315" ldm:whoraw
bind raw - "352" ldm:whoraw
# bind raw - "354" ldm:whoraw
# bind raw - "402" ldm:whoraw
return
}
proc ldm:whoraw {from key text} {
puthelp "PRIVMSG #prova :$text"
return
}
is this script secure? are there potential problems with other scripts?
the question is: when I use it, does "ldm:whoraw" capture ONLY the /who command inside this script or is there the possibility that catch /who command from others scripts too?
The ldm:whoraw will catch any who response sent to the eggdrop.
You can simply test that: in party-line, do a .tcl putserv "WHO $botnick" and your proc will work.
A bind catch a specific server event, it's totally independant of who/what asked the server to react.
But your script is secure as it just displays server's who replies to a particular channel. If it's just a test script, you'd better use a putlog and check in party-line, to avoid flood on your server.
geek wrote:
...
the question is: when I use it, does "ldm:whoraw" capture ONLY the /who command inside this script or is there the possibility that catch /who command from others scripts too?
...
If this is a concern, here's an idea to consider. It is what I usually do.
proc ldm:who {nick host hand chan arg} {
bind raw - "352" ldm:whoraw
utimer 5 [list unbind raw - "352" ldm:whoraw]
< continue with the rest of the procedure's code here >
}
The idea is to create the bind that you will need.
Then, a few seconds later, unbind it.
Of course, you should adjust the value of the utimer to whatever you think is best.
I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
set ::ident [lindex $text 2]
...
puthelp "PRIVMSG #test :$::ident"
Take care about 2 things:
1. ident is too generic, better to use something like ldmident
2. your variable is set with the answer of the /who command, but the /who is initiated by your ldm:who proc. So you can't already have this value.
CrazyCat wrote:
1. ident is too generic, better to use something like ldmident
yes :)
CrazyCat wrote:2. your variable is set with the answer of the /who command, but the /who is initiated by your ldm:who proc. So you can't already have this value.
perhaps now I have understand
I try example2 and I get "no such variable" error again
You mean that "it takes some time" for ::ldmident to be available and use it
right?