summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2015-05-04 12:02:28 +0200
committerAttila Molnar <attilamolnar@hush.com>2015-05-04 12:02:28 +0200
commit68bb6a67459298ca08eb18b60794619ddf782c77 (patch)
tree363266b9cfccac732a9f7e887c6dd9d06a1978f5
parent55477059cfd93e3924c7169f686f3eb0dcb6758a (diff)
core_whois Fix numeric 319 not obeying MaxLine
-rw-r--r--src/coremods/core_whois.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/coremods/core_whois.cpp b/src/coremods/core_whois.cpp
index d532dc9a1..1cd622092 100644
--- a/src/coremods/core_whois.cpp
+++ b/src/coremods/core_whois.cpp
@@ -115,12 +115,15 @@ void CommandWhois::SplitChanList(WhoisContextImpl& whois, const std::string& cl)
std::string line(1, ':');
std::string::size_type start, pos;
- const std::string::size_type namelen = ServerInstance->Config->ServerName.length() + 6 + whois.GetTarget()->nick.length() + 1;
+ // ":server.name 319 source target " ... "\r\n"
+ const std::string::size_type maxlen = ServerInstance->Config->Limits.MaxLine - 10 - ServerInstance->Config->ServerName.length() - whois.GetTarget()->nick.length() - whois.GetSource()->nick.length();
for (start = 0; (pos = cl.find(' ', start)) != std::string::npos; start = pos+1)
{
- if (line.length() + namelen + pos - start > 510)
+ if (line.length() + pos - start > maxlen)
{
+ // Erase last ' ' and send
+ line.erase(line.length()-1);
whois.SendLine(319, line);
line.erase(1);
}
@@ -130,6 +133,8 @@ void CommandWhois::SplitChanList(WhoisContextImpl& whois, const std::string& cl)
if (line.length() > 1)
{
+ // Erase last ' ' and send
+ line.erase(line.length()-1);
whois.SendLine(319, line);
}
}