]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sapart.cpp
m_spanningtree Remove remains of the KeepNickTS workaround
[user/henk/code/inspircd.git] / src / modules / m_sapart.cpp
index 1b2ef34b05e547e0db221bb36be41f94801b1b59..fa5ab176a5ad5f1ee0b920fc9b5e37b7f68034c1 100644 (file)
@@ -43,12 +43,18 @@ class CommandSapart : public Command
                        if (parameters.size() > 2)
                                reason = parameters[2];
 
-                       if (ServerInstance->ULine(dest->server))
+                       if (dest->server->IsULine())
                        {
                                user->WriteNumeric(ERR_NOPRIVILEGES, ":Cannot use an SA command on a u-lined client");
                                return CMD_FAILURE;
                        }
 
+                       if (!channel->HasUser(dest))
+                       {
+                               user->WriteNotice("*** " + dest->nick + " is not on " + channel->name);
+                               return CMD_FAILURE;
+                       }
+
                        /* For local clients, directly part them generating a PART message. For remote clients,
                         * just return CMD_SUCCESS knowing the protocol module will route the SAPART to the users
                         * local server and that will generate the PART instead
@@ -56,26 +62,7 @@ class CommandSapart : public Command
                        if (IS_LOCAL(dest))
                        {
                                channel->PartUser(dest, reason);
-
-                               Channel* n = ServerInstance->FindChan(parameters[1]);
-                               if (!n)
-                               {
-                                       ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAPART to make "+dest->nick+" part "+parameters[1]);
-                                       return CMD_SUCCESS;
-                               }
-                               else
-                               {
-                                       if (!n->HasUser(dest))
-                                       {
-                                               ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAPART to make "+dest->nick+" part "+parameters[1]);
-                                               return CMD_SUCCESS;
-                                       }
-                                       else
-                                       {
-                                               user->WriteNotice("*** Unable to make " + dest->nick + " part " + parameters[1]);
-                                               return CMD_FAILURE;
-                                       }
-                               }
+                               ServerInstance->SNO->WriteGlobalSno('a', user->nick+" used SAPART to make "+dest->nick+" part "+channel->name);
                        }
 
                        return CMD_SUCCESS;