]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sanick.cpp
...because every now and again, i have to do a massive commit.
[user/henk/code/inspircd.git] / src / modules / m_sanick.cpp
index e7496850051f955f42d03c495e37f3d280016c50..fc1d15293d017d6a4201f4c364db7f4f619a6d8a 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
 class CommandSanick : public Command
 {
  public:
-       CommandSanick (InspIRCd* Instance) : Command(Instance,"SANICK", "o", 2, false, 0)
+       CommandSanick(Module* Creator) : Command(Creator,"SANICK", 2)
        {
-               this->source = "m_sanick.so";
-               syntax = "<nick> <new-nick>";
+               flags_needed = 'o'; Penalty = 0; syntax = "<nick> <new-nick>";
                TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
        }
 
@@ -68,27 +67,29 @@ class CommandSanick : public Command
                                ServerInstance->SNO->WriteToSnoMask('a', oldnick+" failed SANICK (from "+newnick+" to "+parameters[1]+")");
                                ServerInstance->PI->SendSNONotice("A", oldnick+" failed SANICK (from "+newnick+" to "+parameters[1]+")");
                        }
-                       /* Yes, hit target and we have sent our NICK out, we can now bail */
-                       return CMD_LOCALONLY;
                }
 
-               /* No, route it on */
                return CMD_SUCCESS;
        }
+
+       RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+       {
+               User* dest = ServerInstance->FindNick(parameters[0]);
+               if (dest)
+                       return ROUTE_OPT_UCAST(dest->server);
+               return ROUTE_LOCALONLY;
+       }
 };
 
 
 class ModuleSanick : public Module
 {
-       CommandSanick*  mycommand;
+       CommandSanick cmd;
  public:
-       ModuleSanick(InspIRCd* Me)
-               : Module(Me)
+       ModuleSanick()
+               : cmd(this)
        {
-
-               mycommand = new CommandSanick(ServerInstance);
-               ServerInstance->AddCommand(mycommand);
-
+               ServerInstance->AddCommand(&cmd);
        }
 
        virtual ~ModuleSanick()
@@ -97,7 +98,7 @@ class ModuleSanick : public Module
 
        virtual Version GetVersion()
        {
-               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("Provides support for SANICK command", VF_OPTCOMMON | VF_VENDOR);
        }
 
 };