Reference to the current IRCParser.
Reference to the IRCEvent to start working on.
Reference to the *slice* of the raw IRC string.
import lu.conv : Enum; IRCParser parser; IRCEvent e1; with (e1) with (e1.sender) { raw = ":zorael!~NaN@some.address.org PRIVMSG kameloso :this is fake"; string slice1 = raw[1..$]; // mutable parser.parsePrefix(e1, slice1); assert((nickname == "zorael"), nickname); assert((ident == "~NaN"), ident); assert((address == "some.address.org"), address); } IRCEvent e2; with (e2) with (e2.sender) { raw = ":NickServ!NickServ@services. NOTICE kameloso :This nickname is registered."; string slice2 = raw[1..$]; // mutable parser.parsePrefix(e2, slice2); assert((nickname == "NickServ"), nickname); assert((ident == "NickServ"), ident); assert((address == "services."), address); } IRCEvent e3; with (e3) with (e3.sender) { raw = ":kameloso^^!~NaN@C2802314.E23AD7D8.E9841504.IP JOIN :#flerrp"; string slice3 = raw[1..$]; // mutable parser.parsePrefix(e3, slice3); assert((nickname == "kameloso^^"), nickname); assert((ident == "~NaN"), ident); assert((address == "C2802314.E23AD7D8.E9841504.IP"), address); } IRCEvent e4; with (parser) with (e4) with (e4.sender) { raw = ":Q!TheQBot@CServe.quakenet.org NOTICE kameloso :You are now logged in as kameloso."; string slice4 = raw[1..$]; // mutable parser.parsePrefix(e4, slice4); assert((nickname == "Q"), nickname); assert((ident == "TheQBot"), ident); assert((address == "CServe.quakenet.org"), address); }
Takes a slice of a raw IRC string and starts parsing it into an IRCEvent struct.
This function only focuses on the prefix; the sender, be it nickname and ident or server address.
The IRCEvent is not finished at the end of this function.