#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) + " " +
if (ServerInstance->FindServerName(matchtext))
usingwildcards = true;
- if (!parameters.empty())
+ if (parameters.size() > 1)
{
- /* parse flags */
- const char *iter = parameters[1].c_str();
-
/* Fix for bug #444, WHO flags count as a wildcard */
usingwildcards = true;
- while (*iter)
+ for (std::string::const_iterator iter = parameters[1].begin(); iter != parameters[1].end(); ++iter)
{
switch (*iter)
{
opt_far = true;
break;
}
-
- *iter++;
}
}
{
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;
}
}