summaryrefslogtreecommitdiff
path: root/src/coremods/core_whois.cpp
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-04-28 15:02:41 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-04-28 15:02:41 +0200
commit04eb0e182dec8518d1dfd15a09b8054d1501a4ef (patch)
treea09b319fffd5dd01a8ba88cddc8c8e3629472b3a /src/coremods/core_whois.cpp
parent39cafd84080182a381319927ed07f5db1ac8d928 (diff)
Prepend target user nick to whois numerics in InspIRCd::SendWhoisLine()
Diffstat (limited to 'src/coremods/core_whois.cpp')
-rw-r--r--src/coremods/core_whois.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/coremods/core_whois.cpp b/src/coremods/core_whois.cpp
index 7464e0527..e8d162d70 100644
--- a/src/coremods/core_whois.cpp
+++ b/src/coremods/core_whois.cpp
@@ -84,9 +84,9 @@ void CommandWhois::SplitChanList(User* source, User* dest, const std::string& cl
std::ostringstream prefix;
std::string::size_type start, pos;
- prefix << dest->nick << " :";
+ prefix << ":";
line = prefix.str();
- int namelen = ServerInstance->Config->ServerName.length() + 6;
+ const std::string::size_type namelen = ServerInstance->Config->ServerName.length() + 6 + dest->nick.length() + 1;
for (start = 0; (pos = cl.find(' ', start)) != std::string::npos; start = pos+1)
{
@@ -107,10 +107,10 @@ void CommandWhois::SplitChanList(User* source, User* dest, const std::string& cl
void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigned long idle)
{
- ServerInstance->SendWhoisLine(user, dest, 311, "%s %s %s * :%s", dest->nick.c_str(), dest->ident.c_str(), dest->dhost.c_str(), dest->fullname.c_str());
+ ServerInstance->SendWhoisLine(user, dest, 311, "%s %s * :%s", dest->ident.c_str(), dest->dhost.c_str(), dest->fullname.c_str());
if (user == dest || user->HasPrivPermission("users/auspex"))
{
- ServerInstance->SendWhoisLine(user, dest, 378, "%s :is connecting from %s@%s %s", dest->nick.c_str(), dest->ident.c_str(), dest->host.c_str(), dest->GetIPString().c_str());
+ ServerInstance->SendWhoisLine(user, dest, 378, ":is connecting from %s@%s %s", dest->ident.c_str(), dest->host.c_str(), dest->GetIPString().c_str());
}
std::string cl = ChannelList(user, dest, false);
@@ -126,41 +126,41 @@ void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigne
std::string scl = ChannelList(user, dest, true);
if (scl.length())
{
- ServerInstance->SendWhoisLine(user, dest, 336, "%s :is on private/secret channels:", dest->nick.c_str());
+ ServerInstance->SendWhoisLine(user, dest, 336, ":is on private/secret channels:");
SplitChanList(user, dest, scl);
}
}
if (user != dest && !ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex"))
{
- ServerInstance->SendWhoisLine(user, dest, 312, "%s %s :%s", dest->nick.c_str(), ServerInstance->Config->HideWhoisServer.c_str(), ServerInstance->Config->Network.c_str());
+ ServerInstance->SendWhoisLine(user, dest, 312, "%s :%s", ServerInstance->Config->HideWhoisServer.c_str(), ServerInstance->Config->Network.c_str());
}
else
{
- ServerInstance->SendWhoisLine(user, dest, 312, "%s %s :%s", dest->nick.c_str(), dest->server->GetName().c_str(), dest->server->GetDesc().c_str());
+ ServerInstance->SendWhoisLine(user, dest, 312, "%s :%s", dest->server->GetName().c_str(), dest->server->GetDesc().c_str());
}
if (dest->IsAway())
{
- ServerInstance->SendWhoisLine(user, dest, 301, "%s :%s", dest->nick.c_str(), dest->awaymsg.c_str());
+ ServerInstance->SendWhoisLine(user, dest, 301, ":%s", dest->awaymsg.c_str());
}
if (dest->IsOper())
{
if (ServerInstance->Config->GenericOper)
- ServerInstance->SendWhoisLine(user, dest, 313, "%s :is an IRC operator", dest->nick.c_str());
+ ServerInstance->SendWhoisLine(user, dest, 313, ":is an IRC operator");
else
- ServerInstance->SendWhoisLine(user, dest, 313, "%s :is %s %s on %s", dest->nick.c_str(), (strchr("AEIOUaeiou",dest->oper->name[0]) ? "an" : "a"),dest->oper->name.c_str(), ServerInstance->Config->Network.c_str());
+ ServerInstance->SendWhoisLine(user, dest, 313, ":is %s %s on %s", (strchr("AEIOUaeiou",dest->oper->name[0]) ? "an" : "a"),dest->oper->name.c_str(), ServerInstance->Config->Network.c_str());
}
if (user == dest || user->HasPrivPermission("users/auspex"))
{
if (dest->IsModeSet(snomaskmode))
{
- ServerInstance->SendWhoisLine(user, dest, 379, "%s :is using modes +%s %s", dest->nick.c_str(), dest->FormatModes(), snomaskmode->GetUserParameter(dest).c_str());
+ ServerInstance->SendWhoisLine(user, dest, 379, ":is using modes +%s %s", dest->FormatModes(), snomaskmode->GetUserParameter(dest).c_str());
}
else
{
- ServerInstance->SendWhoisLine(user, dest, 379, "%s :is using modes +%s", dest->nick.c_str(), dest->FormatModes());
+ ServerInstance->SendWhoisLine(user, dest, 379, ":is using modes +%s", dest->FormatModes());
}
}
@@ -172,10 +172,10 @@ void CommandWhois::DoWhois(User* user, User* dest, unsigned long signon, unsigne
*/
if ((idle) || (signon))
{
- ServerInstance->SendWhoisLine(user, dest, 317, "%s %lu %lu :seconds idle, signon time", dest->nick.c_str(), idle, signon);
+ ServerInstance->SendWhoisLine(user, dest, 317, "%lu %lu :seconds idle, signon time", idle, signon);
}
- ServerInstance->SendWhoisLine(user, dest, 318, "%s :End of /WHOIS list.", dest->nick.c_str());
+ ServerInstance->SendWhoisLine(user, dest, 318, ":End of /WHOIS list.");
}
CmdResult CommandWhois::HandleRemote(const std::vector<std::string>& parameters, RemoteUser* target)