- for (unsigned int x = 0; x < strlen(parameters[1]); x++)
- {
- if ((parameters[1][0] != '#') || (parameters[1][x] == ' ') || (parameters[1][x] == ','))
- {
- Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
- return;
- }
- }
-
- /* 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 */
- if (user->GetExt("cm_protect_"+std::string(channel->name)))
- privs = std::string("&");
- if (user->GetExt("cm_founder_"+std::string(channel->name)))
- privs = std::string("~");
-
- /* Now it's the same idea, except for the target */
- if (target->GetExt("cm_protect_"+std::string(channel->name)))
- targetprivs = std::string("&");
- if (target->GetExt("cm_founder_"+std::string(channel->name)))
- targetprivs = std::string("~");
-
- tlevel = chartolevel(targetprivs);
- ulevel = chartolevel(privs);
-
- /* If the user calling the command is either an admin, owner, operator or a half-operator on the channel */
- if(ulevel > 1)
+ 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;
+ }
+
+ int ulevel = channel->GetPrefixValue(user);
+ int tlevel = channel->GetPrefixValue(target);
+
+ hasnokicks = (ServerInstance->Modules->Find("m_nokicks.so") && channel->IsModeSet('Q'));
+
+ /* We support the +Q channel mode via. the m_nokicks module, if the module is loaded and the mode is set then disallow the /remove */
+ if ((!IS_LOCAL(user)) || (!supportnokicks || !hasnokicks))
+ {
+ /* We'll let everyone remove their level and below, eg:
+ * ops can remove ops, halfops, voices, and those with no mode (no moders actually are set to 1)
+ * a ulined target will get a higher level than it's possible for a /remover to get..so they're safe.
+ * Nobody may remove a founder.
+ */
+ if ((!IS_LOCAL(user)) || ((ulevel > VOICE_VALUE) && (ulevel >= tlevel) && (tlevel != 50000)))