mirror of
https://github.com/anope/anope.git
synced 2026-06-12 18:54:47 +02:00
86 lines
1.9 KiB
C++
86 lines
1.9 KiB
C++
// Anope IRC Services <https://www.anope.org/>
|
|
//
|
|
// Copyright (C) 2003-2026 Anope Contributors
|
|
//
|
|
// Anope is free software. You can use, modify, and/or distribute it under the
|
|
// terms of version 2 of the GNU General Public License. See docs/LICENSE.txt
|
|
// for the complete terms of this license and docs/AUTHORS.txt for a list of
|
|
// contributors.
|
|
//
|
|
// Based on the original code of Epona by Lara
|
|
// Based on the original code of Services by Andy Church
|
|
//
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
|
#pragma once
|
|
|
|
#define BOTSERV_BAD_WORDS_EXT "badwords"
|
|
#define BOTSERV_BAD_WORDS_TYPE "BadWord"
|
|
|
|
namespace BotServ
|
|
{
|
|
class BadWord;
|
|
struct BadWords;
|
|
|
|
/** Flags for badwords. */
|
|
enum BadWordType
|
|
{
|
|
/* Always kicks if the word is said */
|
|
BW_ANY,
|
|
/* User must way the entire word */
|
|
BW_SINGLE,
|
|
/* The word has to start with the badword */
|
|
BW_START,
|
|
/* The word has to end with the badword */
|
|
BW_END
|
|
};
|
|
}
|
|
|
|
/* Structure used to contain bad words. */
|
|
class BotServ::BadWord
|
|
{
|
|
protected:
|
|
BadWord() = default;
|
|
|
|
public:
|
|
Anope::string chan;
|
|
Anope::string word;
|
|
BotServ::BadWordType type;
|
|
|
|
virtual ~BadWord() = default;
|
|
};
|
|
|
|
struct BotServ::BadWords
|
|
{
|
|
virtual ~BadWords() = default;
|
|
|
|
/** Add a badword to the badword list
|
|
* @param word The badword
|
|
* @param type The type (SINGLE START END)
|
|
* @return The badword
|
|
*/
|
|
virtual BotServ::BadWord *AddBadWord(const Anope::string &word, BotServ::BadWordType type) = 0;
|
|
|
|
/** Get a badword structure by index
|
|
* @param index The index
|
|
* @return The badword
|
|
*/
|
|
virtual BotServ::BadWord *GetBadWord(unsigned index) const = 0;
|
|
|
|
/** Get how many badwords are on this channel
|
|
* @return The number of badwords in the vector
|
|
*/
|
|
virtual unsigned GetBadWordCount() const = 0;
|
|
|
|
/** Remove a badword
|
|
* @param index The index of the badword
|
|
*/
|
|
virtual void EraseBadWord(unsigned index) = 0;
|
|
|
|
/** Clear all badwords from the channel
|
|
*/
|
|
virtual void ClearBadWords() = 0;
|
|
|
|
virtual void Check() = 0;
|
|
};
|