- Srv->PartUserFromChannel(target, channel->name, reason);
- WriteServ(user->fd, "NOTICE %s :%s removed %s from the channel", channel->name, user->nick, target->nick);
- WriteServ(target->fd, "NOTICE %s :*** %s removed you from %s with the message:%s", target->nick, user->nick, channel->name, reason.c_str());
+ // REMOVE will be sent to the target's server and it will reply with a PART (or do nothing if it doesn't understand the command)
+ if (!IS_LOCAL(target))
+ {
+ // Send an ENCAP REMOVE with parameters being in the old <user> <chan> order which is
+ // compatible with both 2.0 and 3.0. This also turns FPART into REMOVE.
+ std::vector<std::string> p;
+ p.push_back(target->uuid);
+ p.push_back(channel->name);
+ if (parameters.size() > 2)
+ p.push_back(":" + parameters[2]);
+ ServerInstance->PI->SendEncapsulatedData(target->server->GetName(), "REMOVE", p, user);
+
+ return CMD_SUCCESS;
+ }
+
+ std::string reasonparam;
+
+ /* If a reason is given, use it */
+ if(parameters.size() > 2)
+ reasonparam = parameters[2];
+ else
+ reasonparam = "No reason given";
+
+ /* Build up the part reason string. */
+ reason = "Removed by " + user->nick + ": " + reasonparam;
+
+ channel->WriteNotice(InspIRCd::Format("%s removed %s from the channel", user->nick.c_str(), target->nick.c_str()));
+ target->WriteNotice("*** " + user->nick + " removed you from " + channel->name + " with the message: " + reasonparam);
+
+ channel->PartUser(target, reason);