Just in case anyone tries this on QuakeNet (also raw 330), you should check the response of the server BEFORE assigning vars or returning output.
Some of the quakenet servers respond with
<nick> <authname> is authed as, while others use
<nick> is authed as <authname>.
I fell into a deep hole once at this point, so keep an eye on it
--
hatch