]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_vhost.cpp
This needs some general QA-ing. Add support to new parser (introduced in 1.1) for...
[user/henk/code/inspircd.git] / src / modules / m_vhost.cpp
index f0ebfe54b5372e0977056e818a20543f775804c4..0a08c7194a8584f4ce95829d10a45aceb2a74646 100644 (file)
@@ -2,20 +2,15 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
- *                       E-mail:
- *                <brain@chatspike.net>
- *               <Craig@chatspike.net>
- *     
- * Written by Craig Edwards, Craig McLure, and others.
+ *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
+ * See: http://www.inspircd.org/wiki/index.php/Credits
+ *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
  *
  * ---------------------------------------------------
  */
 
-using namespace std;
-
 #include <stdio.h>
 #include "users.h"
 #include "channels.h"
@@ -24,19 +19,20 @@ using namespace std;
 
 /* $ModDesc: Provides masking of user hostnames via traditional /VHOST command */
 
-static ConfigReader *Conf;
-
+static ConfigReader* Conf;
 
+/** Handle /VHOST
+ */
 class cmd_vhost : public command_t
 {
  public:
- cmd_vhost (InspIRCd* Instance) : command_t(Instance,"VHOST", 0, 2)
      cmd_vhost (InspIRCd* Instance) : command_t(Instance,"VHOST", 0, 2)
        {
                this->source = "m_vhost.so";
                syntax = "<username> <password>";
        }
 
-       void Handle (const char** parameters, int pcnt, userrec *user)
+       CmdResult Handle (const char** parameters, int pcnt, userrec *user)
        {
                for (int index = 0; index < Conf->Enumerate("vhost"); index++)
                {
@@ -49,11 +45,12 @@ class cmd_vhost : public command_t
                                {
                                        user->WriteServ("NOTICE "+std::string(user->nick)+" :Setting your VHost: " + mask);
                                        user->ChangeDisplayedHost(mask.c_str());
-                                       return;
+                                       return CMD_FAILURE;
                                }
                        }
                }
                user->WriteServ("NOTICE "+std::string(user->nick)+" :Invalid username or password.");
+               return CMD_FAILURE;
        }
 };
 
@@ -82,7 +79,7 @@ class ModuleVHost : public Module
                List[I_OnRehash] = 1;
        }
 
-       virtual void OnRehash(const std::string &parameter)
+       virtual void OnRehash(userrec* user, const std::string &parameter)
        {
                DELETE(Conf);
                Conf = new ConfigReader(ServerInstance);
@@ -90,9 +87,7 @@ class ModuleVHost : public Module
        
        virtual Version GetVersion()
        {
-               // returns the version number of the module to be
-               // listed in /MODULES
-               return Version(1,0,0,1,VF_VENDOR);
+               return Version(1,1,0,1,VF_VENDOR,API_VERSION);
        }
        
 };