/*_____________________________________________________________________________ |/ / AuthExec add-on by David "Saturn" van Moolenbroek | Version 0.2, released 29-09-2003 -- support on #help.script/Quakenet | Use/modify however you want, but please keep my name in it. Thank you! | | Keywords: auth, quakenet, who [id:2], hashtables, repeat-safe, callback | | This add-on allows you to look up the Quakenet auth name of a nickname, | and execute a user-defined command to process the results of this query; | regardless of whether the given nickname shares a channel with you or not. | The script uses an internal queue to keep track of the auth requests, but | it will immediately issue the /who to get the auth info, when /authexec | is called. The only exception to this is that the host of the given | nickname (from the IAL) ends on ".users.quakenet.org", in which case the | auth info is fetched from that hostname. | | The script defines the following commands/identifiers: | | /authexec [params] | | This command will start an auth look-up on the given nickname, and | call a specific command when it's done. This callback command will be | called like this: | | / [params] | | Where is the nickname that was to be checked for, is the | found authname or "0" if the user wasn't online or authed, and both | and [params] are copied from the initial /authexec call. | | Simple example | | ; this code allows anyone to look up someone's auth using !auth | on *:TEXT:!auth &:#:authexec $$2 auth_tell $chan | alias -l auth_tell msg $3 [Auth] $1 is $iif($2,authed as $2,not authed) \ _\_____________________________________________________________________________ */ alias -l max return 64 alias authexec { if (($0 < 2) || ($left($1,1) isin $chantypes)) return if (*.users.quakenet.org iswm $ial($1).host) { $2 $1 $left($ial($1).host,-19) $3- return } if (!$hget(authexec)) { hmake authexec 5 hadd authexec start 1 hadd authexec end 1 } hadd -m authexec $hget(authexec,end) $1- hadd authexec end $iif($hget(authexec,end) < $max,$calc($ifmatch + 1),0) who $1 $+ ,2, % $+ tna,2 } alias -l authcheck { var %n = $1, %a = $2 tokenize 32 $hget(authexec,$hget(authexec,start)) if (%n == $1) { hdel authexec $hget(authexec,start) hadd authexec start $iif($hget(authexec,start) < $max,$calc($ifmatch + 1),0) $2 $1 %a $3- return $true } } on *:CONNECT:if ($hget(authexec)) hfree authexec raw 354:& 2 *:if ($authcheck($3,$4)) { set -u60 %auth.done $true | halt } raw 315:*,2, *:{ if (%auth.done) unset %auth.done else authcheck $left($2,-3) 0 halt }