#include "wildcard.h"
#include "commands/cmd_who.h"
-static const char *get_first_visible_channel(User *u)
+static const std::string star = "*";
+
+static const std::string& get_first_visible_channel(User *u)
{
UCListIter i = u->chans.begin();
if (i != u->chans.end())
return i->first->name;
}
- return "*";
+ return star;
}
bool CommandWho::whomatch(User* user, const char* matchtext)
if (u->Visibility && !u->Visibility->VisibleTo(user))
return;
- std::string lcn = get_first_visible_channel(u);
+ const std::string& lcn = get_first_visible_channel(u);
Channel* chlast = ServerInstance->FindChan(lcn);
std::string wholine = initial + (ch ? ch->name : lcn) + " " + u->ident + " " + (opt_showrealhost ? u->host : u->dhost) + " " +
{
for (std::vector<std::string>::const_iterator n = whoresults.begin(); n != whoresults.end(); n++)
user->WriteServ(*n);
- user->WriteNumeric(315, "%s %s :End of /WHO list.",user->nick, *parameters[0].c_str() ? parameters[0].c_str() : "*");
+ user->WriteNumeric(315, "%s %s :End of /WHO list.",user->nick.c_str(), *parameters[0].c_str() ? parameters[0].c_str() : "*");
return CMD_SUCCESS;
}
else
{
/* BZZT! Too many results. */
- user->WriteNumeric(315, "%s %s :Too many results",user->nick, parameters[0].c_str());
+ user->WriteNumeric(315, "%s %s :Too many results",user->nick.c_str(), parameters[0].c_str());
return CMD_FAILURE;
}
}