InspIRCd  3.0
snomasks.h
1 /*
2  * InspIRCd -- Internet Relay Chat Daemon
3  *
4  * Copyright (C) 2013-2014 Attila Molnar <[email protected]>
5  * Copyright (C) 2013, 2017 Sadie Powell <[email protected]>
6  * Copyright (C) 2012 Robby <[email protected]>
7  * Copyright (C) 2009-2010 Daniel De Graaf <[email protected]>
8  * Copyright (C) 2009 Uli Schlachter <[email protected]>
9  * Copyright (C) 2008 Thomas Stagner <[email protected]>
10  * Copyright (C) 2008 Robin Burchell <[email protected]>
11  * Copyright (C) 2007 Dennis Friis <[email protected]>
12  * Copyright (C) 2006, 2010 Craig Edwards <[email protected]>
13  *
14  * This file is part of InspIRCd. InspIRCd is free software: you can
15  * redistribute it and/or modify it under the terms of the GNU General Public
16  * License as published by the Free Software Foundation, version 2.
17  *
18  * This program is distributed in the hope that it will be useful, but WITHOUT
19  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
21  * details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program. If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 
28 #pragma once
29 
30 class SnomaskManager;
31 class Snomask
32 {
35  std::string Description;
36 
40  std::string LastMessage;
41  char LastLetter;
42  unsigned int Count;
43 
49  static void Send(char letter, const std::string& desc, const std::string& msg);
50 
51  public:
54  Snomask();
55 
60  void SendMessage(const std::string& message, char letter);
61 
64  void Flush();
65 
71  std::string GetDescription(char letter) const;
72 
73  friend class SnomaskManager;
74 };
75 
80 class CoreExport SnomaskManager : public fakederef<SnomaskManager>
81 {
82  Snomask masks[26];
83 
84  public:
88 
96  void EnableSnomask(char letter, const std::string &description);
97 
102  void WriteToSnoMask(char letter, const std::string &text);
103 
109  void WriteToSnoMask(char letter, const char* text, ...) CUSTOM_PRINTF(3, 4);
110 
115  void WriteGlobalSno(char letter, const std::string &text);
116 
122  void WriteGlobalSno(char letter, const char* text, ...) CUSTOM_PRINTF(3, 4);
123 
132  void FlushSnotices();
133 
140  bool IsSnomaskUsable(char ch) const;
141 };
fakederef
Definition: inspircd.h:71
Snomask::Flush
void Flush()
Definition: snomasks.cpp:116
Snomask::SendMessage
void SendMessage(const std::string &message, char letter)
Definition: snomasks.cpp:94
SnomaskManager
Definition: snomasks.h:80
Snomask
Definition: snomasks.h:31
Snomask::Snomask
Snomask()
Definition: snomasks.cpp:89
Snomask::GetDescription
std::string GetDescription(char letter) const
Definition: snomasks.cpp:147