Determine If a User Is Idented On IRC
On freenode, sending a private message to nickserv with the message ACC <nickname>
will return a number that indicates the user's ident status:
The answer is in the form
<nickname> ACC <digit>
:0 - account or user does not exist 1 - account exists but user is not logged in 2 - user is not logged in but recognized (see ACCESS) 3 - user is logged in
The STATUS <nickname>
command gives similar results on Rizon:
The response has this format:
<nickname> <digit>
0 - no such user online or nickname not registered 1 - user not recognized as nickname's owner 2 - user recognized as owner via access list only 3 - user recognized as owner via password identification
The advantages that this method has over a WHOIS:
- Information about ident status is always included. With WHOISes, you will just not get a line saying something along the lines of "identified with nickserv as such-and-such" if the user is not, in fact, idented.
- Consistent number of lines returned. Since I want to grab the message before passing on control to the rest of my program, I can easily read one line out of the buffer (I see synchronization issues in your future!), determine the status, and continue on like normal.
On some networks you can enable a feature called 'identify-msg'. On FreeNode you do it by sending "CAP REQ identify-msg" and "CAP END" when you first connect to the server. The server will respond with a reply confirming that feature. Afterwards, all messages (and CTCP ACTIONs) will be preceded with a "+" (user has identified with NickServ) or a "-" (user has not identified with NickServ), e.g.:
:[email protected] PRIVMSG #erasmus-testing :+foo