2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2018 Sadie Powell <sadie@witchery.services>
5 * Copyright (C) 2017 B00mX0r <b00mx0r@aureus.pw>
6 * Copyright (C) 2012-2016 Attila Molnar <attilamolnar@hush.com>
7 * Copyright (C) 2012, 2019 Robby <robby@chatbelgie.be>
8 * Copyright (C) 2009 Uli Schlachter <psychon@inspircd.org>
9 * Copyright (C) 2009 Daniel De Graaf <danieldg@inspircd.org>
10 * Copyright (C) 2007-2008 Robin Burchell <robin+git@viroteck.net>
11 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
12 * Copyright (C) 2006, 2010 Craig Edwards <brain@inspircd.org>
14 * This file is part of InspIRCd. InspIRCd is free software: you can
15 * redistribute it and/or modify it under the terms of the GNU General Public
16 * License as published by the Free Software Foundation, version 2.
18 * This program is distributed in the hope that it will be useful, but WITHOUT
19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
29 #include "core_user.h"
31 CommandPart::CommandPart(Module* parent)
32 : Command(parent, "PART", 1, 2)
35 syntax = "<channel>[,<channel>]+ [:<reason>]";
38 CmdResult CommandPart::Handle(User* user, const Params& parameters)
41 if (parameters.size() > 1)
44 msgwrap.Wrap(parameters[1], reason);
46 reason = parameters[1];
49 if (CommandParser::LoopCall(user, this, parameters, 0))
52 Channel* c = ServerInstance->FindChan(parameters[0]);
56 user->WriteNumeric(Numerics::NoSuchChannel(parameters[0]));
60 if (!c->PartUser(user, reason))
62 user->WriteNumeric(ERR_NOTONCHANNEL, c->name, "You're not on that channel");
69 RouteDescriptor CommandPart::GetRouting(User* user, const Params& parameters)
71 return (IS_LOCAL(user) ? ROUTE_LOCALONLY : ROUTE_BROADCAST);