onMode

Handle MODE changes.

private pure @safe
void
onMode
(,,
ref string slice
)

Parameters

parser IRCParser

Reference to the current IRCParser.

event IRCEvent

Reference to the IRCEvent to continue working on.

slice string

Reference to the slice of the raw IRC string.

Examples

IRCParser parser;
parser.client.nickname = "kameloso^";
parser.client.modes = "x";

{
    IRCEvent event;
    string slice = /*":kameloso^ MODE */"kameloso^ :+i";
    parser.onMode(event, slice);
    assert((parser.client.modes == "ix"), parser.client.modes);
}
{
    IRCEvent event;
    string slice = /*":kameloso^ MODE */"kameloso^ :-i";
    parser.onMode(event, slice);
    assert((parser.client.modes == "x"), parser.client.modes);
}
{
    IRCEvent event;
    string slice = /*":kameloso^ MODE */"kameloso^ :+abc";
    parser.onMode(event, slice);
    assert((parser.client.modes == "abcx"), parser.client.modes);
}
{
    IRCEvent event;
    string slice = /*":kameloso^ MODE */"kameloso^ :-bx";
    parser.onMode(event, slice);
    assert((parser.client.modes == "ac"), parser.client.modes);
}