From df0cd3ef3e9a5cd1230aebdb45569f54512373ad Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Sat, 8 Mar 2025 12:22:07 +0000 Subject: Move some headers around. --- include/modules/botserv/badwords.h | 72 ++++++++++++++++++++++++++++++++++++++ include/modules/botserv/kick.h | 46 ++++++++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100644 include/modules/botserv/badwords.h create mode 100644 include/modules/botserv/kick.h (limited to 'include/modules/botserv') diff --git a/include/modules/botserv/badwords.h b/include/modules/botserv/badwords.h new file mode 100644 index 000000000..ae78df8b1 --- /dev/null +++ b/include/modules/botserv/badwords.h @@ -0,0 +1,72 @@ +/* BotServ core functions + * + * (C) 2003-2025 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + */ + +#pragma once + +/** 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. */ +struct BadWord +{ + Anope::string chan; + Anope::string word; + BadWordType type; + + virtual ~BadWord() = default; +protected: + BadWord() = default; +}; + +struct 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 BadWord *AddBadWord(const Anope::string &word, BadWordType type) = 0; + + /** Get a badword structure by index + * @param index The index + * @return The badword + */ + virtual 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; +}; diff --git a/include/modules/botserv/kick.h b/include/modules/botserv/kick.h new file mode 100644 index 000000000..8ad44aab5 --- /dev/null +++ b/include/modules/botserv/kick.h @@ -0,0 +1,46 @@ +/* BotServ core functions + * + * (C) 2003-2025 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + * Based on the original code of Epona by Lara. + * Based on the original code of Services by Andy Church. + */ + +#pragma once + +/* Indices for TTB (Times To Ban) */ +enum +{ + TTB_BOLDS, + TTB_COLORS, + TTB_REVERSES, + TTB_UNDERLINES, + TTB_BADWORDS, + TTB_CAPS, + TTB_FLOOD, + TTB_REPEAT, + TTB_ITALICS, + TTB_AMSGS, + TTB_SIZE +}; + +struct KickerData +{ + bool amsgs, badwords, bolds, caps, colors, flood, italics, repeat, reverses, underlines; + int16_t ttb[TTB_SIZE]; /* Times to ban for each kicker */ + int16_t capsmin, capspercent; /* For CAPS kicker */ + int16_t floodlines, floodsecs; /* For FLOOD kicker */ + int16_t repeattimes; /* For REPEAT kicker */ + + bool dontkickops, dontkickvoices; + +protected: + KickerData() = default; + +public: + virtual ~KickerData() = default; + virtual void Check(ChannelInfo *ci) = 0; +}; -- cgit