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