diff options
Diffstat (limited to 'include/modules/operserv')
| -rw-r--r-- | include/modules/operserv/defcon.h | 34 | ||||
| -rw-r--r-- | include/modules/operserv/dns.h | 83 | ||||
| -rw-r--r-- | include/modules/operserv/forbid.h | 68 | ||||
| -rw-r--r-- | include/modules/operserv/ignore.h | 49 | ||||
| -rw-r--r-- | include/modules/operserv/info.h | 42 | ||||
| -rw-r--r-- | include/modules/operserv/news.h | 47 | ||||
| -rw-r--r-- | include/modules/operserv/session.h | 97 | ||||
| -rw-r--r-- | include/modules/operserv/stats.h | 35 |
8 files changed, 455 insertions, 0 deletions
diff --git a/include/modules/operserv/defcon.h b/include/modules/operserv/defcon.h new file mode 100644 index 000000000..5c7e2710c --- /dev/null +++ b/include/modules/operserv/defcon.h @@ -0,0 +1,34 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2014-2017 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. + */ + +namespace Event +{ + struct CoreExport DefconLevel : Events + { + static constexpr const char *NAME = "defconlevel"; + + using Events::Events; + + /** Called when defcon level changes + * @param level The level + */ + virtual void OnDefconLevel(int level) anope_abstract; + }; +} + diff --git a/include/modules/operserv/dns.h b/include/modules/operserv/dns.h new file mode 100644 index 000000000..bfacb0224 --- /dev/null +++ b/include/modules/operserv/dns.h @@ -0,0 +1,83 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2014-2017 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. + */ + +class DNSZone : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + static constexpr const char *const NAME = "dnszone"; + + virtual Anope::string GetName() anope_abstract; + virtual void SetName(const Anope::string &) anope_abstract; +}; + +class DNSServer : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + static constexpr const char *const NAME = "dnsserver"; + + virtual DNSZone *GetZone() anope_abstract; + virtual void SetZone(DNSZone *) anope_abstract; + + virtual Anope::string GetName() anope_abstract; + virtual void SetName(const Anope::string &) anope_abstract; + + virtual unsigned int GetLimit() anope_abstract; + virtual void SetLimit(unsigned int) anope_abstract; + + virtual bool GetPooled() anope_abstract; + virtual void SetPool(bool) anope_abstract; +}; + +class DNSZoneMembership : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + static constexpr const char *const NAME = "dnszonemembership"; + + virtual DNSServer *GetServer() anope_abstract; + virtual void SetServer(DNSServer *) anope_abstract; + + virtual DNSZone *GetZone() anope_abstract; + virtual void SetZone(DNSZone *) anope_abstract; +}; + +class DNSIP : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + static constexpr const char *const NAME = "dnsip"; + + virtual DNSServer *GetServer() anope_abstract; + virtual void SetServer(DNSServer *) anope_abstract; + + virtual Anope::string GetIP() anope_abstract; + virtual void SetIP(const Anope::string &) anope_abstract; +}; + + diff --git a/include/modules/operserv/forbid.h b/include/modules/operserv/forbid.h new file mode 100644 index 000000000..41ef3e6af --- /dev/null +++ b/include/modules/operserv/forbid.h @@ -0,0 +1,68 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2013-2017 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. + */ + +enum ForbidType +{ + FT_NICK = 1, + FT_CHAN, + FT_EMAIL, + FT_REGISTER, + FT_SIZE +}; + +class ForbidData : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + static constexpr const char *NAME = "forbid"; + + virtual Anope::string GetMask() anope_abstract; + virtual void SetMask(const Anope::string &) anope_abstract; + + virtual Anope::string GetCreator() anope_abstract; + virtual void SetCreator(const Anope::string &) anope_abstract; + + virtual Anope::string GetReason() anope_abstract; + virtual void SetReason(const Anope::string &) anope_abstract; + + virtual time_t GetCreated() anope_abstract; + virtual void SetCreated(const time_t &) anope_abstract; + + virtual time_t GetExpires() anope_abstract; + virtual void SetExpires(const time_t &) anope_abstract; + + virtual ForbidType GetType() anope_abstract; + virtual void SetType(ForbidType) anope_abstract; +}; + +class ForbidService : public Service +{ + public: + static constexpr const char *NAME = "forbid"; + + ForbidService(Module *m) : Service(m, NAME) { } + + virtual ForbidData *FindForbid(const Anope::string &mask, ForbidType type) anope_abstract; + + virtual std::vector<ForbidData *> GetForbids() anope_abstract; +}; + + diff --git a/include/modules/operserv/ignore.h b/include/modules/operserv/ignore.h new file mode 100644 index 000000000..e7405dde1 --- /dev/null +++ b/include/modules/operserv/ignore.h @@ -0,0 +1,49 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2013-2017 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. + */ + +class Ignore : public Serialize::Object +{ + public: + static constexpr const char *NAME = "ignore"; + + using Serialize::Object::Object; + + virtual Anope::string GetMask() anope_abstract; + virtual void SetMask(const Anope::string &) anope_abstract; + + virtual Anope::string GetCreator() anope_abstract; + virtual void SetCreator(const Anope::string &) anope_abstract; + + virtual Anope::string GetReason() anope_abstract; + virtual void SetReason(const Anope::string &) anope_abstract; + + virtual time_t GetTime() anope_abstract; + virtual void SetTime(const time_t &) anope_abstract; +}; + +class IgnoreService : public Service +{ + public: + static constexpr const char *NAME = "ignore"; + + IgnoreService(Module *c) : Service(c, NAME) { } + + virtual Ignore *Find(const Anope::string &mask) anope_abstract; +}; + diff --git a/include/modules/operserv/info.h b/include/modules/operserv/info.h new file mode 100644 index 000000000..b8a8f4c5d --- /dev/null +++ b/include/modules/operserv/info.h @@ -0,0 +1,42 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2014-2017 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. + */ + +class OperInfo : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + static constexpr const char *const NAME = "operinfo"; + + virtual NickServ::Account *GetAccount() anope_abstract; + virtual void SetAccount(NickServ::Account *) anope_abstract; + + virtual ChanServ::Channel *GetChannel() anope_abstract; + virtual void SetChannel(ChanServ::Channel *) anope_abstract; + + virtual Anope::string GetInfo() anope_abstract; + virtual void SetInfo(const Anope::string &) anope_abstract; + + virtual Anope::string GetCreator() anope_abstract; + virtual void SetCreator(const Anope::string &) anope_abstract; + + virtual time_t GetCreated() anope_abstract; + virtual void SetCreated(const time_t &) anope_abstract; +}; diff --git a/include/modules/operserv/news.h b/include/modules/operserv/news.h new file mode 100644 index 000000000..ecb020a00 --- /dev/null +++ b/include/modules/operserv/news.h @@ -0,0 +1,47 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2013-2017 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +enum NewsType +{ + NEWS_LOGON, + NEWS_RANDOM, + NEWS_OPER +}; + +class NewsItem : public Serialize::Object +{ + public: + static constexpr const char *const NAME = "newsitem"; + + using Serialize::Object::Object; + + virtual NewsType GetNewsType() anope_abstract; + virtual void SetNewsType(NewsType) anope_abstract; + + virtual Anope::string GetText() anope_abstract; + virtual void SetText(const Anope::string &) anope_abstract; + + virtual Anope::string GetWho() anope_abstract; + virtual void SetWho(const Anope::string &) anope_abstract; + + virtual time_t GetTime() anope_abstract; + virtual void SetTime(const time_t &) anope_abstract; +}; diff --git a/include/modules/operserv/session.h b/include/modules/operserv/session.h new file mode 100644 index 000000000..b854d7191 --- /dev/null +++ b/include/modules/operserv/session.h @@ -0,0 +1,97 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2013-2017 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +struct Session +{ + cidr addr; /* A cidr (sockaddrs + len) representing this session */ + unsigned int count = 1; /* Number of clients with this host */ + unsigned int hits = 0; /* Number of subsequent kills for a host */ + + Session(const sockaddrs &ip, int len) : addr(ip, len) { } +}; + +class Exception : public Serialize::Object +{ + protected: + using Serialize::Object::Object; + + public: + static constexpr const char *NAME = "exception"; + + virtual Anope::string GetMask() anope_abstract; + virtual void SetMask(const Anope::string &) anope_abstract; + + virtual unsigned int GetLimit() anope_abstract; + virtual void SetLimit(unsigned int) anope_abstract; + + virtual Anope::string GetWho() anope_abstract; + virtual void SetWho(const Anope::string &) anope_abstract; + + virtual Anope::string GetReason() anope_abstract; + virtual void SetReason(const Anope::string &) anope_abstract; + + virtual time_t GetTime() anope_abstract; + virtual void SetTime(const time_t &) anope_abstract; + + virtual time_t GetExpires() anope_abstract; + virtual void SetExpires(const time_t &) anope_abstract; +}; + +class SessionService : public Service +{ + public: + static constexpr const char *NAME = "session"; + + typedef std::unordered_map<cidr, Session *, cidr::hash> SessionMap; + + SessionService(Module *m) : Service(m, NAME) { } + + virtual Exception *FindException(User *u) anope_abstract; + + virtual Exception *FindException(const Anope::string &host) anope_abstract; + + virtual Session *FindSession(const Anope::string &ip) anope_abstract; + + virtual SessionMap &GetSessions() anope_abstract; +}; + +namespace Event +{ + struct CoreExport Exception : Events + { + static constexpr const char *NAME = "exception"; + + using Events::Events; + + /** Called after an exception has been added + * @param ex The exception + * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to halt the command and not process it + */ + virtual EventReturn OnExceptionAdd(::Exception *ex) anope_abstract; + + /** Called before an exception is deleted + * @param source The source deleting it + * @param ex The exceotion + */ + virtual void OnExceptionDel(CommandSource &source, ::Exception *ex) anope_abstract; + }; +} + diff --git a/include/modules/operserv/stats.h b/include/modules/operserv/stats.h new file mode 100644 index 000000000..9e6878c73 --- /dev/null +++ b/include/modules/operserv/stats.h @@ -0,0 +1,35 @@ +/* + * Anope IRC Services + * + * Copyright (C) 2016 Anope Team <team@anope.org> + * + * This file is part of Anope. Anope is free software; you can + * redistribute it and/or modify it under the terms of the GNU + * General Public License as published by the Free Software + * Foundation, version 2. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see see <http://www.gnu.org/licenses/>. + */ + +#pragma once + +class Stats : public Serialize::Object +{ + public: + static constexpr const char *const NAME = "stats"; + + using Serialize::Object::Object; + + virtual unsigned int GetMaxUserCount() anope_abstract; + virtual void SetMaxUserCount(unsigned int i) anope_abstract; + + virtual time_t GetMaxUserTime() anope_abstract; + virtual void SetMaxUserTime(time_t t) anope_abstract; +}; + |
