diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-04-28 15:02:41 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-04-28 15:02:41 +0200 |
commit | 04eb0e182dec8518d1dfd15a09b8054d1501a4ef (patch) | |
tree | a09b319fffd5dd01a8ba88cddc8c8e3629472b3a | |
parent | 39cafd84080182a381319927ed07f5db1ac8d928 (diff) |
Prepend target user nick to whois numerics in InspIRCd::SendWhoisLine()
-rw-r--r-- | src/coremods/core_whois.cpp | 28 | ||||
-rw-r--r-- | src/helperfuncs.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_botmode.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_customtitle.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_helpop.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_services_account.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_servprotect.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_sslinfo.cpp | 5 | ||||
-rw-r--r-- | src/modules/m_swhois.cpp | 2 |
9 files changed, 26 insertions, 25 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) diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 7b2a29f77..de62a2c7b 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -315,7 +315,9 @@ void InspIRCd::CheckRoot() void InspIRCd::SendWhoisLine(User* user, User* dest, int numeric, const std::string &text) { - std::string copy_text = text; + std::string copy_text = dest->nick; + copy_text.push_back(' '); + copy_text.append(text); ModResult MOD_RESULT; FIRST_MOD_RESULT(OnWhoisLine, MOD_RESULT, (user, dest, numeric, copy_text)); diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 67f692b86..56c94c7c7 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -47,7 +47,7 @@ class ModuleBotMode : public Module { if (dst->IsModeSet(bm)) { - ServerInstance->SendWhoisLine(src, dst, 335, dst->nick+" :is a bot on "+ServerInstance->Config->Network); + ServerInstance->SendWhoisLine(src, dst, 335, ":is a bot on "+ServerInstance->Config->Network); } } }; diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 67eca6dda..6f9380506 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -89,7 +89,7 @@ class ModuleCustomTitle : public Module const std::string* ctitle = cmd.ctitle.get(dest); if (ctitle) { - ServerInstance->SendWhoisLine(user, dest, 320, "%s :%s", dest->nick.c_str(), ctitle->c_str()); + ServerInstance->SendWhoisLine(user, dest, 320, ":%s", ctitle->c_str()); } } /* Don't block anything */ diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index 2fe958a71..4c0af15af 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -143,7 +143,7 @@ class ModuleHelpop : public Module { if (dst->IsModeSet(ho)) { - ServerInstance->SendWhoisLine(src, dst, 310, dst->nick+" :is available for help."); + ServerInstance->SendWhoisLine(src, dst, 310, ":is available for help."); } } diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 26a53b4d7..1af06846e 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -162,13 +162,13 @@ class ModuleServicesAccount : public Module if (account) { - ServerInstance->SendWhoisLine(source, dest, 330, "%s %s :is logged in as", dest->nick.c_str(), account->c_str()); + ServerInstance->SendWhoisLine(source, dest, 330, "%s :is logged in as", account->c_str()); } if (dest->IsModeSet(m5)) { /* user is registered */ - ServerInstance->SendWhoisLine(source, dest, 307, "%s :is a registered nick", dest->nick.c_str()); + ServerInstance->SendWhoisLine(source, dest, 307, ":is a registered nick"); } } diff --git a/src/modules/m_servprotect.cpp b/src/modules/m_servprotect.cpp index 340706142..edad324d1 100644 --- a/src/modules/m_servprotect.cpp +++ b/src/modules/m_servprotect.cpp @@ -60,7 +60,7 @@ class ModuleServProtectMode : public Module { if (dest->IsModeSet(bm)) { - ServerInstance->SendWhoisLine(user, dest, 310, dest->nick+" :is a Network Service on "+ServerInstance->Config->Network); + ServerInstance->SendWhoisLine(user, dest, 310, ":is a Network Service on "+ServerInstance->Config->Network); } } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index f861f1236..03e9bed96 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -160,11 +160,10 @@ class ModuleSSLInfo : public Module ssl_cert* cert = cmd.CertExt.get(dest); if (cert) { - ServerInstance->SendWhoisLine(source, dest, 671, "%s :is using a secure connection", dest->nick.c_str()); + ServerInstance->SendWhoisLine(source, dest, 671, ":is using a secure connection"); bool operonlyfp = ServerInstance->Config->ConfValue("sslinfo")->getBool("operonly"); if ((!operonlyfp || source == dest || source->IsOper()) && !cert->fingerprint.empty()) - ServerInstance->SendWhoisLine(source, dest, 276, "%s :has client certificate fingerprint %s", - dest->nick.c_str(), cert->fingerprint.c_str()); + ServerInstance->SendWhoisLine(source, dest, 276, ":has client certificate fingerprint %s", cert->fingerprint.c_str()); } } diff --git a/src/modules/m_swhois.cpp b/src/modules/m_swhois.cpp index 81abde6f7..ddc3726be 100644 --- a/src/modules/m_swhois.cpp +++ b/src/modules/m_swhois.cpp @@ -100,7 +100,7 @@ class ModuleSWhois : public Module std::string* swhois = cmd.swhois.get(dest); if (swhois) { - ServerInstance->SendWhoisLine(user, dest, 320, "%s :%s", dest->nick.c_str(), swhois->c_str()); + ServerInstance->SendWhoisLine(user, dest, 320, ":%s", swhois->c_str()); } } |