]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_devoice.cpp
Add RAWIO log level which is more verbose than DEBUG
[user/henk/code/inspircd.git] / src / modules / m_devoice.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 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(Module* Creator) : Command(Creator,"DEVOICE", 1)
29         {
30                 syntax = "<channel>";
31                 TRANSLATE2(TR_TEXT, TR_END);
32         }
33
34         CmdResult Handle (const std::vector<std::string> &parameters, User *user)
35         {
36                 Channel* c = ServerInstance->FindChan(parameters[0]);
37                 if (c && c->HasUser(user))
38                 {
39                         std::vector<std::string> modes;
40                         modes.push_back(parameters[0]);
41                         modes.push_back("-v");
42                         modes.push_back(user->nick);
43
44                         ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient);
45                         return CMD_SUCCESS;
46                 }
47
48                 return CMD_FAILURE;
49         }
50 };
51
52 class ModuleDeVoice : public Module
53 {
54         CommandDevoice cmd;
55  public:
56         ModuleDeVoice() : cmd(this)
57         {
58                 ServerInstance->AddCommand(&cmd);
59         }
60
61         virtual ~ModuleDeVoice()
62         {
63         }
64
65         virtual Version GetVersion()
66         {
67                 return Version("Provides voiced users with the ability to devoice themselves.", VF_VENDOR);
68         }
69 };
70
71 MODULE_INIT(ModuleDeVoice)