diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/modules.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 2 | ||||
-rw-r--r-- | src/modules/extra/m_ssl_openssl.cpp | 2 | ||||
-rw-r--r-- | src/users.cpp | 12 |
4 files changed, 8 insertions, 10 deletions
diff --git a/src/modules.cpp b/src/modules.cpp index 84502d374..d8557fc2e 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -197,7 +197,7 @@ void Module::OnGlobalConnect(userrec* user) { }; int Module::OnAddBan(userrec* source, chanrec* channel,const std::string &banmask) { return 0; }; int Module::OnDelBan(userrec* source, chanrec* channel,const std::string &banmask) { return 0; }; void Module::OnRawSocketAccept(int fd, const std::string &ip, int localport) { }; -int Module::OnRawSocketWrite(int fd, char* buffer, int count) { return 0; }; +int Module::OnRawSocketWrite(int fd, const char* buffer, int count) { return 0; }; void Module::OnRawSocketClose(int fd) { }; int Module::OnRawSocketRead(int fd, char* buffer, unsigned int count, int &readresult) { return 0; }; void Module::OnUserMessage(userrec* user, void* dest, int target_type, const std::string &text, char status) { }; diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 216c69c25..d9ee49bd0 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -382,7 +382,7 @@ class ModuleSSLGnuTLS : public Module return 1; } - virtual int OnRawSocketWrite(int fd, char* buffer, int count) + virtual int OnRawSocketWrite(int fd, const char* buffer, int count) { issl_session* session = &sessions[fd]; const char* sendbuffer = buffer; diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index 29b97ba9a..b2883c0f0 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -381,7 +381,7 @@ class ModuleSSLOpenSSL : public Module return -1; } - virtual int OnRawSocketWrite(int fd, char* buffer, int count) + virtual int OnRawSocketWrite(int fd, const char* buffer, int count) { issl_session* session = &sessions[fd]; 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() |