]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/compat.cpp
m_spanningtree Change both prefix and first parameter of SQUIT to be a SID
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / compat.cpp
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2009-2010 Daniel De Graaf <danieldg@inspircd.org>
5  *
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.
9  *
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
13  * details.
14  *
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/>.
17  */
18
19
20 #include "inspircd.h"
21 #include "main.h"
22 #include "treesocket.h"
23
24 static std::string newline("\n");
25
26 void TreeSocket::WriteLine(std::string line)
27 {
28         if (LinkState == CONNECTED)
29         {
30                 if (line[0] != ':')
31                 {
32                         ServerInstance->Logs->Log("m_spanningtree", LOG_DEFAULT, "Sending line without server prefix!");
33                         line = ":" + ServerInstance->Config->GetSID() + " " + line;
34                 }
35                 if (proto_version != ProtocolVersion)
36                 {
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
42                 }
43         }
44
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);
48 }