]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_remove.cpp
cmode(), cflags(), cstatus() -> chanrec::GetStatusChar(), chanrec::GetStatusFlags...
[user/henk/code/inspircd.git] / src / modules / m_remove.cpp
index 7452b2f336a84773758560a18c3f846116473fe0..354fe7a8d89f567509d7ba40a66eae12ac0df8b0 100644 (file)
@@ -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);
                }
        }
 };