From 88330c07adc5bb3b085cf6ede1d30c0c48afcfb6 Mon Sep 17 00:00:00 2001 From: Adam- Date: Tue, 17 Nov 2009 03:15:31 +0000 Subject: Cleand up alot of the code in bs_badwords, made it much more C++-ish git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2654 5417fbe8-f217-4b02-8779-1006273d7864 --- include/regchannel.h | 34 ++++++++++++++++++++++++++++++---- include/services.h | 3 +-- 2 files changed, 31 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/regchannel.h b/include/regchannel.h index b6d380f40..7ce3151a6 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -63,8 +63,9 @@ class CoreExport ChannelInfo : public Extensible, public Flags { private: std::map Params; /* Map of parameters by mode name */ - std::vector access; /* List of authorized users */ - std::vector akick; /* List of users to kickban */ + std::vector access; /* List of authorized users */ + std::vector akick; /* List of users to kickban */ + std::vector badwords; /* List of badwords */ std::bitset<128> mlock_on; /* Modes mlocked on */ std::bitset<128> mlock_off; /* Modes mlocked off */ @@ -112,8 +113,6 @@ class CoreExport ChannelInfo : public Extensible, public Flags Flags botflags; int16 *ttb; /* Times to ban for each kicker */ - uint16 bwcount; - BadWord *badwords; /* For BADWORDS kicker */ int16 capsmin, capspercent; /* For CAPS kicker */ int16 floodlines, floodsecs; /* For FLOOD kicker */ int16 repeattimes; /* For REPEAT kicker */ @@ -209,6 +208,33 @@ class CoreExport ChannelInfo : public Extensible, public Flags */ void ClearAkick(); + /** Add a badword to the badword list + * @param word The badword + * @param type The type (SINGLE START END) + * @return The badword + */ + BadWord *AddBadWord(const std::string &word, BadWordType type); + + /** Get a badword structure by index + * @param index The index + * @return The badword + */ + BadWord *GetBadWord(unsigned index); + + /** Get how many badwords are on this channel + * @return The number of badwords in the vector + */ + const unsigned GetBadWordCount() const; + + /** Remove a badword + * @param badword The badword + */ + void EraseBadWord(BadWord *badword); + + /** Clear all badwords from the channel + */ + void ClearBadWords(); + /** Check if a mode is mlocked * @param Name The mode * @param status True to check mlock on, false for mlock off diff --git a/include/services.h b/include/services.h index 8ec13d225..1c0c5f6ea 100644 --- a/include/services.h +++ b/include/services.h @@ -746,8 +746,7 @@ enum BadWordType /* Structure used to contain bad words. */ struct BadWord { - uint16 in_use; - char *word; + std::string word; BadWordType type; }; -- cgit