2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
6 * This file is part of InspIRCd. InspIRCd is free software: you can
7 * redistribute it and/or modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation, version 2.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "treesocket.h"
24 static std::string newline("\n");
26 void TreeSocket::WriteLine(std::string line)
28 if (LinkState == CONNECTED)
32 ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Sending line without server prefix!");
33 line = ":" + ServerInstance->Config->GetSID() + " " + line;
35 if (proto_version != ProtocolVersion)
37 std::string::size_type a = line.find(' ');
38 std::string::size_type b = line.find(' ', a + 1);
39 std::string command = line.substr(a + 1, b-a-1);
40 // now try to find a translation entry
41 // TODO a more efficient lookup method will be needed later
45 ServerInstance->Logs->Log("m_spanningtree", LOG_RAWIO, "S[%d] O %s", this->GetFd(), line.c_str());
46 this->WriteData(line);
47 this->WriteData(newline);