]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sajoin.cpp
Added a parameter to OnRehash for the rehash parameter
[user/henk/code/inspircd.git] / src / modules / m_sajoin.cpp
index e687e474d2f8f2c6c9275ac8fa08127454767503..f82bba20335b7af9807745415b6b2d7ef32c1ab2 100644 (file)
@@ -1,4 +1,20 @@
-// Sajoin and +g support module by C.J.Edwards
+/*       +------------------------------------+
+ *       | Inspire Internet Relay Chat Daemon |
+ *       +------------------------------------+
+ *
+ *  Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ *                       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.
+ *
+ * ---------------------------------------------------
+ */
+
+using namespace std;
 
 #include <stdio.h>
 #include <string>
@@ -15,10 +31,17 @@ void handle_sajoin(char **parameters, int pcnt, userrec *user)
        userrec* dest = Srv->FindNick(std::string(parameters[0]));
        if (dest)
        {
+               /* might be nicer to make checking valid channel names an api function sometime --w00t */
+               if (parameters[1][0] != '#')
+               {
+                       /* we didn't need to check this for each character ;) */
+                       Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
+                       return;
+               }
 
-               for (int x = 0; x < strlen(parameters[0]); x++)
+               for (unsigned int x = 0; x < strlen(parameters[1]); x++)
                {
-                               if ((parameters[0][0] != '#') || (parameters[0][x] == ' ') || (parameters[0][x]> ','))
+                               if ((parameters[1][x] == ' ') || (parameters[1][x] == ','))
                                {
                                        Srv->SendTo(NULL,user,"NOTICE "+std::string(user->nick)+" :*** Invalid characters in channel name");
                                        return;
@@ -37,7 +60,7 @@ class ModuleSajoin : public Module
        ModuleSajoin()
        {
                Srv = new Server;
-               Srv->AddCommand("SAJOIN",handle_sajoin,'o',2);
+               Srv->AddCommand("SAJOIN",handle_sajoin,'o',2,"m_sajoin.so");
        }
        
        virtual ~ModuleSajoin()
@@ -47,7 +70,7 @@ class ModuleSajoin : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,0,0,1);
+               return Version(1,0,0,1,VF_VENDOR);
        }
        
 };