* | 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 <stdio.h>
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
#include "inspircd.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 (InspIRCd* Instance) : Command(Instance,"DEVOICE", 0, 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> ¶meters, 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;
-
- ServerInstance->SendMode(modes,3,user);
+ std::vector<std::string> modes;
+ modes.push_back(parameters[0]);
+ modes.push_back("-v");
+ modes.push_back(user->nick);
- return CMD_SUCCESS;
+ ServerInstance->SendMode(modes, ServerInstance->FakeClient);
+ ServerInstance->PI->SendMode(c->name, ServerInstance->Modes->GetLastParseParams(), ServerInstance->Modes->GetLastParseTranslate());
+ return CMD_LOCALONLY;
}
return CMD_FAILURE;
class ModuleDeVoice : public Module
{
- cmd_devoice *mycommand;
+ CommandDevoice *mycommand;
public:
- ModuleDeVoice(InspIRCd* Me) : Module::Module(Me)
+ ModuleDeVoice(InspIRCd* Me) : Module(Me)
{
-
- mycommand = new cmd_devoice(ServerInstance);
+
+ mycommand = new CommandDevoice(ServerInstance);
ServerInstance->AddCommand(mycommand);
+
}
-
+
virtual ~ModuleDeVoice()
{
}
-
- virtual Version GetVersion()
- {
- return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
- }
-};
-
-class ModuleDeVoiceFactory : public ModuleFactory
-{
- public:
- ModuleDeVoiceFactory()
- {
- }
-
- ~ModuleDeVoiceFactory()
- {
- }
-
- virtual Module * CreateModule(InspIRCd* Me)
+ virtual Version GetVersion()
{
- return new ModuleDeVoice(Me);
+ return Version("$Id$", VF_VENDOR, API_VERSION);
}
-
};
-
-extern "C" void * init_module( void )
-{
- return new ModuleDeVoiceFactory;
-}
+MODULE_INIT(ModuleDeVoice)