+ return PEON;
+ }
+
+ switch (privs[0])
+ {
+ case 'U':
+ /* Ulined */
+ return ULINE;
+ case '~':
+ /* Owner */
+ return OWNER;
+ case '&':
+ /* Admin */
+ return ADMIN;
+ case '@':
+ /* Operator */
+ return OP;
+ case '%':
+ /* Halfop */
+ return HALFOP;
+ default:
+ /* Peon */
+ return PEON;
+ }
+ }
+
+ CmdResult Handle (const std::vector<std::string>& parameters, User *user, bool neworder)
+ {
+ const char* channame;
+ const char* username;
+ User* target;
+ Channel* channel;
+ ModeLevel tlevel;
+ ModeLevel ulevel;
+ std::string reason;
+ std::string protectkey;
+ std::string founderkey;
+ bool hasnokicks;
+
+ /* Set these to the parameters needed, the new version of this module switches it's parameters around
+ * supplying a new command with the new order while keeping the old /remove with the older order.
+ * /remove <nick> <channel> [reason ...]
+ * /fpart <channel> <nick> [reason ...]
+ */
+ channame = parameters[ neworder ? 0 : 1].c_str();
+ username = parameters[ neworder ? 1 : 0].c_str();
+
+ /* Look up the user we're meant to be removing from the channel */
+ target = ServerInstance->FindNick(username);
+
+ /* And the channel we're meant to be removing them from */
+ channel = ServerInstance->FindChan(channame);
+
+ /* Fix by brain - someone needs to learn to validate their input! */
+ if (!target || !channel)
+ {
+ user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), !target ? username : channame);
+ return CMD_FAILURE;
+ }
+
+ if (!channel->HasUser(target))
+ {
+ user->WriteServ( "NOTICE %s :*** The user %s is not on channel %s", user->nick.c_str(), target->nick.c_str(), channel->name.c_str());
+ return CMD_FAILURE;
+ }
+
+ /* This is adding support for the +q and +a channel modes, basically if they are enabled, and the remover has them set.
+ * Then we change the @|%|+ to & if they are +a, or ~ if they are +q */
+ protectkey = "cm_protect_" + std::string(channel->name);
+ founderkey = "cm_founder_" + std::string(channel->name);
+
+ if (ServerInstance->ULine(user->server) || ServerInstance->ULine(user->nick.c_str()))
+ {
+ ulevel = chartolevel("U");