]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/sinfo.cpp
Only assign NewServices once the duplicate check is done.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / sinfo.cpp
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  *   Copyright (C) 2018-2019 Sadie Powell <sadie@witchery.services>
5  *   Copyright (C) 2017 B00mX0r <b00mx0r@aureus.pw>
6  *   Copyright (C) 2014 Attila Molnar <attilamolnar@hush.com>
7  *
8  * This file is part of InspIRCd.  InspIRCd is free software: you can
9  * redistribute it and/or modify it under the terms of the GNU General Public
10  * License as published by the Free Software Foundation, version 2.
11  *
12  * This program is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
15  * details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19  */
20
21 #include "inspircd.h"
22
23 #include "treeserver.h"
24 #include "commands.h"
25
26 CmdResult CommandSInfo::HandleServer(TreeServer* server, CommandBase::Params& params)
27 {
28         const std::string& key = params.front();
29         const std::string& value = params.back();
30
31         if (key == "fullversion")
32         {
33                 server->SetFullVersion(value);
34         }
35         else if (key == "version")
36         {
37                 server->SetVersion(value);
38         }
39         else if (key == "rawversion")
40         {
41                 server->SetRawVersion(value);
42         }
43         else if (key == "desc")
44         {
45                 // Only sent when the description of a server changes because of a rehash; not sent on burst
46                 ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Server description of " + server->GetName() + " changed: " + value);
47                 server->SetDesc(value);
48         }
49
50         return CMD_SUCCESS;
51 }
52
53 CommandSInfo::Builder::Builder(TreeServer* server, const char* key, const std::string& val)
54         : CmdBuilder(server, "SINFO")
55 {
56         push(key).push_last(val);
57 }