summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-14 16:31:49 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-14 16:31:49 +0000
commitcbb888a47064a8b70254047fd305bea73c2395ad (patch)
tree5e4e9eec35b169166e2a6589faa4ceeaaa0db45c /src
parent730d2a2c2af916b32a46c3f0792e99b3275839cc (diff)
Allow for resizing of MAXBUF above/below 512 via non-interactive configure. (Some crazy mofo on the forums asked for this, good luck its your funeral :p)
THIS IS UNSUPPORTED BY US IF YOU CHANGE IT, WE WON'T EVEN TELL YOU HOW :) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7022 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/userprocess.cpp6
-rw-r--r--src/users.cpp4
2 files changed, 5 insertions, 5 deletions
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index a72d738c3..dd6a4c24d 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -107,7 +107,7 @@ void InspIRCd::ProcessUser(userrec* cu)
}
else
{
- current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over 512chars) Please shorten it.", current->nick);
+ current->WriteServ("NOTICE %s :Your previous line was too long and was not delivered (Over %d chars) Please shorten it.", current->nick, MAXBUF-2);
current->recvq = "";
}
}
@@ -177,8 +177,8 @@ void InspIRCd::ProcessUser(userrec* cu)
std::string single_line = current->GetBuffer();
current->bytes_in += single_line.length();
current->cmds_in++;
- if (single_line.length() > 512)
- single_line.resize(512);
+ if (single_line.length() > MAXBUF - 2) /* MAXBUF is 514 to allow for neccessary line terminators */
+ single_line.resize(MAXBUF - 2); /* So to trim to 512 here, we use MAXBUF - 2 */
EventHandler* old_comp = this->SE->GetRef(currfd);
diff --git a/src/users.cpp b/src/users.cpp
index cf3d4aa86..eacbe2779 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -690,8 +690,8 @@ void userrec::AddWriteBuf(const std::string &data)
try
{
- if (data.length() > 512)
- sendq.append(data.substr(0,510)).append("\r\n");
+ if (data.length() > MAXBUF - 2) /* MAXBUF has a value of 514, to account for line terminators */
+ sendq.append(data.substr(0,MAXBUF - 4)).append("\r\n"); /* MAXBUF-4 = 510 */
else
sendq.append(data);
}