aboutsummaryrefslogtreecommitdiffstats
path: root/src/users.cpp
diff options
context:
space:
mode:
authorGravatar brain2006-08-08 21:58:21 +0000
committerGravatar brain2006-08-08 21:58:21 +0000
commitbe9fbe56f96dddb09af5b256f4529f1d8d563743 (patch)
treecc3b0524d5335250710f9de85ce325820bc65a50 /src/users.cpp
parentWriteWallops() -> userrec::WriteWallops() (originates from a user, so belongs... (diff)
downloadinspircd++-be9fbe56f96dddb09af5b256f4529f1d8d563743.tar.gz
inspircd++-be9fbe56f96dddb09af5b256f4529f1d8d563743.tar.bz2
inspircd++-be9fbe56f96dddb09af5b256f4529f1d8d563743.zip
Improve Write functions, and change some stuff from char* to const char*
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4803 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r--src/users.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 31320581d..a47ff60e8 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1281,19 +1281,17 @@ const char* userrec::GetIPString(char* buf)
void userrec::Write(const std::string &text)
{
- char tb[MAXBUF];
- int bytes;
-
if ((this->fd < 0) || (this->fd > MAX_DESCRIPTORS))
return;
- bytes = snprintf(tb,MAXBUF,"%s\r\n",text.c_str());
+ static std::string crlf = text;
+ crlf.append("\r\n");
if (Config->GetIOHook(this->GetPort()))
{
try
{
- Config->GetIOHook(this->GetPort())->OnRawSocketWrite(this->fd,tb,bytes);
+ Config->GetIOHook(this->GetPort())->OnRawSocketWrite(this->fd, crlf.data(), crlf.length());
}
catch (ModuleException& modexcept)
{
@@ -1302,9 +1300,9 @@ void userrec::Write(const std::string &text)
}
else
{
- this->AddWriteBuf(tb);
+ this->AddWriteBuf(crlf);
}
- ServerInstance->stats->statsSent += bytes;
+ ServerInstance->stats->statsSent += crlf.length();
}
/** Write()