*/
class RemoveBase : public Command
{
- private:
bool& supportnokicks;
public:
channel = ServerInstance->FindChan(channame);
/* Fix by brain - someone needs to learn to validate their input! */
- if (!target || !channel)
+ if ((!target) || (target->registered != REG_ALL) || (!channel))
{
- user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), !target ? username.c_str() : channame.c_str());
+ user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel", user->nick.c_str(), !channel ? channame.c_str() : username.c_str());
return CMD_FAILURE;
}
*/
if ((!IS_LOCAL(user)) || ((ulevel > VOICE_VALUE) && (ulevel >= tlevel) && (tlevel != 50000)))
{
+ // REMOVE/FPART 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))
+ return CMD_SUCCESS;
+
std::string reasonparam;
/* If a reason is given, use it */
CommandFpart cmd2;
bool supportnokicks;
-
public:
ModuleRemove() : cmd1(this, supportnokicks), cmd2(this, supportnokicks)
{
void init()
{
- ServerInstance->AddCommand(&cmd1);
- ServerInstance->AddCommand(&cmd2);
+ ServerInstance->Modules->AddService(cmd1);
+ ServerInstance->Modules->AddService(cmd2);
OnRehash(NULL);
Implementation eventlist[] = { I_On005Numeric, I_OnRehash };
ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
}
- virtual void On005Numeric(std::string &output)
+ virtual void On005Numeric(std::map<std::string, std::string>& tokens)
{
- output.append(" REMOVE");
+ tokens["REMOVE"];
}
virtual void OnRehash(User* user)
supportnokicks = ServerInstance->Config->ConfValue("remove")->getBool("supportnokicks");
}
- virtual ~ModuleRemove()
- {
- }
-
virtual Version GetVersion()
{
return Version("Provides a /remove command, this is mostly an alternative to /kick, except makes users appear to have parted the channel", VF_OPTCOMMON | VF_VENDOR);
}
-
};
MODULE_INIT(ModuleRemove)