diff options
Diffstat (limited to 'src/socket_transport.cpp')
-rw-r--r-- | src/socket_transport.cpp | 52 |
1 files changed, 15 insertions, 37 deletions
diff --git a/src/socket_transport.cpp b/src/socket_transport.cpp index c941d3112..b8afce990 100644 --- a/src/socket_transport.cpp +++ b/src/socket_transport.cpp @@ -1,12 +1,20 @@ /* + * Anope IRC Services * - * (C) 2003-2017 Anope Team - * Contact us at team@anope.org + * Copyright (C) 2011-2017 Anope Team <team@anope.org> * - * Please read COPYING and README for further details. + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. * - * Based on the original code of Epona by Lara. - * Based on the original code of Services by Andy Church. + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. */ #include "services.h" @@ -32,7 +40,7 @@ bool BufferedSocket::ProcessRead() return false; if (len < 0) return SocketEngine::IgnoreErrno(); - + tbuffer[len] = 0; this->read_buffer.append(tbuffer); this->recv_len = len; @@ -72,21 +80,6 @@ void BufferedSocket::Write(const char *buffer, size_t l) SocketEngine::Change(this, true, SF_WRITABLE); } -void BufferedSocket::Write(const char *message, ...) -{ - va_list vi; - char tbuffer[BUFSIZE]; - - if (!message) - return; - - va_start(vi, message); - int len = vsnprintf(tbuffer, sizeof(tbuffer), message, vi); - va_end(vi); - - this->Write(tbuffer, std::min(len, static_cast<int>(sizeof(tbuffer)))); -} - void BufferedSocket::Write(const Anope::string &message) { this->Write(message.c_str(), message.length()); @@ -130,7 +123,7 @@ bool BinarySocket::ProcessRead() int len = this->io->Recv(this, tbuffer, sizeof(tbuffer)); if (len <= 0) return false; - + return this->Read(tbuffer, len); } @@ -172,21 +165,6 @@ void BinarySocket::Write(const char *buffer, size_t l) SocketEngine::Change(this, true, SF_WRITABLE); } -void BinarySocket::Write(const char *message, ...) -{ - va_list vi; - char tbuffer[BUFSIZE]; - - if (!message) - return; - - va_start(vi, message); - int len = vsnprintf(tbuffer, sizeof(tbuffer), message, vi); - va_end(vi); - - this->Write(tbuffer, std::min(len, static_cast<int>(sizeof(tbuffer)))); -} - void BinarySocket::Write(const Anope::string &message) { this->Write(message.c_str(), message.length()); |