]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_sapart.cpp
Remove InspIRCd* parameters and fields
[user/henk/code/inspircd.git] / src / modules / m_sapart.cpp
index 8fba733595c802e3088d168c08a87811e9b3e457..255648f850c0860428a10b28ac033d186c1b67d2 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
 class CommandSapart : public Command
 {
  public:
-       CommandSapart (InspIRCd* Instance) : Command(Instance,"SAPART", "o", 2, false, 0)
+       CommandSapart(Module* Creator) : Command(Creator,"SAPART", 2, 3)
        {
-               this->source = "m_sapart.so";
-               syntax = "<nick> <channel> [reason]";
+               flags_needed = 'o'; Penalty = 0; syntax = "<nick> <channel> [reason]";
                TRANSLATE4(TR_NICK, TR_TEXT, TR_TEXT, TR_END);
        }
 
@@ -56,14 +55,14 @@ class CommandSapart : public Command
                                Channel* n = ServerInstance->FindChan(parameters[1]);
                                if (!n)
                                {
-                                       ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]);
+                                       ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]);
                                        return CMD_SUCCESS;
                                }
                                else
                                {
                                        if (!n->HasUser(dest))
                                        {
-                                               ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]);
+                                               ServerInstance->SNO->WriteGlobalSno('a', std::string(user->nick)+" used SAPART to make "+dest->nick+" part "+parameters[1]);
                                                return CMD_SUCCESS;
                                        }
                                        else
@@ -73,10 +72,6 @@ class CommandSapart : public Command
                                        }
                                }
                        }
-                       else
-                       {
-                               ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick)+" sent remote SAPART to make "+dest->nick+" part "+parameters[1]);
-                       }
 
                        return CMD_SUCCESS;
                }
@@ -87,20 +82,25 @@ class CommandSapart : public Command
 
                return CMD_FAILURE;
        }
+
+       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 ModuleSapart : public Module
 {
-       CommandSapart*  mycommand;
+       CommandSapart cmd;
  public:
-       ModuleSapart(InspIRCd* Me)
-               : Module(Me)
+       ModuleSapart()
+               : cmd(this)
        {
-
-               mycommand = new CommandSapart(ServerInstance);
-               ServerInstance->AddCommand(mycommand);
-
+               ServerInstance->AddCommand(&cmd);
        }
 
        virtual ~ModuleSapart()
@@ -109,7 +109,7 @@ class ModuleSapart : public Module
 
        virtual Version GetVersion()
        {
-               return Version(1, 2, 0, 1, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("Provides support for unreal-style SAPART command", VF_OPTCOMMON | VF_VENDOR, API_VERSION);
        }
 
 };