stripModesign

Takes a nickname and strips it of any prepended mode signs, like the @ in @nickname. Saves the stripped signs in the ref string modesigns.

  1. auto stripModesign(string nickname, IRCServer server, string modesigns)
    pure @safe nothrow @nogc
    stripModesign
    (
    const string nickname
    ,,
    out string modesigns
    )
  2. auto stripModesign(string nickname, IRCServer server)

Parameters

nickname string

String with a signed nickname.

server IRCServer

IRCServer, with all its settings.

modesigns string

Reference string to write the stripped modesigns to.

Return Value

Type: auto

The nickname without any prepended prefix signs.

Examples

IRCServer server;
immutable signed = "@+kameloso";
string signs;
immutable nickname = server.stripModeSign(signed, signs);
assert((nickname == "kameloso"), nickname);
assert((signs == "@+"), signs);
IRCServer server;
server.prefixchars =
[
    '@' : 'o',
    '+' : 'v',
    '%' : 'h',
];

{
    immutable signed = "@kameloso";
    string signs;
    immutable nickname = signed.stripModesign(server, signs);
    assert((nickname == "kameloso"), nickname);
    assert((signs == "@"), signs);
}

{
    immutable signed = "kameloso";
    string signs;
    immutable nickname = signed.stripModesign(server, signs);
    assert((nickname == "kameloso"), nickname);
    assert(!signs.length, signs);
}

{
    immutable signed = "@+kameloso";
    string signs;
    immutable nickname = signed.stripModesign(server, signs);
    assert((nickname == "kameloso"), nickname);
    assert((signs == "@+"), signs);
}