InspIRCd  4.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 = 0;
43 
49  static void Send(char letter, const std::string& desc, const std::string& msg);
50 
51  public:
56  void SendMessage(const std::string& message, char letter);
57 
60  void Flush();
61 
67  std::string GetDescription(char letter) const;
68 
69  friend class SnomaskManager;
70 };
71 
76 class CoreExport SnomaskManager
77 {
78  Snomask masks[26];
79 
80  public:
84 
92  void EnableSnomask(char letter, const std::string &description);
93 
98  void WriteToSnoMask(char letter, const std::string &text);
99 
105  void WriteToSnoMask(char letter, const char* text, ...) CUSTOM_PRINTF(3, 4);
106 
111  void WriteGlobalSno(char letter, const std::string &text);
112 
118  void WriteGlobalSno(char letter, const char* text, ...) CUSTOM_PRINTF(3, 4);
119 
128  void FlushSnotices();
129 
136  bool IsSnomaskUsable(char ch) const;
137 };
Definition: snomasks.h:32
void SendMessage(const std::string &message, char letter)
Definition: snomasks.cpp:89
void Flush()
Definition: snomasks.cpp:111
std::string GetDescription(char letter) const
Definition: snomasks.cpp:140
Definition: snomasks.h:77