2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2017 B00mX0r <b00mx0r@aureus.pw>
5 * Copyright (C) 2013, 2018, 2020 Sadie Powell <sadie@witchery.services>
6 * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
7 * Copyright (C) 2012, 2016 Attila Molnar <attilamolnar@hush.com>
8 * Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
9 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
10 * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
11 * Copyright (C) 2008 Oliver Lupton <om@inspircd.org>
13 * This file is part of InspIRCd. InspIRCd is free software: you can
14 * redistribute it and/or modify it under the terms of the GNU General Public
15 * License as published by the Free Software Foundation, version 2.
17 * This program is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
22 * You should have received a copy of the GNU General Public License
23 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31 class CommandSATopic : public Command
34 CommandSATopic(Module* Creator) : Command(Creator,"SATOPIC", 2, 2)
37 syntax = "<channel> :<topic>";
40 CmdResult Handle(User* user, const Params& parameters) CXX11_OVERRIDE
43 * Handles a SATOPIC request. Notifies all +s users.
45 Channel* target = ServerInstance->FindChan(parameters[0]);
49 const std::string newTopic(parameters[1], 0, ServerInstance->Config->Limits.MaxTopic);
50 if (target->topic == newTopic)
52 user->WriteNotice(InspIRCd::Format("The topic on %s is already what you are trying to change it to.", target->name.c_str()));
56 target->SetTopic(user, newTopic, ServerInstance->Time(), NULL);
57 ServerInstance->SNO->WriteGlobalSno('a', user->nick + " used SATOPIC on " + target->name + ", new topic: " + newTopic);
63 user->WriteNumeric(Numerics::NoSuchChannel(parameters[0]));
69 class ModuleSATopic : public Module
78 Version GetVersion() CXX11_OVERRIDE
80 return Version("Adds the /SATOPIC command which allows server operators to change the topic of a channel that they would not otherwise have the privileges to change.", VF_VENDOR);
84 MODULE_INIT(ModuleSATopic)