2 * InspIRCd -- Internet Relay Chat Daemon
4 * Copyright (C) 2010 Daniel De Graaf <danieldg@inspircd.org>
5 * Copyright (C) 2008 Robin Burchell <robin+git@viroteck.net>
6 * Copyright (C) 2007 Dennis Friis <peavey@inspircd.org>
7 * Copyright (C) 2006 Craig Edwards <craigedwards@brainbox.cc>
9 * This file is part of InspIRCd. InspIRCd is free software: you can
10 * redistribute it and/or modify it under the terms of the GNU General Public
11 * License as published by the Free Software Foundation, version 2.
13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
28 std::string Description;
29 std::string LastMessage;
34 /** Create a new Snomask
36 Snomask() : Count(0), LastBlocked(false), LastLetter(0)
40 /** Sends a message to all opers with this snomask.
42 void SendMessage(const std::string &message, char letter);
44 /** Sends out the (last message repeated N times) message
49 /** Snomask manager handles routing of SNOMASK (usermode +s) messages to opers.
50 * Modules and the core can enable and disable snomask characters. If they do,
51 * then sending snomasks using these characters becomes possible.
53 class CoreExport SnomaskManager
58 /** Create a new SnomaskManager
63 * @param letter The snomask letter to enable. Once enabled,
64 * server notices may be routed to users with this letter in
65 * their list, and users may add this letter to their list.
66 * @param description The descriptive text sent along with any
67 * server notices, at the start of the notice, e.g. "GLOBOPS".
69 void EnableSnomask(char letter, const std::string &description);
71 /** Write to all users with a given snomask (local server only)
72 * @param letter The snomask letter to write to
73 * @param text The text to send to the users
75 void WriteToSnoMask(char letter, const std::string &text);
77 /** Write to all users with a given snomask (local server only)
78 * @param letter The snomask letter to write to
79 * @param text A format string containing text to send
80 * @param ... Format arguments
82 void WriteToSnoMask(char letter, const char* text, ...) CUSTOM_PRINTF(3, 4);
84 /** Write to all users with a given snomask (sent globally)
85 * @param letter The snomask letter to write to
86 * @param text The text to send to the users
88 void WriteGlobalSno(char letter, const std::string &text);
90 /** Write to all users with a given snomask (sent globally)
91 * @param letter The snomask letter to write to
92 * @param text A format string containing text to send
93 * @param ... Format arguments
95 void WriteGlobalSno(char letter, const char* text, ...) CUSTOM_PRINTF(3, 4);
98 /** Called once per 5 seconds from the mainloop, this flushes any cached
99 * snotices. The way the caching works is as follows:
100 * Calls to WriteToSnoMask write to a cache, if the call is the same as it was
101 * for the previous call, then a count is incremented. If it is different,
102 * the previous message it just sent normally via NOTICE (with count if > 1)
103 * and the new message is cached. This acts as a sender in case the number of notices
104 * is not particularly significant, in order to keep notices going out.
106 void FlushSnotices();