]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chghost.cpp
fix some unitialised vectors and tidy up a bit.
[user/henk/code/inspircd.git] / src / modules / m_chghost.cpp
index c6819499bd6f6fa49240a39b7bf9026480e894a6..c327d27b32631780a54f8f665c2ac34714777738 100644 (file)
@@ -22,16 +22,16 @@ class CommandChghost : public Command
  private:
        char* hostmap;
  public:
-       CommandChghost (InspIRCd* Instance, char* hmap) : Command(Instance,"CHGHOST",'o',2), hostmap(hmap)
+       CommandChghost (InspIRCd* Instance, char* hmap) : Command(Instance,"CHGHOST","o",2), hostmap(hmap)
        {
                this->source = "m_chghost.so";
                syntax = "<nick> <newhost>";
                TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
        }
  
-       CmdResult Handle(const char** parameters, int pcnt, User *user)
+       CmdResult Handle(const std::vector<std::string> &parameters, User *user)
        {
-               const char * x = parameters[1];
+               const char * x = parameters[1].c_str();
 
                for (; *x; x++)
                {
@@ -41,13 +41,13 @@ class CommandChghost : public Command
                                return CMD_FAILURE;
                        }
                }
-               if (!*parameters[0])
+               if (parameters[0].empty())
                {
                        user->WriteServ("NOTICE %s :*** CHGHOST: Host must be specified", user->nick);
                        return CMD_FAILURE;
                }
                
-               if ((parameters[1] - x) > 63)
+               if ((parameters[1].c_str() - x) > 63)
                {
                        user->WriteServ("NOTICE %s :*** CHGHOST: Host too long", user->nick);
                        return CMD_FAILURE;
@@ -56,14 +56,14 @@ class CommandChghost : public Command
 
                if (!dest)
                {
-                       user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
+                       user->WriteNumeric(401, "%s %s :No such nick/channel", user->nick, parameters[0].c_str());
                        return CMD_FAILURE;
                }
 
-               if ((dest->ChangeDisplayedHost(parameters[1])) && (!ServerInstance->ULine(user->server)))
+               if ((dest->ChangeDisplayedHost(parameters[1].c_str())) && (!ServerInstance->ULine(user->server)))
                {
                        // fix by brain - ulines set hosts silently
-                       ServerInstance->SNO->WriteToSnoMask('O', std::string(user->nick)+" used CHGHOST to make the displayed host of "+dest->nick+" become "+dest->dhost);
+                       ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used CHGHOST to make the displayed host of "+dest->nick+" become "+dest->dhost);
                }
 
                /* route it! */
@@ -108,7 +108,7 @@ class ModuleChgHost : public Module
        
        Version GetVersion()
        {
-               return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
        }
        
 };