X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_remove.cpp;h=354fe7a8d89f567509d7ba40a66eae12ac0df8b0;hb=dafc021be4f3ad34ca37953de6a0109a161dd165;hp=7452b2f336a84773758560a18c3f846116473fe0;hpb=6ab1d0dffb8084bf6a2ad8a446a3836fa3760c8a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 7452b2f33..354fe7a8d 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -7,6 +7,7 @@ #include "channels.h" #include "modules.h" #include "helperfuncs.h" +#include "inspircd.h" /* $ModDesc: Provides a /remove command, this is mostly an alternative to /kick, except makes users appear to have parted the channel */ @@ -16,6 +17,8 @@ * eg: +h can remove +hv and users with no modes. +a can remove +aohv and users with no modes. */ +extern InspIRCd* ServerInstance; + class RemoveBase { private: @@ -84,21 +87,21 @@ class RemoveBase username = parameters[ neworder ? 1 : 0]; /* Look up the user we're meant to be removing from the channel */ - target = Srv->FindNick(username); + target = ServerInstance->FindNick(username); /* And the channel we're meant to be removing them from */ - channel = Srv->FindChannel(channame); + channel = ServerInstance->FindChan(channame); /* Fix by brain - someone needs to learn to validate their input! */ if (!target || !channel) { - WriteServ(user->fd,"401 %s %s :No such nick/channel", user->nick, !target ? username : channame); + user->WriteServ("401 %s %s :No such nick/channel", user->nick, !target ? username : channame); return; } if (!channel->HasUser(target)) { - WriteServ(user->fd, "NOTICE %s :*** The user %s is not on channel %s", user->nick, target->nick, channel->name); + user->WriteServ( "NOTICE %s :*** The user %s is not on channel %s", user->nick, target->nick, channel->name); return; } @@ -124,8 +127,8 @@ class RemoveBase } else { - log(DEBUG, "Setting ulevel to %s", Srv->ChanMode(user, channel).c_str()); - ulevel = chartolevel(Srv->ChanMode(user, channel)); + log(DEBUG, "Setting ulevel to %s", channel->GetStatusChar(user)); + ulevel = chartolevel(channel->GetStatusChar(user)); } /* Now it's the same idea, except for the target. If they're ulined make sure they get a higher level than the sender can */ @@ -146,8 +149,8 @@ class RemoveBase } else { - log(DEBUG, "Setting tlevel to %s", Srv->ChanMode(target, channel).c_str()); - tlevel = chartolevel(Srv->ChanMode(target, channel)); + log(DEBUG, "Setting tlevel to %s", channel->GetStatusChar(target)); + tlevel = chartolevel(channel->GetStatusChar(target)); } hasnokicks = (Srv->FindModule("m_nokicks.so") && channel->IsModeSet('Q')); @@ -183,20 +186,20 @@ class RemoveBase reason << "Removed by " << user->nick << reasonparam; channel->WriteChannelWithServ(Srv->GetServerName().c_str(), "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, reasonparam.c_str()); + target->WriteServ("NOTICE %s :*** %s removed you from %s with the message: %s", target->nick, user->nick, channel->name, reasonparam.c_str()); if (!channel->PartUser(target, reason.str().c_str())) delete channel; } else { - WriteServ(user->fd, "NOTICE %s :*** You do not have access to /remove %s from %s", user->nick, target->nick, channel->name); + user->WriteServ( "NOTICE %s :*** You do not have access to /remove %s from %s", user->nick, target->nick, channel->name); } } else { /* m_nokicks.so was loaded and +Q was set, block! */ - WriteServ(user->fd, "484 %s %s :Can't remove user %s from channel (+Q set)", user->nick, channel->name, target->nick); + user->WriteServ( "484 %s %s :Can't remove user %s from channel (+Q set)", user->nick, channel->name, target->nick); } } };