]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_devoice.cpp
Remove InspIRCd* parameters and fields
[user/henk/code/inspircd.git] / src / modules / m_devoice.cpp
index 7c1ffe9656a5e078d3bb63305d99462385093208..7c2dcb3d81fb85091bf51508f90b3ad552d2cae1 100644 (file)
@@ -2,8 +2,8 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2007 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.
 /* $ModDesc: Provides voiced users with the ability to devoice themselves. */
 
 #include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
 
 /** Handle /DEVOICE
  */
-class cmd_devoice : public command_t
+class CommandDevoice : public Command
 {
  public:
-       cmd_devoice (InspIRCd* Instance) : command_t(Instance,"DEVOICE", 0, 1)
+       CommandDevoice(Module* Creator) : Command(Creator,"DEVOICE", 1)
        {
-               this->source = "m_devoice.so";
                syntax = "<channel>";
+               TRANSLATE2(TR_TEXT, TR_END);
        }
 
-       CmdResult Handle (const char** parameters, int pcnt, userrec *user)
+       CmdResult Handle (const std::vector<std::string> &parameters, User *user)
        {
-               chanrec* c = ServerInstance->FindChan(parameters[0]);
+               Channel* c = ServerInstance->FindChan(parameters[0]);
                if (c && c->HasUser(user))
                {
-                       const char* modes[3];
-                       modes[0] = parameters[0];
-                       modes[1] = "-v";
-                       modes[2] = user->nick;
+                       std::vector<std::string> modes;
+                       modes.push_back(parameters[0]);
+                       modes.push_back("-v");
+                       modes.push_back(user->nick);
 
-                       userrec* n = new userrec(ServerInstance);
-                       n->SetFd(FD_MAGIC_NUMBER);
-                       ServerInstance->SendMode(modes,3,n);
-                       delete n;
-
-                       /* route it */
+                       ServerInstance->SendMode(modes, ServerInstance->FakeClient);
+                       ServerInstance->PI->SendMode(c->name, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate());
                        return CMD_SUCCESS;
                }
 
@@ -59,13 +52,11 @@ class cmd_devoice : public command_t
 
 class ModuleDeVoice : public Module
 {
-       cmd_devoice *mycommand;
+       CommandDevoice cmd;
  public:
-       ModuleDeVoice(InspIRCd* Me) : Module(Me)
+       ModuleDeVoice() : cmd(this)
        {
-
-               mycommand = new cmd_devoice(ServerInstance);
-               ServerInstance->AddCommand(mycommand);
+               ServerInstance->AddCommand(&cmd);
        }
 
        virtual ~ModuleDeVoice()
@@ -74,8 +65,8 @@ class ModuleDeVoice : public Module
 
        virtual Version GetVersion()
        {
-               return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
+               return Version("Provides voiced users with the ability to devoice themselves.", VF_VENDOR, API_VERSION);
        }
 };
 
-MODULE_INIT(ModuleDeVoice);
+MODULE_INIT(ModuleDeVoice)