2015-02-22: I think I found some bugs in these rules since the last time. But I don't remember exactly what they were.
Either way, most of the time you're going to see only
The odd ones are generated by PSYC. For example>
Just make sure you can parse this garbage, that's all.
On parsing of the prefix
This is the correct way to parse the
Start search at the beginning of the string. This shall also be the start of the nickname.
Search for a
!character. If found, it shall mark the end of the nickname; the following character shall be the start of the username; and the next search shall continue at this position. If not found, return to the beginning of the string for the next search.
Search for a
@character. If found, it shall mark the end of the username (or nickname if the username was not present); and the following character shall be the start of the hostname field.
nick!user@hostshall be parsed as
foo@bar!bazshall be parsed as
baz(username), and empty hostname.
foo@barshall be parsed as
foo(nickname), empty username, and
nick@kcin!user!resu@host!tsoh@hostshall be parsed as
host!tsoh@host(hostname). The parser shall also sigh deeply.
xmpp:email@example.comfirstname.lastname@example.org be parsed as
psyc://email@example.com be parsed as
Some servers send unusual nicknames containing an
@ character, despite it
being disallowed by all existing IRC standards.
Almost all existing clients accept prefixes containing such nicknames, by first
searching for a
!, then resuming at that position to search for the
However, some clients just split the prefix into tokens at any occurence of
@ (or regex
/[@!]/), then use the first three tokens as nickname,
username, and hostname respectively, resulting in different values.
To deal with such weird servers, and generally to make parsing of the prefix consistent, the former behavior is declared correct.