And now what about a script that voices only people that are authed on Quakenet with a certain account ?
The bot should voice anyone that is authed (Q account) with one of the account-name listed on a text file or something...
@xU:
What good would using a foreach-loop on a filehandle do?
Were'nt you thinking of actually reading the content of the file?
Also, you forget to close it afterwards, leaving uneccesary filehandles open...
Furthermore, your braces {} are unbalanced, and using lsearch on a plain string is not advisable (actually, in some rare conditions it's really bad).
edit:
Might aswell include a piece of code that is working:
Assumes one hostmask per line within the voice.txt file
thx xU, but as far as i can see your script is based on hosts, right ? I'd like a script that voices based on the "Authed as Account-Name" (which appears on the /whois of Quakenet).
Well, I dont think i really understand the question, but:
When you type /whois nick on quakenet you get something like this if the guy is authed :
nick is xxxx@xxxx.users.quakenet.org * Real Name
nick on +#channel #channel2 @#channel3
nick using port80b.se.quakenet.org Located at Port80, Sweden nick is authed as xxxx
nick End of /WHOIS list.
When you do a /whois on someone that is not authed, this is what you get :
nick is ~xxxxx@xxx-xx-xxx-x-xxx.xxx.host.net * Real Name
nick on #channel
nick using *.quakenet.org QuakeNet IRC Server
nick End of /WHOIS list.
I'll try to explain my query alittle better then;
Each response-line from a whois-query (such as the examples you posted) is preceeded with a numeric responsecode (three digits). These are used to allow the client to know what kind of information the server is sending.
Taking the second example you posted, what is actually sent from the server is this:
311 nick ~xxxxx@xxx-xx-xxx-x-xxx.xxx.host.net * :Real Name
319 nick :#channel
312 nick *.quakenet.org :QuakeNet IRC Server
318 nick :End of /WHOIS list.
What we need is the number for the "nick is authed as xxxx" line. Unfortunately, this is not a "rfc 1459" message, but a QuakeNet feature (yes, some other networks use it aswell, I know...)
Also worth noting, implementing this would require your bot to send a whois-query whenever someone joins the channel. On highly trafficed channels this might cause some performace degradations.. just so you know.
Interresting, I suppose this could be extended to create a database of auth'd nicks (and their accuntname) by extending the WHO-query to the speciffic channel when the bot joins.
Should also be trivial to modify the raw 354 "handler" to update a list of nick/auths-pairs to cache this information in order to further reduce traffic.
Might almost be worth writing a module..
Edit:
Just found this page that provided some nice information: http://www.mircscripts.org/showdoc.php? ... al&id=2412
Might be a good idea to tag the query in case any other scripts would use these extended /WHO-queries.