]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sethost.cpp
Implement feature in bug #395 reported by stealth, and tidy up a bit
[user/henk/code/inspircd.git] / src / modules / m_sethost.cpp
index 62b6bda833a153fc066809d4bdde97b05702427c..48c31d4e2811a06481b70d7355d56e0804d194d9 100644 (file)
  * ---------------------------------------------------
  */
 
-#include <stdio.h>
-#include <string>
+#include "inspircd.h"
 #include "users.h"
 #include "channels.h"
 #include "modules.h"
 
-#include "inspircd.h"
-
 /* $ModDesc: Provides support for the SETHOST command */
 
 /** Handle /SETHOST
@@ -41,10 +38,15 @@ class cmd_sethost : public command_t
                {
                        if (!hostmap[(unsigned char)*x])
                        {
-                               user->WriteServ("NOTICE "+std::string(user->nick)+" :*** Invalid characters in hostname");
+                               user->WriteServ("NOTICE "+std::string(user->nick)+" :*** SETHOST: Invalid characters in hostname");
                                return CMD_FAILURE;
                        }
                }
+               if (len == 0)
+               {
+                       user->WriteServ("NOTICE %s :*** SETHOST: Host must be specified", user->nick);
+                       return CMD_FAILURE;
+               }
                if (len > 64)
                {
                        user->WriteServ("NOTICE %s :*** SETHOST: Host too long",user->nick);
@@ -98,32 +100,9 @@ class ModuleSetHost : public Module
        
        virtual Version GetVersion()
        {
-               return Version(1,1,0,1,VF_VENDOR,API_VERSION);
-       }
-       
-};
-
-class ModuleSetHostFactory : public ModuleFactory
-{
- public:
-       ModuleSetHostFactory()
-       {
-       }
-       
-       ~ModuleSetHostFactory()
-       {
-       }
-       
-       virtual Module * CreateModule(InspIRCd* Me)
-       {
-               return new ModuleSetHost(Me);
+               return Version(1, 1, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
        }
        
 };
 
-
-extern "C" DllExport void * init_module( void )
-{
-       return new ModuleSetHostFactory;
-}
-
+MODULE_INIT(ModuleSetHost)