]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - include/snomasks.h
Wahhhhhhhhhhhh bwahahaha. Mass commit to tidy up tons of messy include lists
[user/henk/code/inspircd.git] / include / snomasks.h
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                       E-mail:
7  *                <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *            the file COPYING for details.
13  *
14  * --------------------------------------------------
15  */
16
17 #ifndef __SNOMASKS_H__
18 #define __SNOMASKS_H__
19
20 #include <string>
21 #include <vector>
22 #include <map>
23 #include "configreader.h"
24 #include "inspircd.h"
25
26 /** A list of snomasks which are valid, and their descriptive texts
27  */
28 typedef std::map<char, std::string> SnoList;
29
30 /** Snomask manager handles routing of SNOMASK (usermode +n) messages to opers.
31  * Modules and the core can enable and disable snomask characters. If they do,
32  * then sending snomasks using these characters becomes possible.
33  */
34 class SnomaskManager : public Extensible
35 {
36  private:
37         /** Creator/owner
38          */
39         InspIRCd* ServerInstance;
40         /** Currently active snomask list
41          */
42         SnoList SnoMasks;
43         /** Set up the default (core available) snomask chars
44          */
45         void SetupDefaults();
46  public:
47         /** Create a new SnomaskManager
48          */
49         SnomaskManager(InspIRCd* Instance);
50         /** Delete SnomaskManager
51          */
52         ~SnomaskManager();
53
54         /** Enable a snomask.
55          * @param letter The snomask letter to enable. Once enabled,
56          * server notices may be routed to users with this letter in
57          * their list, and users may add this letter to their list.
58          * @param description The descriptive text sent along with any
59          * server notices, at the start of the notice, e.g. "GLOBOPS".
60          * @return True if the snomask was enabled, false if it already
61          * exists.
62          */
63         bool EnableSnomask(char letter, const std::string &description);
64         /** Disable a snomask.
65          * @param letter The snomask letter to disable.
66          * @return True if the snomask was disabled, false if it didn't
67          * exist.
68          */
69         bool DisableSnomask(char letter);
70         /** Write to all users with a given snomask.
71          * @param letter The snomask letter to write to
72          * @param text The text to send to the users
73          */
74         void WriteToSnoMask(char letter, const std::string &text);
75         /** Write to all users with a given snomask.
76          * @param letter The snomask letter to write to
77          * @param text A format string containing text to send
78          * @param ... Format arguments
79          */
80         void WriteToSnoMask(char letter, const char* text, ...);
81         /** Check if a snomask is enabled.
82          * @param letter The snomask letter to check.
83          * @return True if the snomask has been enabled.
84          */
85         bool IsEnabled(char letter);
86 };
87
88 #endif