; example of output ; L Version 1.00 ; L account ; account : L level ; global access level ; L chan ; known on with ; L channels ; known on channels ; L end ; when not logged in: ; L account 0 ; L end ; Q Version: 3.104 ; Q chan ; known on with ; Q channels ; known on channels ; Q level ; global access level ; Q umodes <+umodes> ; current usermodes ; Q userid ; account id ; Q account ; account ; Q email ; email ; Q end ; marks end of list ; when not logged in: ; Q level 0 ; Q umodes <+umodes> ; Q end ; whoamiexec ; by wiebe @ quakenet ; Fri Mar 26 2004 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS WHOAMIEXEC ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; /whoamiexec [params] alias whoamiexec { if ($status == connected) && ($2) { tokenize 32 $gettok($1,1,44) $2- hadd -mu120 $+(whoamiexec,$cid) alias $1 $whoamiexec.lower($1) $2- hadd -u120 $+(whoamiexec,$cid) place 0 hadd -u120 $+(whoamiexec,$cid) channels 0 .quote PRIVMSG $1 :whoami } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; NOTICE EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on ^*:notice:*:?:{ whoamiexec.check $1- } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; TEXT EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on ^*:text:*:?:{ whoamiexec.check $1- } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; OPEN EVENT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; on ^*:open:?:*:{ whoamiexec.check $1- } alias -l whoamiexec.check { if ($gettok($hget( $+(whoamiexec,$cid),alias),1,32) == $whoamiexec.lower($nick)) { ; L part ; -L- You are authed as ; -L- Global auth level: ; -L- Known on the following channels: ; -L- channel access flags ; -L- --------------------------------------- ; -L- #channel amnovg ; -L- End of list. ; -L- is not known on any channels. ; -L- You are not authed. Please auth with Q before sending me commands. if (You?are?authed?as?& iswm $1-5) && ($hget($+(whoamiexec,$cid),place) == 0) { hadd $+(whoamiexec,$cid) account $5 hinc $+(whoamiexec,$cid) place var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) account $5 haltdef } elseif (You?are?not?authed.*Please?auth?with?*?before?sending?me?commands.* iswm $1-) && ($hget($+(whoamiexec,$cid),place) == 0) { var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) account 0 $gettok(%t,3-,32) $gettok(%t,1,32) level 0 $gettok(%t,3-,32) $gettok(%t,1,32) end haltdef } elseif (Global?auth?level:?& iswm $1-4) && ($hget($+(whoamiexec,$cid),place) == 1) { hinc $+(whoamiexec,$cid) place var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) level $4 haltdef } elseif ($1- == $hget($+(whoamiexec,$cid),account) is not known on any channels.) && ($hget($+(whoamiexec,$cid),place) == 2) { hinc $+(whoamiexec,$cid) place var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) channels 0 $gettok(%t,3-,32) $gettok(%t,1,32) end hfree $+(whoamiexec,$cid) haltdef } elseif ($1-5 == Known on the following channels:) && ($hget($+(whoamiexec,$cid),place) == 2) { hinc $+(whoamiexec,$cid) place haltdef } elseif ($1- == channel access flags) && ($hget($+(whoamiexec,$cid),place) == 3) { hinc $+(whoamiexec,$cid) place haltdef } elseif ($1- == ---------------------------------------) && ($hget($+(whoamiexec,$cid),place) == 4) { hinc $+(whoamiexec,$cid) place haltdef } elseif ($left($1,1) == $chr(35)) && ($0 == 2) && ($remove($2,a,m,n,o,v,g) == $null) && ($len($2) < 7) && ($hget($+(whoamiexec,$cid),place) == 5) { hinc $+(whoamiexec,$cid) channels var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) chan $1 $2 haltdef } elseif ($1- == End of list.) && ($hget($+(whoamiexec,$cid),place) == 5) { hinc $+(whoamiexec,$cid) place var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) channels $hget($+(whoamiexec,$cid),channels) $gettok(%t,3-,32) $gettok(%t,1,32) end hfree $+(whoamiexec,$cid) haltdef } ; Q part ; -Q- Access level +abmnotv on channel #. ; part about channels is left out if user is not known on any channels ; -Q- Global auth level: ; -Q- Current modes: + ; -Q- You have authed as userid: nick: ; -Q- E-mail: ; -Q- You are on . ; -Q- Global auth level: 0 ; -Q- Current modes: +iwx ; -Q- You have NOT authed elseif ( Access?level?+*?on?channel?#*. iswm $1-6 ) && ( $hget($+(whoamiexec,$cid),place) == 0) { hinc $+(whoamiexec,$cid) channels var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) chan $left($6,-1) $right($3,-1) haltdef } elseif (Global?auth?level:?& iswm $1-) && ($hget($+(whoamiexec,$cid),place) == 0) { hinc $+(whoamiexec,$cid) place var %t = $hget($+(whoamiexec,$cid),alias) if ($4 != 0) { $gettok(%t,3-,32) $gettok(%t,1,32) channels $hget($+(whoamiexec,$cid),channels) } $gettok(%t,3-,32) $gettok(%t,1,32) level $4 haltdef } elseif (Current modes:?+* iswm $1-3) && ($hget($+(whoamiexec,$cid),place) == 1) { hinc $+(whoamiexec,$cid) place var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) umodes $3 haltdef } elseif (You have NOT authed == $1-) && ($hget($+(whoamiexec,$cid),place) == 2) { var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) account 0 $gettok(%t,3-,32) $gettok(%t,1,32) end hfree $+(whoamiexec,$cid) haltdef } elseif (You?have?authed?as?userid:?*?nick:?* iswm $1-8) && ($hget($+(whoamiexec,$cid),place) == 2) { hinc $+(whoamiexec,$cid) place var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) userid $6 $gettok(%t,3-,32) $gettok(%t,1,32) account $8 haltdef } elseif (E-mail:?& iswm $1-) && ($hget($+(whoamiexec,$cid),place) == 3) { hinc $+(whoamiexec,$cid) place var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) email $2 if ($comchan($me,0) == 0) { $gettok(%t,3-,32) $gettok(%t,1,32) end } haltdef } elseif (You?are?on?*. iswm $1-4) && ($me ison $left($4,-1)) && ($hget($+(whoamiexec,$cid),place) == 4) { hinc $+(whoamiexec,$cid) chan if ($hget($+(whoamiexec,$cid),chan) == $comchan($me,0)) { var %t = $hget($+(whoamiexec,$cid),alias) $gettok(%t,3-,32) $gettok(%t,1,32) end hfree $+(whoamiexec,$cid) } haltdef } } } ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ALIAS WHOAMIEXEC.LOWER ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; $whoamiexec.lower(nick) alias -l whoamiexec.lower { ; on IRC these chars are upper(lower) case of eachother: { = [, } = ], | = \, ~ = ^ ; so here we replace them to make sure we compare the right things right return $replace($1,$chr(123),$chr(91),$chr(125),$chr(93),$chr(124),$chr(92),$chr(126),$chr(94)) }