diff options
Diffstat (limited to 'include/modules/botserv')
| -rw-r--r-- | include/modules/botserv/badwords.h | 102 | ||||
| -rw-r--r-- | include/modules/botserv/bot.h | 38 | ||||
| -rw-r--r-- | include/modules/botserv/info.h | 21 | ||||
| -rw-r--r-- | include/modules/botserv/kick.h | 132 |
4 files changed, 293 insertions, 0 deletions
diff --git a/include/modules/botserv/badwords.h b/include/modules/botserv/badwords.h new file mode 100644 index 000000000..87986ee62 --- /dev/null +++ b/include/modules/botserv/badwords.h @@ -0,0 +1,102 @@ +/* BotServ core functions + * + * (C) 2003-2014 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. + * + * + */ + +/** Flags for badwords + */ +enum BadWordType +{ + /* Always kicks if the word is said */ + BW_ANY, + /* User must say 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 BadWord : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + public: + virtual ~BadWord() = default; + + virtual ChanServ::Channel *GetChannel() anope_abstract; + virtual void SetChannel(ChanServ::Channel *) anope_abstract; + + virtual Anope::string GetWord() anope_abstract; + virtual void SetWord(const Anope::string &) anope_abstract; + + virtual BadWordType GetType() anope_abstract; + virtual void SetType(const BadWordType &) anope_abstract; +}; + +static Serialize::TypeReference<BadWord> badword("BadWord"); + +struct BadWords : public Service +{ + BadWords(Module *me) : Service(me, "BadWords", "badwords") { } + + /** Add a badword to the badword list + * @param word The badword + * @param type The type (SINGLE START END) + * @return The badword + */ + virtual BadWord* AddBadWord(ChanServ::Channel *, const Anope::string &word, BadWordType type) anope_abstract; + + virtual std::vector<BadWord *> GetBadWords(ChanServ::Channel *ci) anope_abstract; + + /** Get a badword structure by index + * @param index The index + * @return The badword + */ + virtual BadWord* GetBadWord(ChanServ::Channel *, unsigned index) anope_abstract; + + /** Get how many badwords are on this channel + * @return The number of badwords in the vector + */ + virtual unsigned GetBadWordCount(ChanServ::Channel *) anope_abstract; + + /** Remove a badword + * @param index The index of the badword + */ + virtual void EraseBadWord(ChanServ::Channel *, unsigned index) anope_abstract; + + /** Clear all badwords from the channel + */ + virtual void ClearBadWords(ChanServ::Channel *) anope_abstract; +}; + +static ServiceReference<BadWords> badwords("BadWords", "badwords"); + +namespace Event +{ + struct CoreExport BadWordEvents : Events + { + /** Called before a badword is added to the badword list + * @param ci The channel + * @param bw The badword + */ + virtual void OnBadWordAdd(ChanServ::Channel *ci, const BadWord *bw) anope_abstract; + + /** Called before a badword is deleted from a channel + * @param ci The channel + * @param bw The badword + */ + virtual void OnBadWordDel(ChanServ::Channel *ci, const BadWord *bw) anope_abstract; + }; +} + +template<> struct EventName<Event::BadWordEvents> { static constexpr const char *const name = "Badwords"; }; diff --git a/include/modules/botserv/bot.h b/include/modules/botserv/bot.h new file mode 100644 index 000000000..fe6534309 --- /dev/null +++ b/include/modules/botserv/bot.h @@ -0,0 +1,38 @@ +/* + * (C) 2014 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + */ + +namespace Event +{ + struct CoreExport BotCreate : Events + { + /** Called when a new bot is made + * @param bi The bot + */ + virtual void OnBotCreate(ServiceBot *bi) anope_abstract; + }; + + struct CoreExport BotChange : Events + { + /** Called when a bot is changed + * @param bi The bot + */ + virtual void OnBotChange(ServiceBot *bi) anope_abstract; + }; + + struct CoreExport BotDelete : Events + { + /** Called when a bot is deleted + * @param bi The bot + */ + virtual void OnBotDelete(ServiceBot *bi) anope_abstract; + }; +} + +template<> struct EventName<Event::BotCreate> { static constexpr const char *const name = "OnBotCreate"; }; +template<> struct EventName<Event::BotChange> { static constexpr const char *const name = "OnBotChange"; }; +template<> struct EventName<Event::BotDelete> { static constexpr const char *const name = "OnBotDelete"; }; diff --git a/include/modules/botserv/info.h b/include/modules/botserv/info.h new file mode 100644 index 000000000..1ebd58c89 --- /dev/null +++ b/include/modules/botserv/info.h @@ -0,0 +1,21 @@ +/* + * + * (C) 2014 Anope Team + * Contact us at team@anope.org + * + * Please read COPYING and README for further details. + * + */ + +namespace Event +{ + struct CoreExport ServiceBotEvent : Events + { + /** Called when a user uses botserv/info on a bot or channel. + */ + virtual void OnServiceBot(CommandSource &source, ServiceBot *bi, ChanServ::Channel *ci, InfoFormatter &info) anope_abstract; + }; + extern CoreExport EventHandlers<ServiceBotEvent> OnServiceBot; +} + +template<> struct EventName<Event::ServiceBotEvent> { static constexpr const char *const name = "OnServiceBot"; }; diff --git a/include/modules/botserv/kick.h b/include/modules/botserv/kick.h new file mode 100644 index 000000000..1346d7427 --- /dev/null +++ b/include/modules/botserv/kick.h @@ -0,0 +1,132 @@ +/* BotServ core functions + * + * (C) 2003-2014 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. + * + * + */ + +class KickerData : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + virtual ChanServ::Channel *GetChannel() anope_abstract; + virtual void SetChannel(ChanServ::Channel *) anope_abstract; + + virtual bool GetAmsgs() anope_abstract; + virtual void SetAmsgs(const bool &) anope_abstract; + + virtual bool GetBadwords() anope_abstract; + virtual void SetBadwords(const bool &) anope_abstract; + + virtual bool GetBolds() anope_abstract; + virtual void SetBolds(const bool &) anope_abstract; + + virtual bool GetCaps() anope_abstract; + virtual void SetCaps(const bool &) anope_abstract; + + virtual bool GetColors() anope_abstract; + virtual void SetColors(const bool &) anope_abstract; + + virtual bool GetFlood() anope_abstract; + virtual void SetFlood(const bool &) anope_abstract; + + virtual bool GetItalics() anope_abstract; + virtual void SetItalics(const bool &) anope_abstract; + + virtual bool GetRepeat() anope_abstract; + virtual void SetRepeat(const bool &) anope_abstract; + + virtual bool GetReverses() anope_abstract; + virtual void SetReverses(const bool &) anope_abstract; + + virtual bool GetUnderlines() anope_abstract; + virtual void SetUnderlines(const bool &) anope_abstract; + + virtual int16_t GetTTBBolds() anope_abstract; + virtual void SetTTBBolds(const int16_t &) anope_abstract; + + virtual int16_t GetTTBColors() anope_abstract; + virtual void SetTTBColors(const int16_t &) anope_abstract; + + virtual int16_t GetTTBReverses() anope_abstract; + virtual void SetTTBReverses(const int16_t &) anope_abstract; + + virtual int16_t GetTTBUnderlines() anope_abstract; + virtual void SetTTBUnderlines(const int16_t &) anope_abstract; + + virtual int16_t GetTTBBadwords() anope_abstract; + virtual void SetTTBBadwords(const int16_t &) anope_abstract; + + virtual int16_t GetTTBCaps() anope_abstract; + virtual void SetTTBCaps(const int16_t &) anope_abstract; + + virtual int16_t GetTTBFlood() anope_abstract; + virtual void SetTTBFlood(const int16_t &) anope_abstract; + + virtual int16_t GetTTBRepeat() anope_abstract; + virtual void SetTTBRepeat(const int16_t &) anope_abstract; + + virtual int16_t GetTTBItalics() anope_abstract; + virtual void SetTTBItalics(const int16_t &) anope_abstract; + + virtual int16_t GetTTBAmsgs() anope_abstract; + virtual void SetTTBAmsgs(const int16_t &) anope_abstract; + + virtual int16_t GetCapsMin() anope_abstract; + virtual void SetCapsMin(const int16_t &) anope_abstract; + + virtual int16_t GetCapsPercent() anope_abstract; + virtual void SetCapsPercent(const int16_t &) anope_abstract; + + virtual int16_t GetFloodLines() anope_abstract; + virtual void SetFloodLines(const int16_t &) anope_abstract; + + virtual int16_t GetFloodSecs() anope_abstract; + virtual void SetFloodSecs(const int16_t &) anope_abstract; + + virtual int16_t GetRepeatTimes() anope_abstract; + virtual void SetRepeatTimes(const int16_t &) anope_abstract; + + virtual bool GetDontKickOps() anope_abstract; + virtual void SetDontKickOps(const bool &) anope_abstract; + + virtual bool GetDontKickVoices() anope_abstract; + virtual void SetDontKickVoices(const bool &) anope_abstract; +}; + +static Serialize::TypeReference<KickerData> kickerdata("KickerData"); + +inline KickerData *GetKickerData(ChanServ::Channel *ci) +{ + KickerData *kd = ci->GetRef<KickerData *>(kickerdata); + if (!kd && kickerdata) + { + kd = kickerdata.Create(); + kd->SetChannel(ci); + } + return kd; +} + +namespace Event +{ + struct CoreExport BotBan : Events + { + /** Called when a bot places a ban + * @param u User being banned + * @param ci Channel the ban is placed on + * @param mask The mask being banned + */ + virtual void OnBotBan(User *u, ChanServ::Channel *ci, const Anope::string &mask) anope_abstract; + }; +} + +template<> struct EventName<Event::BotBan> { static constexpr const char *const name = "OnBotBan"; }; + |
