idOf

Returns either the nickname or the account of a user, depending on whether the account is known. Overload that looks up the passed nickname in the passed plugin's users associative array of IRCUsers.

Merely wraps getUser with idOf.

  1. auto idOf(IRCUser user)
  2. auto idOf(IRCPlugin plugin, string nickname)
    idOf
    (,
    const string nickname
    )

Parameters

plugin IRCPlugin

The current IRCPlugin, whatever it is.

nickname string

The name of a user to look up.

Return Value

Type: auto

The nickname or account of the passed user, or the passed nickname if nothing was found.

Examples

final class MyPlugin : IRCPlugin
{
    mixin IRCPluginImpl;
}

IRCPluginState state;
IRCPlugin plugin = new MyPlugin(state);

IRCUser newUser;
newUser.nickname = "nickname";
plugin.state.users["nickname"] = newUser;

immutable nickname = idOf(plugin, "nickname");
assert((nickname == "nickname"), nickname);

plugin.state.users["nickname"].account = "account";
immutable account = idOf(plugin, "nickname");
assert((account == "account"), account);

See Also