Beispiel #1
0
void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms, Membership* memb, User* u, std::vector<Numeric::Numeric>& whoresults)
{
    if (!memb)
        memb = get_first_visible_channel(u);

    Numeric::Numeric wholine(RPL_WHOREPLY);
    wholine.push(memb ? memb->chan->name : "*").push(u->ident);
    wholine.push(opt_showrealhost ? u->host : u->dhost);
    if (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex"))
        wholine.push(ServerInstance->Config->HideWhoisServer);
    else
        wholine.push(u->server->GetName());

    wholine.push(u->nick);

    std::string param;
    /* away? */
    if (u->IsAway())
    {
        param.push_back('G');
    }
    else
    {
        param.push_back('H');
    }

    /* oper? */
    if (u->IsOper())
    {
        param.push_back('*');
    }

    if (memb)
    {
        char prefix = memb->GetPrefixChar();
        if (prefix)
            param.push_back(prefix);
    }

    wholine.push(param);
    wholine.push("0 ");
    wholine.GetParams().back().append(u->fullname);

    ModResult res;
    FIRST_MOD_RESULT(OnSendWhoLine, res, (user, parms, u, memb, wholine));
    if (res != MOD_RES_DENY)
        whoresults.push_back(wholine);
}
Beispiel #2
0
void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms, const std::string& initial, Membership* memb, User* u, std::vector<std::string>& whoresults)
{
	if (!memb)
		memb = get_first_visible_channel(u);

	std::string wholine = initial + (memb ? memb->chan->name : "*") + " " + u->ident + " " +
		(opt_showrealhost ? u->host : u->dhost) + " ";
	if (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex"))
		wholine.append(ServerInstance->Config->HideWhoisServer);
	else
		wholine.append(u->server->GetName());

	wholine.append(" " + u->nick + " ");

	/* away? */
	if (u->IsAway())
	{
		wholine.append("G");
	}
	else
	{
		wholine.append("H");
	}

	/* oper? */
	if (u->IsOper())
	{
		wholine.push_back('*');
	}

	if (memb)
	{
		char prefix = memb->GetPrefixChar();
		if (prefix)
			wholine.push_back(prefix);
	}

	wholine.append(" :0 " + u->fullname);

	FOREACH_MOD(OnSendWhoLine, (user, parms, u, memb, wholine));

	if (!wholine.empty())
		whoresults.push_back(wholine);
}