]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sapart.cpp
Fix test client error cheecking on result types
[user/henk/code/inspircd.git] / src / modules / m_sapart.cpp
index 918a8ca56e2750d636a2f4e72f1c7de514ba2578..afbdbdc870d0fd0ab089f759f524bd843deb215b 100644 (file)
@@ -3,13 +3,13 @@
  *       +------------------------------------+
  *
  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                       E-mail:
- *                <brain@chatspike.net>
- *               <Craig@chatspike.net>
+ *                    E-mail:
+ *             <brain@chatspike.net>
+ *               <Craig@chatspike.net>
  *     
  * Written by Craig Edwards, Craig McLure, and others.
  * This program is free but copyrighted software; see
- *            the file COPYING for details.
+ *         the file COPYING for details.
  *
  * ---------------------------------------------------
  */
@@ -21,10 +21,11 @@ using namespace std;
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
+#include "helperfuncs.h"
 
 /* $ModDesc: Provides support for unreal-style SAPART command */
 
-Server *Srv;
+static Server *Srv;
 
 class cmd_sapart : public command_t
 {
@@ -34,18 +35,20 @@ class cmd_sapart : public command_t
                this->source = "m_sapart.so";
        }
         
-       void Handle (char **parameters, int pcnt, userrec *user)
+       void Handle (const char** parameters, int pcnt, userrec *user)
        {
                userrec* dest = Srv->FindNick(std::string(parameters[0]));
                if (dest)
                {
-                       for (unsigned int x = 0; x < strlen(parameters[1]); x++)
+                       if (Srv->IsUlined(dest->server))
                        {
-                                       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;
-                                       }
+                               WriteServ(user->fd,"990 %s :Cannot use an SA command on a u-lined client",user->nick);
+                               return;
+                       }
+                       if (!IsValidChannelName(parameters[1]))
+                       {
+                               Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
+                               return;
                        }
 
                        Srv->SendOpers(std::string(user->nick)+" used SAPART to make "+std::string(dest->nick)+" part "+parameters[1]);