]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_devoice.cpp
This file *BROKEN AGAIN* in windows builds (VC9) - uint_16t and uint_32t do not exist...
[user/henk/code/inspircd.git] / src / modules / m_devoice.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 /*
15  * DEVOICE module for InspIRCd
16  *  Syntax: /DEVOICE <#chan>
17  */
18
19 /* $ModDesc: Provides voiced users with the ability to devoice themselves. */
20
21 #include "inspircd.h"
22
23 /** Handle /DEVOICE
24  */
25 class CommandDevoice : public Command
26 {
27  public:
28         CommandDevoice (InspIRCd* Instance) : Command(Instance,"DEVOICE", 0, 1)
29         {
30                 this->source = "m_devoice.so";
31                 syntax = "<channel>";
32                 TRANSLATE2(TR_TEXT, TR_END);
33         }
34
35         CmdResult Handle (const std::vector<std::string> &parameters, User *user)
36         {
37                 Channel* c = ServerInstance->FindChan(parameters[0]);
38                 if (c && c->HasUser(user))
39                 {
40                         std::vector<std::string> modes;
41                         modes.push_back(parameters[0]);
42                         modes.push_back("-v");
43                         modes.push_back(user->nick);
44
45                         ServerInstance->SendMode(modes, ServerInstance->FakeClient);
46
47                         /* route it -- SendMode doesn't distribute over the whole network */
48                         return CMD_SUCCESS;
49                 }
50
51                 return CMD_FAILURE;
52         }
53 };
54
55 class ModuleDeVoice : public Module
56 {
57         CommandDevoice *mycommand;
58  public:
59         ModuleDeVoice(InspIRCd* Me) : Module(Me)
60         {
61
62                 mycommand = new CommandDevoice(ServerInstance);
63                 ServerInstance->AddCommand(mycommand);
64
65         }
66
67         virtual ~ModuleDeVoice()
68         {
69         }
70
71         virtual Version GetVersion()
72         {
73                 return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
74         }
75 };
76
77 MODULE_INIT(ModuleDeVoice)