From cbb888a47064a8b70254047fd305bea73c2395ad Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 14 May 2007 16:31:49 +0000 Subject: 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 --- src/userprocess.cpp | 6 +++--- src/users.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3