1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 * DEVOICE module for InspIRCd
16 * Syntax: /DEVOICE <#chan>
19 /* $ModDesc: Provides voiced users with the ability to devoice themselves. */
29 class cmd_devoice : public command_t
32 cmd_devoice (InspIRCd* Instance) : command_t(Instance,"DEVOICE", 0, 1)
34 this->source = "m_devoice.so";
38 CmdResult Handle (const char** parameters, int pcnt, userrec *user)
40 chanrec* c = ServerInstance->FindChan(parameters[0]);
41 if (c && c->HasUser(user))
44 modes[0] = parameters[0];
46 modes[2] = user->nick;
48 userrec* n = new userrec(ServerInstance);
49 n->SetFd(FD_MAGIC_NUMBER);
50 ServerInstance->SendMode(modes,3,n);
61 class ModuleDeVoice : public Module
63 cmd_devoice *mycommand;
65 ModuleDeVoice(InspIRCd* Me) : Module::Module(Me)
68 mycommand = new cmd_devoice(ServerInstance);
69 ServerInstance->AddCommand(mycommand);
72 virtual ~ModuleDeVoice()
76 virtual Version GetVersion()
78 return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
83 class ModuleDeVoiceFactory : public ModuleFactory
86 ModuleDeVoiceFactory()
90 ~ModuleDeVoiceFactory()
94 virtual Module * CreateModule(InspIRCd* Me)
96 return new ModuleDeVoice(Me);
102 extern "C" void * init_module( void )
104 return new ModuleDeVoiceFactory;