summaryrefslogtreecommitdiff
path: root/include/modules
diff options
context:
space:
mode:
Diffstat (limited to 'include/modules')
-rw-r--r--include/modules/botserv.h32
-rw-r--r--include/modules/botserv/badwords.h112
-rw-r--r--include/modules/botserv/bot.h58
-rw-r--r--include/modules/botserv/info.h33
-rw-r--r--include/modules/botserv/kick.h141
-rw-r--r--include/modules/bs_badwords.h70
-rw-r--r--include/modules/bs_kick.h44
-rw-r--r--include/modules/chanserv.h98
-rw-r--r--include/modules/chanserv/access.h72
-rw-r--r--include/modules/chanserv/akick.h77
-rw-r--r--include/modules/chanserv/chanaccess.h110
-rw-r--r--include/modules/chanserv/channel.h235
-rw-r--r--include/modules/chanserv/drop.h35
-rw-r--r--include/modules/chanserv/entrymsg.h41
-rw-r--r--include/modules/chanserv/info.h37
-rw-r--r--include/modules/chanserv/level.h43
-rw-r--r--include/modules/chanserv/log.h51
-rw-r--r--include/modules/chanserv/main/chanaccess.h50
-rw-r--r--include/modules/chanserv/mode.h157
-rw-r--r--include/modules/chanserv/privilege.h93
-rw-r--r--include/modules/chanserv/set.h38
-rw-r--r--include/modules/chanserv/set_misc.h36
-rw-r--r--include/modules/chanserv/suspend.h69
-rw-r--r--include/modules/cs_entrymsg.h34
-rw-r--r--include/modules/cs_log.h42
-rw-r--r--include/modules/cs_mode.h89
-rw-r--r--include/modules/dns.h66
-rw-r--r--include/modules/encryption.h33
-rw-r--r--include/modules/fantasy.h54
-rw-r--r--include/modules/global.h40
-rw-r--r--include/modules/help.h42
-rw-r--r--include/modules/hostserv.h98
-rw-r--r--include/modules/hostserv/del.h34
-rw-r--r--include/modules/httpd.h61
-rw-r--r--include/modules/ldap.h38
-rw-r--r--include/modules/memoserv.h171
-rw-r--r--include/modules/nickserv.h214
-rw-r--r--include/modules/nickserv/access.h34
-rw-r--r--include/modules/nickserv/account.h125
-rw-r--r--include/modules/nickserv/ajoin.h37
-rw-r--r--include/modules/nickserv/cert.h76
-rw-r--r--include/modules/nickserv/drop.h35
-rw-r--r--include/modules/nickserv/group.h35
-rw-r--r--include/modules/nickserv/info.h37
-rw-r--r--include/modules/nickserv/nick.h63
-rw-r--r--include/modules/nickserv/set.h38
-rw-r--r--include/modules/nickserv/set_misc.h37
-rw-r--r--include/modules/nickserv/suspend.h69
-rw-r--r--include/modules/nickserv/update.h34
-rw-r--r--include/modules/ns_cert.h70
-rw-r--r--include/modules/operserv/defcon.h34
-rw-r--r--include/modules/operserv/dns.h83
-rw-r--r--include/modules/operserv/forbid.h68
-rw-r--r--include/modules/operserv/ignore.h49
-rw-r--r--include/modules/operserv/info.h42
-rw-r--r--include/modules/operserv/news.h47
-rw-r--r--include/modules/operserv/session.h97
-rw-r--r--include/modules/operserv/stats.h35
-rw-r--r--include/modules/os_forbid.h53
-rw-r--r--include/modules/os_ignore.h43
-rw-r--r--include/modules/os_news.h52
-rw-r--r--include/modules/os_session.h94
-rw-r--r--include/modules/protocol/bahamut.h270
-rw-r--r--include/modules/protocol/charybdis.h144
-rw-r--r--include/modules/protocol/hybrid.h367
-rw-r--r--include/modules/protocol/inspircd20.h506
-rw-r--r--include/modules/protocol/ngircd.h213
-rw-r--r--include/modules/protocol/plexus.h157
-rw-r--r--include/modules/protocol/ratbox.h152
-rw-r--r--include/modules/protocol/rfc1459.h355
-rw-r--r--include/modules/protocol/ts6.h37
-rw-r--r--include/modules/protocol/unreal.h430
-rw-r--r--include/modules/pseudoclients/chanserv.h25
-rw-r--r--include/modules/pseudoclients/global.h27
-rw-r--r--include/modules/pseudoclients/memoserv.h41
-rw-r--r--include/modules/pseudoclients/nickserv.h24
-rw-r--r--include/modules/redis.h59
-rw-r--r--include/modules/sasl.h126
-rw-r--r--include/modules/set_misc.h17
-rw-r--r--include/modules/sql.h183
-rw-r--r--include/modules/ssl.h26
-rw-r--r--include/modules/suspend.h19
-rw-r--r--include/modules/xmlrpc.h36
83 files changed, 6347 insertions, 1002 deletions
diff --git a/include/modules/botserv.h b/include/modules/botserv.h
new file mode 100644
index 000000000..17422d0ae
--- /dev/null
+++ b/include/modules/botserv.h
@@ -0,0 +1,32 @@
+/*
+ * 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/>.
+ */
+
+#pragma once
+
+namespace BotServ
+{
+ class BotServService : public Service
+ {
+ public:
+ BotServService(Module *m) : Service(m, "BotServService", "BotServ")
+ {
+ }
+
+ };
+}
diff --git a/include/modules/botserv/badwords.h b/include/modules/botserv/badwords.h
new file mode 100644
index 000000000..69c68e6b4
--- /dev/null
+++ b/include/modules/botserv/badwords.h
@@ -0,0 +1,112 @@
+/*
+ * 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/>.
+ */
+
+/** 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:
+ static constexpr const char *NAME = "badword";
+
+ 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(BadWordType) anope_abstract;
+};
+
+class BadWords : public Service
+{
+ public:
+ static constexpr const char *NAME = "badwords";
+
+ BadWords(Module *me) : Service(me, NAME) { }
+
+ /** 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;
+};
+
+namespace Event
+{
+ struct CoreExport BadWordEvents : Events
+ {
+ static constexpr const char *NAME = "badwords";
+
+ using Events::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;
+ };
+}
+
diff --git a/include/modules/botserv/bot.h b/include/modules/botserv/bot.h
new file mode 100644
index 000000000..9ee5254a7
--- /dev/null
+++ b/include/modules/botserv/bot.h
@@ -0,0 +1,58 @@
+/*
+ * 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 BotCreate : Events
+ {
+ static constexpr const char *NAME = "botcreate";
+
+ using Events::Events;
+
+ /** Called when a new bot is made
+ * @param bi The bot
+ */
+ virtual void OnBotCreate(ServiceBot *bi) anope_abstract;
+ };
+
+ struct CoreExport BotChange : Events
+ {
+ static constexpr const char *NAME = "botchange";
+
+ using Events::Events;
+
+ /** Called when a bot is changed
+ * @param bi The bot
+ */
+ virtual void OnBotChange(ServiceBot *bi) anope_abstract;
+ };
+
+ struct CoreExport BotDelete : Events
+ {
+ static constexpr const char *NAME = "botdelete";
+
+ using Events::Events;
+
+ /** Called when a bot is deleted
+ * @param bi The bot
+ */
+ virtual void OnBotDelete(ServiceBot *bi) anope_abstract;
+ };
+}
+
diff --git a/include/modules/botserv/info.h b/include/modules/botserv/info.h
new file mode 100644
index 000000000..428110f9a
--- /dev/null
+++ b/include/modules/botserv/info.h
@@ -0,0 +1,33 @@
+/*
+ * 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 ServiceBotEvent : Events
+ {
+ static constexpr const char *NAME = "servicebotevent";
+
+ using Events::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;
+ };
+}
+
diff --git a/include/modules/botserv/kick.h b/include/modules/botserv/kick.h
new file mode 100644
index 000000000..20b90ad08
--- /dev/null
+++ b/include/modules/botserv/kick.h
@@ -0,0 +1,141 @@
+/*
+ * 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 KickerData : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "kickerdata";
+
+ 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;
+};
+
+inline KickerData *GetKickerData(ChanServ::Channel *ci)
+{
+ KickerData *kd = ci->GetRef<KickerData *>();
+ if (!kd)
+ {
+ kd = Serialize::New<KickerData *>();
+ if (kd != nullptr)
+ {
+ kd->SetChannel(ci);
+ }
+ }
+ return kd;
+}
+
+namespace Event
+{
+ struct CoreExport BotBan : Events
+ {
+ static constexpr const char *NAME = "botban";
+
+ using Events::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;
+ };
+}
diff --git a/include/modules/bs_badwords.h b/include/modules/bs_badwords.h
deleted file mode 100644
index f4b1058f6..000000000
--- a/include/modules/bs_badwords.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* BotServ core functions
- *
- * (C) 2003-2017 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 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() { }
- protected:
- BadWord() { }
-};
-
-struct BadWords
-{
- virtual ~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(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/bs_kick.h b/include/modules/bs_kick.h
deleted file mode 100644
index 8b0de2e91..000000000
--- a/include/modules/bs_kick.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* BotServ core functions
- *
- * (C) 2003-2017 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.
- */
-
-/* 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() { }
-
- public:
- virtual ~KickerData() { }
- virtual void Check(ChannelInfo *ci) = 0;
-};
diff --git a/include/modules/chanserv.h b/include/modules/chanserv.h
new file mode 100644
index 000000000..d2f5f087d
--- /dev/null
+++ b/include/modules/chanserv.h
@@ -0,0 +1,98 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2012-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
+
+#include "event.h"
+#include "channels.h"
+#include "modules/nickserv.h"
+#include "modules/memoserv.h"
+#include "bots.h"
+
+#include "chanserv/channel.h"
+#include "chanserv/privilege.h"
+#include "chanserv/chanaccess.h"
+#include "chanserv/level.h"
+#include "chanserv/mode.h"
+
+namespace ChanServ
+{
+ class Channel;
+ using registered_channel_map = Anope::locale_hash_map<Channel *>;
+
+ class ChanServService : public Service
+ {
+ public:
+ static constexpr const char *NAME = "chanserv";
+
+ ChanServService(Module *m) : Service(m, NAME)
+ {
+ }
+
+ virtual Channel *Find(const Anope::string &name) anope_abstract;
+ virtual registered_channel_map& GetChannels() anope_abstract;
+
+ /* Have ChanServ hold the channel, that is, join and set +nsti and wait
+ * for a few minutes so no one can join or rejoin.
+ */
+ virtual void Hold(::Channel *c) anope_abstract;
+
+ virtual void AddPrivilege(Privilege p) anope_abstract;
+ virtual void RemovePrivilege(Privilege &p) anope_abstract;
+ virtual Privilege *FindPrivilege(const Anope::string &name) anope_abstract;
+ virtual std::vector<Privilege> &GetPrivileges() anope_abstract;
+ virtual void ClearPrivileges() anope_abstract;
+ };
+
+ extern ChanServService *service;
+
+ inline Channel *Find(const Anope::string name)
+ {
+ return service ? service->Find(name) : nullptr;
+ }
+
+ namespace Event
+ {
+ struct CoreExport PreChanExpire : Events
+ {
+ static constexpr const char *NAME = "prechanexpire";
+
+ using Events::Events;
+
+ /** Called before a channel expires
+ * @param ci The channel
+ * @param expire Set to true to allow the chan to expire
+ */
+ virtual void OnPreChanExpire(Channel *ci, bool &expire) anope_abstract;
+ };
+
+ struct CoreExport ChanExpire : Events
+ {
+ static constexpr const char *NAME = "chanexpire";
+
+ using Events::Events;
+
+ /** Called before a channel expires
+ * @param ci The channel
+ */
+ virtual void OnChanExpire(Channel *ci) anope_abstract;
+ };
+ }
+}
+
diff --git a/include/modules/chanserv/access.h b/include/modules/chanserv/access.h
new file mode 100644
index 000000000..fc1721e39
--- /dev/null
+++ b/include/modules/chanserv/access.h
@@ -0,0 +1,72 @@
+/*
+ * 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/>.
+ */
+
+#include "main/chanaccess.h"
+
+namespace Event
+{
+ struct CoreExport LevelChange : Events
+ {
+ static constexpr const char *NAME = "levelchange";
+
+ using Events::Events;
+
+ /** Called when a level for a channel is changed
+ * @param source The source of the command
+ * @param ci The channel the level was changed on
+ * @param priv The privilege changed
+ * @param what The new level
+ */
+ virtual void OnLevelChange(CommandSource &source, ChanServ::Channel *ci, const Anope::string &priv, int16_t what) anope_abstract;
+ };
+}
+
+class AccessChanAccess : public ChanAccessImpl
+{
+ public:
+ static constexpr const char *NAME = "accesschanaccess";
+
+ using ChanAccessImpl::ChanAccessImpl;
+
+ virtual int GetLevel() anope_abstract;
+ virtual void SetLevel(const int &) anope_abstract;
+};
+
+class XOPChanAccess : public ChanAccessImpl
+{
+ public:
+ static constexpr const char *NAME = "xopchanaccess";
+
+ using ChanAccessImpl::ChanAccessImpl;
+
+ virtual const Anope::string &GetType() anope_abstract;
+ virtual void SetType(const Anope::string &) anope_abstract;
+};
+
+class FlagsChanAccess : public ChanAccessImpl
+{
+ public:
+ static constexpr const char *NAME = "flagschanaccess";
+
+ using ChanAccessImpl::ChanAccessImpl;
+
+ virtual const Anope::string &GetFlags() anope_abstract;
+ virtual void SetFlags(const Anope::string &) anope_abstract;
+};
+
diff --git a/include/modules/chanserv/akick.h b/include/modules/chanserv/akick.h
new file mode 100644
index 000000000..c202a36f4
--- /dev/null
+++ b/include/modules/chanserv/akick.h
@@ -0,0 +1,77 @@
+/*
+ * 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/>.
+ */
+
+#include "modules/nickserv.h"
+
+ /* AutoKick data. */
+class CoreExport AutoKick : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+ public:
+ static constexpr const char *const NAME = "akick";
+
+ virtual ~AutoKick() = default;
+
+ virtual ChanServ::Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(ChanServ::Channel *) anope_abstract;
+
+ virtual Anope::string GetMask() anope_abstract;
+ virtual void SetMask(const Anope::string &) anope_abstract;
+
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
+
+ virtual Anope::string GetReason() anope_abstract;
+ virtual void SetReason(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetCreator() anope_abstract;
+ virtual void SetCreator(const Anope::string &) anope_abstract;
+
+ virtual time_t GetAddTime() anope_abstract;
+ virtual void SetAddTime(const time_t &) anope_abstract;
+
+ virtual time_t GetLastUsed() anope_abstract;
+ virtual void SetLastUsed(const time_t &) anope_abstract;
+};
+
+namespace Event
+{
+ struct CoreExport Akick : Events
+ {
+ static constexpr const char *NAME = "akick";
+
+ using Events::Events;
+
+ /** Called after adding an akick to a channel
+ * @param source The source of the command
+ * @param ci The channel
+ * @param ak The akick
+ */
+ virtual void OnAkickAdd(CommandSource &source, ChanServ::Channel *ci, const AutoKick *ak) anope_abstract;
+
+ /** Called before removing an akick from a channel
+ * @param source The source of the command
+ * @param ci The channel
+ * @param ak The akick
+ */
+ virtual void OnAkickDel(CommandSource &source, ChanServ::Channel *ci, const AutoKick *ak) anope_abstract;
+ };
+}
+
diff --git a/include/modules/chanserv/chanaccess.h b/include/modules/chanserv/chanaccess.h
new file mode 100644
index 000000000..df196b79a
--- /dev/null
+++ b/include/modules/chanserv/chanaccess.h
@@ -0,0 +1,110 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2012-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
+
+namespace ChanServ
+{
+
+enum
+{
+ ACCESS_INVALID = -10000,
+ ACCESS_FOUNDER = 10001
+};
+
+/* Represents one entry of an access list on a channel. */
+class CoreExport ChanAccess : public Serialize::Object
+{
+ public:
+ static constexpr const char *const NAME = "access";
+
+ Serialize::Storage<Channel *> channel;
+ Serialize::Storage<NickServ::Account *> account;
+ Serialize::Storage<Anope::string> creator, mask;
+ Serialize::Storage<time_t> last_seen, created;
+
+ using Serialize::Object::Object;
+
+ virtual Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(Channel *ci) anope_abstract;
+
+ virtual Anope::string GetCreator() anope_abstract;
+ virtual void SetCreator(const Anope::string &c) anope_abstract;
+
+ virtual time_t GetLastSeen() anope_abstract;
+ virtual void SetLastSeen(const time_t &t) anope_abstract;
+
+ virtual time_t GetCreated() anope_abstract;
+ virtual void SetCreated(const time_t &t) anope_abstract;
+
+ virtual Anope::string GetMask() anope_abstract;
+ virtual void SetMask(const Anope::string &) anope_abstract;
+
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
+
+ virtual Anope::string Mask() anope_abstract;
+
+ /** Check if this access entry matches the given user or account
+ * @param u The user
+ * @param acc The account
+ */
+ virtual bool Matches(const User *u, NickServ::Account *acc) anope_abstract;
+
+ /** Check if this access entry has the given privilege.
+ * @param name The privilege name
+ */
+ virtual bool HasPriv(const Anope::string &name) anope_abstract;
+
+ /** Serialize the access given by this access entry into a human
+ * readable form. chanserv/access will return a number, chanserv/xop
+ * will be AOP, SOP, etc.
+ */
+ virtual Anope::string AccessSerialize() anope_abstract;
+
+ /** Unserialize this access entry from the given data. This data
+ * will be fetched from AccessSerialize.
+ */
+ virtual void AccessUnserialize(const Anope::string &data) anope_abstract;
+
+ virtual int Compare(ChanAccess *other) anope_abstract;
+
+ /* Comparison operators to other Access entries */
+ bool operator>(ChanAccess &other)
+ {
+ return Compare(&other) > 0;
+ }
+
+ bool operator<(ChanAccess &other)
+ {
+ return Compare(&other) < 0;
+ }
+
+ bool operator>=(ChanAccess &other)
+ {
+ return !(*this < other);
+ }
+
+ bool operator<=(ChanAccess &other)
+ {
+ return !(*this > other);
+ }
+};
+
+} // namespace ChanServ
diff --git a/include/modules/chanserv/channel.h b/include/modules/chanserv/channel.h
new file mode 100644
index 000000000..92f9099d6
--- /dev/null
+++ b/include/modules/chanserv/channel.h
@@ -0,0 +1,235 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2012-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
+
+namespace ChanServ
+{
+
+class CoreExport Channel : public Serialize::Object
+{
+ public:
+ ::Channel *c = nullptr; /* Pointer to channel, if the channel exists */
+
+ static constexpr const char *const NAME = "channel";
+
+ using Serialize::Object::Object;
+
+ virtual Anope::string GetName() anope_abstract;
+ virtual void SetName(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetDesc() anope_abstract;
+ virtual void SetDesc(const Anope::string &) anope_abstract;
+
+ virtual time_t GetTimeRegistered() anope_abstract;
+ virtual void SetTimeRegistered(time_t) anope_abstract;
+
+ virtual time_t GetLastUsed() anope_abstract;
+ virtual void SetLastUsed(time_t) anope_abstract;
+
+ virtual Anope::string GetLastTopic() anope_abstract;
+ virtual void SetLastTopic(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetLastTopicSetter() anope_abstract;
+ virtual void SetLastTopicSetter(const Anope::string &) anope_abstract;
+
+ virtual time_t GetLastTopicTime() anope_abstract;
+ virtual void SetLastTopicTime(time_t) anope_abstract;
+
+ virtual int16_t GetBanType() anope_abstract;
+ virtual void SetBanType(int16_t) anope_abstract;
+
+ virtual time_t GetBanExpire() anope_abstract;
+ virtual void SetBanExpire(time_t) anope_abstract;
+
+ virtual BotInfo *GetBI() anope_abstract;
+ virtual void SetBI(BotInfo *) anope_abstract;
+
+ virtual ServiceBot *GetBot() anope_abstract;
+ virtual void SetBot(ServiceBot *) anope_abstract;
+
+ /** Whether or not greets are enabled.
+ */
+ virtual bool IsGreet() anope_abstract;
+ virtual void SetGreet(bool) anope_abstract;
+
+ /** Whether or not fantasy is enabled.
+ */
+ virtual bool IsFantasy() anope_abstract;
+ virtual void SetFantasy(bool) anope_abstract;
+
+ virtual bool IsNoAutoop() anope_abstract;
+ virtual void SetNoAutoop(bool) anope_abstract;
+
+ virtual bool IsPeace() anope_abstract;
+ virtual void SetPeace(bool) anope_abstract;
+
+ virtual bool IsSecureFounder() anope_abstract;
+ virtual void SetSecureFounder(bool) anope_abstract;
+
+ virtual bool IsRestricted() anope_abstract;
+ virtual void SetRestricted(bool) anope_abstract;
+
+ virtual bool IsSecure() anope_abstract;
+ virtual void SetSecure(bool) anope_abstract;
+
+ virtual bool IsSecureOps() anope_abstract;
+ virtual void SetSecureOps(bool) anope_abstract;
+
+ virtual bool IsSignKick() anope_abstract;
+ virtual void SetSignKick(bool) anope_abstract;
+
+ virtual bool IsSignKickLevel() anope_abstract;
+ virtual void SetSignKickLevel(bool) anope_abstract;
+
+ virtual bool IsNoExpire() anope_abstract;
+ virtual void SetNoExpire(bool) anope_abstract;
+
+ virtual bool IsKeepModes() anope_abstract;
+ virtual void SetKeepModes(bool) anope_abstract;
+
+ virtual bool IsPersist() anope_abstract;
+ virtual void SetPersist(bool) anope_abstract;
+
+ virtual bool IsTopicLock() anope_abstract;
+ virtual void SetTopicLock(bool) anope_abstract;
+
+ virtual bool IsKeepTopic() anope_abstract;
+ virtual void SetKeepTopic(bool) anope_abstract;
+
+ virtual bool IsPrivate() anope_abstract;
+ virtual void SetPrivate(bool) anope_abstract;
+
+ /** Is the user the real founder?
+ * @param user The user
+ * @return true or false
+ */
+ virtual bool IsFounder(const User *user) anope_abstract;
+
+ /** Change the founder of the channel
+ * @params nc The new founder
+ */
+ virtual void SetFounder(NickServ::Account *nc) anope_abstract;
+
+ /** Get the founder of the channel
+ * @return The founder
+ */
+ virtual NickServ::Account *GetFounder() anope_abstract;
+
+ virtual void SetSuccessor(NickServ::Account *nc) anope_abstract;
+ virtual NickServ::Account *GetSuccessor() anope_abstract;
+
+ /** Find which bot should send mode/topic/etc changes for this channel
+ * @return The bot
+ */
+ virtual ServiceBot *WhoSends() anope_abstract;
+
+ /** Get an entry from the channel access list by index
+ *
+ * @param index The index in the access list vector
+ * @return A ChanAccess struct corresponding to the index given, or NULL if outside the bounds
+ *
+ * Retrieves an entry from the access list that matches the given index.
+ */
+ virtual ChanAccess *GetAccess(unsigned index) /*const*/ anope_abstract;
+
+ /** Retrieve the access for a user or group in the form of a vector of access entries
+ * (as multiple entries can affect a single user).
+ */
+ virtual AccessGroup AccessFor(const User *u, bool updateLastUsed = true) anope_abstract;
+ virtual AccessGroup AccessFor(NickServ::Account *nc, bool updateLastUsed = true) anope_abstract;
+
+ /** Get the size of the access vector for this channel
+ * @return The access vector size
+ */
+ virtual unsigned GetAccessCount() anope_abstract;
+
+ /** Clear the entire channel access list
+ *
+ * Clears the entire access list by deleting every item and then clearing the vector.
+ */
+ virtual void ClearAccess() anope_abstract;
+
+ /** Add an akick entry to the channel by NickServ::Account
+ * @param user The user who added the akick
+ * @param akicknc The nickcore being akicked
+ * @param reason The reason for the akick
+ * @param t The time the akick was added, defaults to now
+ * @param lu The time the akick was last used, defaults to never
+ */
+ virtual AutoKick* AddAkick(const Anope::string &user, NickServ::Account *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0) anope_abstract;
+
+ /** Add an akick entry to the channel by reason
+ * @param user The user who added the akick
+ * @param mask The mask of the akick
+ * @param reason The reason for the akick
+ * @param t The time the akick was added, defaults to now
+ * @param lu The time the akick was last used, defaults to never
+ */
+ virtual AutoKick* AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0) anope_abstract;
+
+ /** Get an entry from the channel akick list
+ * @param index The index in the akick vector
+ * @return The akick structure, or NULL if not found
+ */
+ virtual AutoKick* GetAkick(unsigned index) anope_abstract;
+
+ /** Get the size of the akick vector for this channel
+ * @return The akick vector size
+ */
+ virtual unsigned GetAkickCount() anope_abstract;
+
+ /** Clear the whole akick list
+ */
+ virtual void ClearAkick() anope_abstract;
+
+ /** Get the level for a privilege
+ * @param priv The privilege name
+ * @return the level
+ * @throws CoreException if priv is not a valid privilege
+ */
+ virtual int16_t GetLevel(const Anope::string &priv) anope_abstract;
+
+ /** Set the level for a privilege
+ * @param priv The privilege priv
+ * @param level The new level
+ */
+ virtual void SetLevel(const Anope::string &priv, int16_t level) anope_abstract;
+
+ /** Remove a privilege from the channel
+ * @param priv The privilege
+ */
+ virtual void RemoveLevel(const Anope::string &priv) anope_abstract;
+
+ /** Clear all privileges from the channel
+ */
+ virtual void ClearLevels() anope_abstract;
+
+ /** Gets a ban mask for the given user based on the bantype
+ * of the channel.
+ * @param u The user
+ * @return A ban mask that affects the user
+ */
+ virtual Anope::string GetIdealBan(User *u) anope_abstract;
+
+ virtual MemoServ::MemoInfo *GetMemos() anope_abstract;
+};
+
+
+} // namespace ChanServ
diff --git a/include/modules/chanserv/drop.h b/include/modules/chanserv/drop.h
new file mode 100644
index 000000000..dd6acef69
--- /dev/null
+++ b/include/modules/chanserv/drop.h
@@ -0,0 +1,35 @@
+/*
+ * 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 ChanDrop : Events
+ {
+ static constexpr const char *NAME = "chandrop";
+
+ using Events::Events;
+
+ /** Called right before a channel is dropped
+ * @param source The user dropping the channel
+ * @param ci The channel
+ */
+ virtual EventReturn OnChanDrop(CommandSource &source, ChanServ::Channel *ci) anope_abstract;
+ };
+}
+
diff --git a/include/modules/chanserv/entrymsg.h b/include/modules/chanserv/entrymsg.h
new file mode 100644
index 000000000..0ce970890
--- /dev/null
+++ b/include/modules/chanserv/entrymsg.h
@@ -0,0 +1,41 @@
+/*
+ * 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 EntryMsg : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "entrymsg";
+
+ virtual ChanServ::Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(ChanServ::Channel *) anope_abstract;
+
+ virtual Anope::string GetCreator() anope_abstract;
+ virtual void SetCreator(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetMessage() anope_abstract;
+ virtual void SetMessage(const Anope::string &) anope_abstract;
+
+ virtual time_t GetWhen() anope_abstract;
+ virtual void SetWhen(const time_t &) anope_abstract;
+};
+
+
diff --git a/include/modules/chanserv/info.h b/include/modules/chanserv/info.h
new file mode 100644
index 000000000..504cfca93
--- /dev/null
+++ b/include/modules/chanserv/info.h
@@ -0,0 +1,37 @@
+/*
+ * 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 ChanInfo : Events
+ {
+ static constexpr const char *NAME = "chaninfo";
+
+ using Events::Events;
+
+ /** Called when a user requests info for a channel
+ * @param source The user requesting info
+ * @param ci The channel the user is requesting info for
+ * @param info Data to show the user requesting information
+ * @param show_hidden true if we should show the user everything
+ */
+ virtual void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool show_hidden) anope_abstract;
+ };
+}
+
diff --git a/include/modules/chanserv/level.h b/include/modules/chanserv/level.h
new file mode 100644
index 000000000..055827641
--- /dev/null
+++ b/include/modules/chanserv/level.h
@@ -0,0 +1,43 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2012-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
+
+namespace ChanServ
+{
+
+
+class Level : public Serialize::Object
+{
+ public:
+ static constexpr const char *const NAME = "level";
+
+ using Serialize::Object::Object;
+
+ virtual Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(Channel *) anope_abstract;
+
+ virtual Anope::string GetName() anope_abstract;
+ virtual void SetName(const Anope::string &) anope_abstract;
+
+ virtual int GetLevel() anope_abstract;
+ virtual void SetLevel(const int &) anope_abstract;
+};
+
+} // namespace ChanServ \ No newline at end of file
diff --git a/include/modules/chanserv/log.h b/include/modules/chanserv/log.h
new file mode 100644
index 000000000..19832cc60
--- /dev/null
+++ b/include/modules/chanserv/log.h
@@ -0,0 +1,51 @@
+/*
+ * 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 LogSetting : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "logsetting";
+
+ virtual ChanServ::Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(ChanServ::Channel *) anope_abstract;
+
+ virtual Anope::string GetServiceName() anope_abstract;
+ virtual void SetServiceName(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetCommandService() anope_abstract;
+ virtual void SetCommandService(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetCommandName() anope_abstract;
+ virtual void SetCommandName(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetMethod() anope_abstract;
+ virtual void SetMethod(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetExtra() anope_abstract;
+ virtual void SetExtra(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/chanserv/main/chanaccess.h b/include/modules/chanserv/main/chanaccess.h
new file mode 100644
index 000000000..ca6661a5b
--- /dev/null
+++ b/include/modules/chanserv/main/chanaccess.h
@@ -0,0 +1,50 @@
+/*
+ * 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 ChanAccessImpl : public ChanServ::ChanAccess
+{
+ public:
+ using ChanServ::ChanAccess::ChanAccess;
+
+ ChanServ::Channel *GetChannel() override;
+ void SetChannel(ChanServ::Channel *ci) override;
+
+ Anope::string GetCreator() override;
+ void SetCreator(const Anope::string &c) override;
+
+ time_t GetLastSeen() override;
+ void SetLastSeen(const time_t &t) override;
+
+ time_t GetCreated() override;
+ void SetCreated(const time_t &t) override;
+
+ Anope::string GetMask() override;
+ void SetMask(const Anope::string &) override;
+
+ NickServ::Account *GetAccount() override;
+ void SetAccount(NickServ::Account *) override;
+
+ Anope::string Mask() override;
+
+ bool Matches(const User *u, NickServ::Account *acc) override;
+
+ int Compare(ChanAccess *other) override;
+};
diff --git a/include/modules/chanserv/mode.h b/include/modules/chanserv/mode.h
new file mode 100644
index 000000000..a979cb605
--- /dev/null
+++ b/include/modules/chanserv/mode.h
@@ -0,0 +1,157 @@
+/*
+ * 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
+
+class ModeLock : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "modelock";
+
+ virtual ChanServ::Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(ChanServ::Channel *) anope_abstract;
+
+ virtual bool GetSet() anope_abstract;
+ virtual void SetSet(const bool &) anope_abstract;
+
+ virtual Anope::string GetName() anope_abstract;
+ virtual void SetName(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetParam() anope_abstract;
+ virtual void SetParam(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetSetter() anope_abstract;
+ virtual void SetSetter(const Anope::string &) anope_abstract;
+
+ virtual time_t GetCreated() anope_abstract;
+ virtual void SetCreated(const time_t &) anope_abstract;
+};
+
+class ModeLocks : public Service
+{
+ public:
+ static constexpr const char *NAME = "mlocks";
+
+ ModeLocks(Module *me) : Service(me, NAME) { }
+
+ typedef std::vector<ModeLock *> ModeList;
+
+ /** Check if a mode is mlocked
+ * @param mode The mode
+ * @param An optional param
+ * @param status True to check mlock on, false for mlock off
+ * @return true on success, false on fail
+ */
+ virtual bool HasMLock(ChanServ::Channel *, ChannelMode *mode, const Anope::string &param, bool status) const anope_abstract;
+
+ /** Set a mlock
+ * @param mode The mode
+ * @param status True for mlock on, false for mlock off
+ * @param param An optional param arg for + mlocked modes
+ * @param setter Who is setting the mlock
+ * @param created When the mlock was created
+ * @return true on success, false on failure (module blocking)
+ */
+ virtual bool SetMLock(ChanServ::Channel *, ChannelMode *mode, bool status, const Anope::string &param = "", Anope::string setter = "", time_t created = Anope::CurTime) anope_abstract;
+
+ /** Remove a mlock
+ * @param mode The mode
+ * @param status True for mlock on, false for mlock off
+ * @param param The param of the mode, required if it is a list or status mode
+ * @return true on success, false on failure
+ */
+ virtual bool RemoveMLock(ChanServ::Channel *, ChannelMode *mode, bool status, const Anope::string &param = "") anope_abstract;
+
+ /** Clear all mlocks on the channel
+ */
+ virtual void ClearMLock(ChanServ::Channel *) anope_abstract;
+
+ /** Get all of the mlocks for this channel
+ * @return The mlocks
+ */
+ virtual ModeList GetMLock(ChanServ::Channel *) const anope_abstract;
+
+ /** Get a list of mode locks on a channel
+ * @param name The mode name to get a list of
+ * @return a list of mlocks for the given mode
+ */
+ virtual std::list<ModeLock *> GetModeLockList(ChanServ::Channel *, const Anope::string &name) anope_abstract;
+
+ /** Get details for a specific mlock
+ * @param mname The mode name
+ * @param An optional param to match with
+ * @return The MLock, if any
+ */
+ virtual ModeLock *GetMLock(ChanServ::Channel *, const Anope::string &mname, const Anope::string &param = "") anope_abstract;
+
+ /** Get the current mode locks as a string
+ * @param complete True to show mlock parameters as well
+ * @return A string of mode locks, eg: +nrt
+ */
+ virtual Anope::string GetMLockAsString(ChanServ::Channel *, bool complete) const anope_abstract;
+};
+
+namespace ChanServ
+{
+
+class Mode : public Serialize::Object
+{
+ public:
+ static constexpr const char *const NAME = "mlockmode";
+
+ using Serialize::Object::Object;
+
+ virtual Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(Channel *) anope_abstract;
+
+ virtual Anope::string GetMode() anope_abstract;
+ virtual void SetMode(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetParam() anope_abstract;
+ virtual void SetParam(const Anope::string &) anope_abstract;
+};
+
+} // namespace ChanServ
+
+namespace Event
+{
+ struct CoreExport MLockEvents : Events
+ {
+ static constexpr const char *NAME = "mlockevents";
+
+ using Events::Events;
+
+ /** Called when a mode is about to be mlocked
+ * @param ci The channel the mode is being locked on
+ * @param lock The mode lock
+ * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the mlock.
+ */
+ virtual EventReturn OnMLock(ChanServ::Channel *ci, ModeLock *lock) anope_abstract;
+
+ /** Called when a mode is about to be unlocked
+ * @param ci The channel the mode is being unlocked from
+ * @param lock The mode lock
+ * @return EVENT_CONTINUE to let other modules decide, EVENT_STOP to deny the mlock.
+ */
+ virtual EventReturn OnUnMLock(ChanServ::Channel *ci, ModeLock *lock) anope_abstract;
+ };
+}
diff --git a/include/modules/chanserv/privilege.h b/include/modules/chanserv/privilege.h
new file mode 100644
index 000000000..22e38a3d7
--- /dev/null
+++ b/include/modules/chanserv/privilege.h
@@ -0,0 +1,93 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2012-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
+
+namespace ChanServ
+{
+
+static struct
+{
+ Anope::string name;
+ Anope::string desc;
+} descriptions[] = {
+ {"ACCESS_CHANGE", _("Allowed to modify the access list")},
+ {"ACCESS_LIST", _("Allowed to view the access list")},
+ {"AKICK", _("Allowed to use the AKICK command")},
+ {"ASSIGN", _("Allowed to assign/unassign a bot")},
+ {"AUTOHALFOP", _("Automatic halfop upon join")},
+ {"AUTOOP", _("Automatic channel operator status upon join")},
+ {"AUTOOWNER", _("Automatic owner upon join")},
+ {"AUTOPROTECT", _("Automatic protect upon join")},
+ {"AUTOVOICE", _("Automatic voice on join")},
+ {"BADWORDS", _("Allowed to modify channel badwords list")},
+ {"BAN", _("Allowed to ban users")},
+ {"FANTASIA", _("Allowed to use fantasy commands")},
+ {"FOUNDER", _("Allowed to issue commands restricted to channel founders")},
+ {"GETKEY", _("Allowed to use GETKEY command")},
+ {"GREET", _("Greet message displayed on join")},
+ {"HALFOP", _("Allowed to (de)halfop users")},
+ {"HALFOPME", _("Allowed to (de)halfop him/herself")},
+ {"INFO", _("Allowed to get full INFO output")},
+ {"INVITE", _("Allowed to use the INVITE command")},
+ {"KICK", _("Allowed to use the KICK command")},
+ {"MEMO", _("Allowed to read channel memos")},
+ {"MODE", _("Allowed to use the MODE command")},
+ {"NOKICK", _("Prevents users being kicked by Services")},
+ {"OP", _("Allowed to (de)op users")},
+ {"OPME", _("Allowed to (de)op him/herself")},
+ {"OWNER", _("Allowed to (de)owner users")},
+ {"OWNERME", _("Allowed to (de)owner him/herself")},
+ {"PROTECT", _("Allowed to (de)protect users")},
+ {"PROTECTME", _("Allowed to (de)protect him/herself")},
+ {"SAY", _("Allowed to use SAY and ACT commands")},
+ {"SET", _("Allowed to set channel settings")},
+ {"SIGNKICK", _("No signed kick when SIGNKICK LEVEL is used")},
+ {"TOPIC", _("Allowed to change channel topics")},
+ {"UNBAN", _("Allowed to unban users")},
+ {"VOICE", _("Allowed to (de)voice users")},
+ {"VOICEME", _("Allowed to (de)voice him/herself")}
+};
+
+/* A privilege, probably configured using a privilege{} block. Most
+ * commands require specific privileges to be executed.
+ */
+struct CoreExport Privilege
+{
+ Anope::string name;
+ Anope::string desc;
+ /* Rank relative to other privileges */
+ int rank;
+ int level;
+
+ Privilege(const Anope::string &n, const Anope::string &d, int r, int l) : name(n), desc(d), rank(r), level(l)
+ {
+ if (this->desc.empty())
+ for (unsigned j = 0; j < sizeof(descriptions) / sizeof(*descriptions); ++j)
+ if (descriptions[j].name.equals_ci(name))
+ this->desc = descriptions[j].desc;
+ }
+
+ bool operator==(const Privilege &other) const
+ {
+ return this->name.equals_ci(other.name);
+ }
+};
+
+} // namespace ChanServ \ No newline at end of file
diff --git a/include/modules/chanserv/set.h b/include/modules/chanserv/set.h
new file mode 100644
index 000000000..ce061775f
--- /dev/null
+++ b/include/modules/chanserv/set.h
@@ -0,0 +1,38 @@
+/*
+ * 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 SetChannelOption : Events
+ {
+ static constexpr const char *NAME = "setchanneloption";
+
+ using Events::Events;
+
+ /** Called when a chanserv/set command is used
+ * @param source The source of the command
+ * @param cmd The command
+ * @param ci The channel the command was used on
+ * @param setting The setting passed to the command. Probably ON/OFF.
+ * @return EVENT_ALLOW to bypass access checks, EVENT_STOP to halt immediately.
+ */
+ virtual EventReturn OnSetChannelOption(CommandSource &source, Command *cmd, ChanServ::Channel *ci, const Anope::string &setting) anope_abstract;
+ };
+}
+
diff --git a/include/modules/chanserv/set_misc.h b/include/modules/chanserv/set_misc.h
new file mode 100644
index 000000000..afc1f380a
--- /dev/null
+++ b/include/modules/chanserv/set_misc.h
@@ -0,0 +1,36 @@
+/*
+ * 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 CSMiscData : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "csmiscdata";
+
+ virtual ChanServ::Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(ChanServ::Channel *) anope_abstract;
+
+ virtual Anope::string GetName() anope_abstract;
+ virtual void SetName(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetData() anope_abstract;
+ virtual void SetData(const Anope::string &) anope_abstract;
+};
diff --git a/include/modules/chanserv/suspend.h b/include/modules/chanserv/suspend.h
new file mode 100644
index 000000000..d0057ec87
--- /dev/null
+++ b/include/modules/chanserv/suspend.h
@@ -0,0 +1,69 @@
+/*
+ * 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 CSSuspendInfo : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "cssuspendinfo";
+
+ virtual ChanServ::Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(ChanServ::Channel *) anope_abstract;
+
+ virtual Anope::string GetBy() anope_abstract;
+ virtual void SetBy(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetReason() anope_abstract;
+ virtual void SetReason(const Anope::string &) anope_abstract;
+
+ virtual time_t GetWhen() anope_abstract;
+ virtual void SetWhen(const time_t &) anope_abstract;
+
+ virtual time_t GetExpires() anope_abstract;
+ virtual void SetExpires(const time_t &) anope_abstract;
+};
+
+namespace Event
+{
+ struct CoreExport ChanSuspend : Events
+ {
+ static constexpr const char *NAME = "chansuspend";
+
+ using Events::Events;
+
+ /** Called when a channel is suspended
+ * @param ci The channel
+ */
+ virtual void OnChanSuspend(ChanServ::Channel *ci) anope_abstract;
+ };
+ struct CoreExport ChanUnsuspend : Events
+ {
+ static constexpr const char *NAME = "chanunsuspend";
+
+ using Events::Events;
+
+ /** Called when a channel is unsuspended
+ * @param ci The channel
+ */
+ virtual void OnChanUnsuspend(ChanServ::Channel *ci) anope_abstract;
+ };
+}
+
diff --git a/include/modules/cs_entrymsg.h b/include/modules/cs_entrymsg.h
deleted file mode 100644
index cf5f333ff..000000000
--- a/include/modules/cs_entrymsg.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * (C) 2003-2017 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- */
-
-struct EntryMsg
-{
- Anope::string chan;
- Anope::string creator;
- Anope::string message;
- time_t when;
-
- virtual ~EntryMsg() { }
- protected:
- EntryMsg() { }
-};
-
-struct EntryMessageList : Serialize::Checker<std::vector<EntryMsg *> >
-{
- protected:
- EntryMessageList() : Serialize::Checker<std::vector<EntryMsg *> >("EntryMsg") { }
-
- public:
- virtual ~EntryMessageList()
- {
- for (unsigned i = (*this)->size(); i > 0; --i)
- delete (*this)->at(i - 1);
- }
-
- virtual EntryMsg* Create() = 0;
-};
diff --git a/include/modules/cs_log.h b/include/modules/cs_log.h
deleted file mode 100644
index d248c115e..000000000
--- a/include/modules/cs_log.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ChanServ core functions
- *
- * (C) 2003-2017 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.
- */
-
-struct LogSetting
-{
- Anope::string chan;
- /* Our service name of the command */
- Anope::string service_name;
- /* The name of the client the command is on */
- Anope::string command_service;
- /* Name of the command to the user, can have spaces */
- Anope::string command_name;
- Anope::string method, extra;
- Anope::string creator;
- time_t created;
-
- virtual ~LogSetting() { }
- protected:
- LogSetting() { }
-};
-
-struct LogSettings : Serialize::Checker<std::vector<LogSetting *> >
-{
- typedef std::vector<LogSetting *>::iterator iterator;
-
- protected:
- LogSettings() : Serialize::Checker<std::vector<LogSetting *> >("LogSetting")
- {
- }
-
- public:
- virtual ~LogSettings() { }
- virtual LogSetting *Create() = 0;
-};
diff --git a/include/modules/cs_mode.h b/include/modules/cs_mode.h
deleted file mode 100644
index 5789886ed..000000000
--- a/include/modules/cs_mode.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* ChanServ core functions
- *
- * (C) 2003-2017 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.
- */
-
-struct ModeLock
-{
- Anope::string ci;
- bool set;
- Anope::string name;
- Anope::string param;
- Anope::string setter;
- time_t created;
-
- virtual ~ModeLock() { }
- protected:
- ModeLock() { }
-};
-
-struct ModeLocks
-{
- typedef std::vector<ModeLock *> ModeList;
-
- virtual ~ModeLocks() { }
-
- /** Check if a mode is mlocked
- * @param mode The mode
- * @param An optional param
- * @param status True to check mlock on, false for mlock off
- * @return true on success, false on fail
- */
- virtual bool HasMLock(ChannelMode *mode, const Anope::string &param, bool status) const = 0;
-
- /** Set a mlock
- * @param mode The mode
- * @param status True for mlock on, false for mlock off
- * @param param An optional param arg for + mlocked modes
- * @param setter Who is setting the mlock
- * @param created When the mlock was created
- * @return true on success, false on failure (module blocking)
- */
- virtual bool SetMLock(ChannelMode *mode, bool status, const Anope::string &param = "", Anope::string setter = "", time_t created = Anope::CurTime) = 0;
-
- /** Remove a mlock
- * @param mode The mode
- * @param status True for mlock on, false for mlock off
- * @param param The param of the mode, required if it is a list or status mode
- * @return true on success, false on failure
- */
- virtual bool RemoveMLock(ChannelMode *mode, bool status, const Anope::string &param = "") = 0;
-
- virtual void RemoveMLock(ModeLock *mlock) = 0;
-
- /** Clear all mlocks on the channel
- */
- virtual void ClearMLock() = 0;
-
- /** Get all of the mlocks for this channel
- * @return The mlocks
- */
- virtual const ModeList &GetMLock() const = 0;
-
- /** Get a list of mode locks on a channel
- * @param name The mode name to get a list of
- * @return a list of mlocks for the given mode
- */
- virtual std::list<ModeLock *> GetModeLockList(const Anope::string &name) = 0;
-
- /** Get details for a specific mlock
- * @param mname The mode name
- * @param An optional param to match with
- * @return The MLock, if any
- */
- virtual const ModeLock *GetMLock(const Anope::string &mname, const Anope::string &param = "") = 0;
-
- /** Get the current mode locks as a string
- * @param complete True to show mlock parameters as well
- * @return A string of mode locks, eg: +nrt
- */
- virtual Anope::string GetMLockAsString(bool complete) const = 0;
-
- virtual void Check() = 0;
-};
diff --git a/include/modules/dns.h b/include/modules/dns.h
index 69e92e68b..61a23caec 100644
--- a/include/modules/dns.h
+++ b/include/modules/dns.h
@@ -1,12 +1,20 @@
/*
+ * Anope IRC Services
*
- * (C) 2003-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2012-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * 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.
*
- * Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
+ * 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/>.
*/
#ifndef DNS_H
@@ -78,11 +86,11 @@ namespace DNS
Question() : type(QUERY_NONE), qclass(0) { }
Question(const Anope::string &n, QueryType t, unsigned short c = 1) : name(n), type(t), qclass(c) { }
- inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; }
+ inline bool operator==(const Question & other) const { return name == other.name && type == other.type && qclass == other.qclass; }
struct hash
{
- size_t operator()(const Question &q) const
+ size_t operator()(const Question &q) const
{
return Anope::hash_ci()(q.name);
}
@@ -94,7 +102,7 @@ namespace DNS
unsigned int ttl;
Anope::string rdata;
time_t created;
-
+
ResourceRecord(const Anope::string &n, QueryType t, unsigned short c = 1) : Question(n, t, c), ttl(0), created(Anope::CurTime) { }
ResourceRecord(const Question &q) : Question(q), ttl(0), created(Anope::CurTime) { }
};
@@ -104,7 +112,7 @@ namespace DNS
std::vector<Question> questions;
std::vector<ResourceRecord> answers, authorities, additional;
Error error;
-
+
Query() : error(ERROR_NONE) { }
Query(const Question &q) : error(ERROR_NONE) { questions.push_back(q); }
};
@@ -117,17 +125,19 @@ namespace DNS
class Manager : public Service
{
public:
- Manager(Module *creator) : Service(creator, "DNS::Manager", "dns/manager") { }
+ static constexpr const char *NAME = "dns/manager";
+
+ Manager(Module *creator) : Service(creator, NAME) { }
virtual ~Manager() { }
- virtual void Process(Request *req) = 0;
- virtual void RemoveRequest(Request *req) = 0;
+ virtual void Process(Request *req) anope_abstract;
+ virtual void RemoveRequest(Request *req) anope_abstract;
- virtual bool HandlePacket(ReplySocket *s, const unsigned char *const data, int len, sockaddrs *from) = 0;
+ virtual bool HandlePacket(ReplySocket *s, const unsigned char *const data, int len, sockaddrs *from) anope_abstract;
- virtual void UpdateSerial() = 0;
- virtual void Notify(const Anope::string &zone) = 0;
- virtual uint32_t GetSerial() const = 0;
+ virtual void UpdateSerial() anope_abstract;
+ virtual void Notify(const Anope::string &zone) anope_abstract;
+ virtual uint32_t GetSerial() const anope_abstract;
};
/** A DNS query.
@@ -154,7 +164,7 @@ namespace DNS
/** Called when this request succeeds
* @param r The query sent back from the nameserver
*/
- virtual void OnLookupComplete(const Query *r) = 0;
+ virtual void OnLookupComplete(const Query *r) anope_abstract;
/** Called when this request fails or times out.
* @param r The query sent back from the nameserver, check the error code.
@@ -164,9 +174,9 @@ namespace DNS
/** Used to time out the query, xalls OnError and lets the TimerManager
* delete this request.
*/
- void Tick(time_t) anope_override
+ void Tick(time_t) override
{
- Log(LOG_DEBUG_2) << "Resolver: timeout for query " << this->name;
+ Anope::Logger.Debug2("Resolver: timeout for query {0}", this->name);
Query rr(*this);
rr.error = ERROR_TIMEDOUT;
this->OnError(&rr);
@@ -175,4 +185,22 @@ namespace DNS
} // namespace DNS
+namespace Event
+{
+ struct CoreExport DnsRequest : Events
+ {
+ static constexpr const char *NAME = "dnsrequest";
+
+ using Events::Events;
+
+ /** Called when a DNS request (question) is recieved.
+ * @param req The dns request
+ * @param reply The reply that will be sent
+ */
+ virtual void OnDnsRequest(DNS::Query &req, DNS::Query *reply) anope_abstract;
+ };
+}
+
#endif // DNS_H
+
+
diff --git a/include/modules/encryption.h b/include/modules/encryption.h
index 9dc7b1717..a30e5e52a 100644
--- a/include/modules/encryption.h
+++ b/include/modules/encryption.h
@@ -1,12 +1,20 @@
/*
+ * Anope IRC Services
*
- * (C) 2003-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2012-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * 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.
*
- * Based on the original code of Epona by Lara.
- * Based on the original code of Services by Andy Church.
+ * 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 Encryption
@@ -18,18 +26,21 @@ namespace Encryption
{
public:
virtual ~Context() { }
- virtual void Update(const unsigned char *data, size_t len) = 0;
- virtual void Finalize() = 0;
- virtual Hash GetFinalizedHash() = 0;
+ virtual void Update(const unsigned char *data, size_t len) anope_abstract;
+ virtual void Finalize() anope_abstract;
+ virtual Hash GetFinalizedHash() anope_abstract;
};
class Provider : public Service
{
public:
- Provider(Module *creator, const Anope::string &sname) : Service(creator, "Encryption::Provider", sname) { }
+ static constexpr const char *NAME = "hash";
+
+ Provider(Module *creator, const Anope::string &sname) : Service(creator, NAME, sname) { }
virtual ~Provider() { }
- virtual Context *CreateContext(IV * = NULL) = 0;
- virtual IV GetDefaultIV() = 0;
+ virtual Context *CreateContext(IV * = NULL) anope_abstract;
+ virtual IV GetDefaultIV() anope_abstract;
};
}
+
diff --git a/include/modules/fantasy.h b/include/modules/fantasy.h
new file mode 100644
index 000000000..979aab364
--- /dev/null
+++ b/include/modules/fantasy.h
@@ -0,0 +1,54 @@
+/*
+ * 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 BotFantasy : Events
+ {
+ static constexpr const char *NAME = "botfantasy";
+
+ using Events::Events;
+
+ /** Called on fantasy command
+ * @param source The source of the command
+ * @param c The command
+ * @param ci The channel it's being used in
+ * @param params The params
+ * @return EVENT_STOP to halt processing and not run the command, EVENT_ALLOW to allow the command to be executed
+ */
+ virtual EventReturn OnBotFantasy(CommandSource &source, Command *c, ChanServ::Channel *ci, const std::vector<Anope::string> &params) anope_abstract;
+ };
+
+ struct CoreExport BotNoFantasyAccess : Events
+ {
+ static constexpr const char *NAME = "botnofantasyaccess";
+
+ using Events::Events;
+
+ /** Called on fantasy command without access
+ * @param source The source of the command
+ * @param c The command
+ * @param ci The channel it's being used in
+ * @param params The params
+ * @return EVENT_STOP to halt processing and not run the command, EVENT_ALLOW to allow the command to be executed
+ */
+ virtual EventReturn OnBotNoFantasyAccess(CommandSource &source, Command *c, ChanServ::Channel *ci, const std::vector<Anope::string> &params) anope_abstract;
+ };
+}
+
diff --git a/include/modules/global.h b/include/modules/global.h
new file mode 100644
index 000000000..5e9c3a315
--- /dev/null
+++ b/include/modules/global.h
@@ -0,0 +1,40 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2011-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 Global
+{
+ class GlobalService : public Service
+ {
+ public:
+ static constexpr const char *NAME = "global";
+
+ GlobalService(Module *m) : Service(m, NAME)
+ {
+ }
+
+ /** Send out a global message to all users
+ * @param sender Our client which should send the global
+ * @param source The sender of the global
+ * @param message The message
+ */
+ virtual void SendGlobal(ServiceBot *sender, const Anope::string &source, const Anope::string &message) anope_abstract;
+ };
+}
+
+
diff --git a/include/modules/help.h b/include/modules/help.h
new file mode 100644
index 000000000..041219d1a
--- /dev/null
+++ b/include/modules/help.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/>.
+ */
+
+namespace Event
+{
+ struct CoreExport Help : Events
+ {
+ static constexpr const char *NAME = "help";
+
+ using Events::Events;
+
+ /** Called when someone uses the generic/help command
+ * @param source Command source
+ * @param params Params
+ * @return EVENT_STOP to stop processing
+ */
+ virtual EventReturn OnPreHelp(CommandSource &source, const std::vector<Anope::string> &params) anope_abstract;
+
+ /** Called when someone uses the generic/help command
+ * @param source Command source
+ * @param params Params
+ */
+ virtual void OnPostHelp(CommandSource &source, const std::vector<Anope::string> &params) anope_abstract;
+ };
+}
+
diff --git a/include/modules/hostserv.h b/include/modules/hostserv.h
new file mode 100644
index 000000000..f2ec9a187
--- /dev/null
+++ b/include/modules/hostserv.h
@@ -0,0 +1,98 @@
+/*
+ * 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
+
+#include "serialize.h"
+
+namespace HostServ
+{
+ class VHost : public Serialize::Object
+ {
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "vhost";
+
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
+
+ virtual Anope::string GetIdent() anope_abstract;
+ virtual void SetIdent(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetHost() anope_abstract;
+ virtual void SetHost(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(time_t) anope_abstract;
+
+ virtual bool IsDefault() anope_abstract;
+ virtual void SetDefault(bool) anope_abstract;
+
+ inline Anope::string Mask()
+ {
+ Anope::string ident = GetIdent(), host = GetHost();
+ if (!ident.empty())
+ return ident + "@" + host;
+ else
+ return host;
+ }
+ };
+
+ /** Find the default vhost for an object, or the first
+ * if there is no default.
+ * @return The object's vhost
+ */
+ inline VHost *FindVHost(Serialize::Object *obj)
+ {
+ VHost *first = nullptr;
+
+ for (VHost *v : obj->GetRefs<VHost *>())
+ {
+ if (first == nullptr)
+ first = v;
+
+ if (v->IsDefault())
+ {
+ first = v;
+ break;
+ }
+ }
+
+ return first;
+ }
+
+ inline VHost *FindVHost(Serialize::Object *obj, const Anope::string &v)
+ {
+ for (VHost *vhost : obj->GetRefs<VHost *>())
+ {
+ if (vhost->Mask().equals_ci(v))
+ {
+ return vhost;
+ }
+ }
+
+ return nullptr;
+ }
+}
+
diff --git a/include/modules/hostserv/del.h b/include/modules/hostserv/del.h
new file mode 100644
index 000000000..5df29d772
--- /dev/null
+++ b/include/modules/hostserv/del.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 DeleteVhost : Events
+ {
+ static constexpr const char *NAME = "deletevhost";
+
+ using Events::Events;
+
+ /** Called when a vhost is deleted
+ * @param na The nickalias of the vhost
+ */
+ virtual void OnDeleteVhost(NickServ::Nick *na) anope_abstract;
+ };
+}
+
diff --git a/include/modules/httpd.h b/include/modules/httpd.h
index a6c60c0d4..ef2d2055f 100644
--- a/include/modules/httpd.h
+++ b/include/modules/httpd.h
@@ -1,23 +1,52 @@
/*
+ * Anope IRC Services
*
- * (C) 2012-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2012-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * 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/>.
*/
-#ifndef ANOPE_HTTPD_H
-#define ANOPE_HTTPD_H
+#pragma once
enum HTTPError
{
HTTP_ERROR_OK = 200,
+ HTTP_CREATED = 201,
HTTP_FOUND = 302,
HTTP_BAD_REQUEST = 400,
HTTP_PAGE_NOT_FOUND = 404,
+ HTTP_INTERNAL_SERVER_ERROR = 500,
HTTP_NOT_SUPPORTED = 505
};
+namespace httpd
+{
+
+enum class Method
+{
+ NONE,
+ GET,
+ POST,
+ PUT,
+ DELETE,
+ OPTIONS,
+ HEAD
+};
+
+} // namespace httpd
+
+
/* A message to someone */
struct HTTPReply
{
@@ -83,6 +112,7 @@ struct HTTPReply
/* A message from soneone */
struct HTTPMessage
{
+ httpd::Method method = httpd::Method::NONE;
std::map<Anope::string, Anope::string> headers;
std::map<Anope::string, Anope::string> cookies;
std::map<Anope::string, Anope::string> get_data;
@@ -112,7 +142,7 @@ class HTTPPage : public Base
* @param The HTTP header sent from the client to request the page
* @param The HTTP header that will be sent back to the client
*/
- virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) = 0;
+ virtual bool OnRequest(HTTPProvider *, const Anope::string &, HTTPClient *, HTTPMessage &, HTTPReply &) anope_abstract;
};
class HTTPClient : public ClientSocket, public BinarySocket, public Base
@@ -131,8 +161,8 @@ class HTTPClient : public ClientSocket, public BinarySocket, public Base
return this->clientaddr.addr();
}
- virtual void SendError(HTTPError err, const Anope::string &msg) = 0;
- virtual void SendReply(HTTPReply *) = 0;
+ virtual void SendError(HTTPError err, const Anope::string &msg) anope_abstract;
+ virtual void SendReply(HTTPReply *) anope_abstract;
};
class HTTPProvider : public ListenSocket, public Service
@@ -140,11 +170,16 @@ class HTTPProvider : public ListenSocket, public Service
Anope::string ip;
unsigned short port;
bool ssl;
+
public:
+ static constexpr const char *NAME = "http";
+
Anope::string ext_ip;
std::vector<Anope::string> ext_headers;
- HTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, bool s) : ListenSocket(i, p, i.find(':') != Anope::string::npos), Service(c, "HTTPProvider", n), ip(i), port(p), ssl(s) { }
+ HTTPProvider(Module *c, const Anope::string &n, const Anope::string &i, const unsigned short p, bool s)
+ : ListenSocket(i, p, i.find(':') != Anope::string::npos)
+ , Service(c, NAME, n), ip(i), port(p), ssl(s) { }
const Anope::string &GetIP() const
{
@@ -161,9 +196,9 @@ class HTTPProvider : public ListenSocket, public Service
return this->ssl;
}
- virtual bool RegisterPage(HTTPPage *page) = 0;
- virtual void UnregisterPage(HTTPPage *page) = 0;
- virtual HTTPPage* FindPage(const Anope::string &name) = 0;
+ virtual bool RegisterPage(HTTPPage *page) anope_abstract;
+ virtual void UnregisterPage(HTTPPage *page) anope_abstract;
+ virtual HTTPPage* FindPage(const Anope::string &name) anope_abstract;
};
namespace HTTPUtils
@@ -236,5 +271,3 @@ namespace HTTPUtils
return dst;
}
}
-
-#endif // ANOPE_HTTPD_H
diff --git a/include/modules/ldap.h b/include/modules/ldap.h
index 00424a941..c26fb234b 100644
--- a/include/modules/ldap.h
+++ b/include/modules/ldap.h
@@ -1,13 +1,23 @@
/*
+ * Anope IRC Services
*
- * (C) 2011-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2011-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * 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/>.
*/
-#ifndef ANOPE_LDAP_H
-#define ANOPE_LDAP_H
+#pragma once
class LDAPException : public ModuleException
{
@@ -118,8 +128,8 @@ class LDAPInterface
LDAPInterface(Module *m) : owner(m) { }
virtual ~LDAPInterface() { }
- virtual void OnResult(const LDAPResult &r) = 0;
- virtual void OnError(const LDAPResult &err) = 0;
+ virtual void OnResult(const LDAPResult &r) anope_abstract;
+ virtual void OnError(const LDAPResult &err) anope_abstract;
virtual void OnDelete() { }
};
@@ -131,41 +141,39 @@ class LDAPProvider : public Service
/** Attempt to bind to the LDAP server as an admin
* @param i The LDAPInterface the result is sent to
*/
- virtual void BindAsAdmin(LDAPInterface *i) = 0;
+ virtual void BindAsAdmin(LDAPInterface *i) anope_abstract;
/** Bind to LDAP
* @param i The LDAPInterface the result is sent to
* @param who The binddn
* @param pass The password
*/
- virtual void Bind(LDAPInterface *i, const Anope::string &who, const Anope::string &pass) = 0;
+ virtual void Bind(LDAPInterface *i, const Anope::string &who, const Anope::string &pass) anope_abstract;
/** Search ldap for the specified filter
* @param i The LDAPInterface the result is sent to
* @param base The base DN to search
* @param filter The filter to apply
*/
- virtual void Search(LDAPInterface *i, const Anope::string &base, const Anope::string &filter) = 0;
+ virtual void Search(LDAPInterface *i, const Anope::string &base, const Anope::string &filter) anope_abstract;
/** Add an entry to LDAP
* @param i The LDAPInterface the result is sent to
* @param dn The dn of the entry to add
* @param attributes The attributes
*/
- virtual void Add(LDAPInterface *i, const Anope::string &dn, LDAPMods &attributes) = 0;
+ virtual void Add(LDAPInterface *i, const Anope::string &dn, LDAPMods &attributes) anope_abstract;
/** Delete an entry from LDAP
* @param i The LDAPInterface the result is sent to
* @param dn The dn of the entry to delete
*/
- virtual void Del(LDAPInterface *i, const Anope::string &dn) = 0;
+ virtual void Del(LDAPInterface *i, const Anope::string &dn) anope_abstract;
/** Modify an existing entry in LDAP
* @param i The LDAPInterface the result is sent to
* @param base The base DN to modify
* @param attributes The attributes to modify
*/
- virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) = 0;
+ virtual void Modify(LDAPInterface *i, const Anope::string &base, LDAPMods &attributes) anope_abstract;
};
-
-#endif // ANOPE_LDAP_H
diff --git a/include/modules/memoserv.h b/include/modules/memoserv.h
new file mode 100644
index 000000000..4c1756ba0
--- /dev/null
+++ b/include/modules/memoserv.h
@@ -0,0 +1,171 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2011-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
+
+#include "module.h"
+
+namespace MemoServ
+{
+ class Ignore;
+
+ class MemoServService : public Service
+ {
+ public:
+ static constexpr const char *NAME = "memoserv";
+
+ enum MemoResult
+ {
+ MEMO_SUCCESS,
+ MEMO_INVALID_TARGET,
+ MEMO_TOO_FAST,
+ MEMO_TARGET_FULL
+ };
+
+ MemoServService(Module *m) : Service(m, "MemoServService", NAME)
+ {
+ }
+
+ /** Sends a memo.
+ * @param source The source of the memo, can be anythin.
+ * @param target The target of the memo, nick or channel.
+ * @param message Memo text
+ * @param force true to force the memo, restrictions/delays etc are not checked
+ */
+ virtual MemoResult Send(const Anope::string &source, const Anope::string &target, const Anope::string &message, bool force = false) anope_abstract;
+
+ /** Check for new memos and notify the user if there are any
+ * @param u The user
+ */
+ virtual void Check(User *u) anope_abstract;
+
+ virtual MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_registered, bool &is_chan, bool create) anope_abstract;
+ };
+
+ extern MemoServService *service;
+
+ namespace Event
+ {
+ struct CoreExport MemoSend : Events
+ {
+ static constexpr const char *NAME = "memosend";
+
+ using Events::Events;
+
+ /** Called when a memo is sent
+ * @param source The source of the memo
+ * @param target The target of the memo
+ * @param mi Memo info for target
+ * @param m The memo
+ */
+ virtual void OnMemoSend(const Anope::string &source, const Anope::string &target, MemoInfo *mi, Memo *m) anope_abstract;
+ };
+
+ struct CoreExport MemoDel : Events
+ {
+ static constexpr const char *NAME = "memodel";
+
+ using Events::Events;
+
+ /** Called when a memo is deleted
+ * @param target The target the memo is being deleted from (nick or channel)
+ * @param mi The memo info
+ * @param m The memo
+ */
+ virtual void OnMemoDel(const Anope::string &target, MemoInfo *mi, const Memo *m) anope_abstract;
+ };
+ }
+
+ class Memo : public Serialize::Object
+ {
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "memo";
+
+ virtual MemoInfo *GetMemoInfo() anope_abstract;
+ virtual void SetMemoInfo(MemoInfo *) anope_abstract;
+
+ virtual time_t GetTime() anope_abstract;
+ virtual void SetTime(const time_t &) anope_abstract;
+
+ virtual Anope::string GetSender() anope_abstract;
+ virtual void SetSender(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetText() anope_abstract;
+ virtual void SetText(const Anope::string &) anope_abstract;
+
+ virtual bool GetUnread() anope_abstract;
+ virtual void SetUnread(const bool &) anope_abstract;
+
+ virtual bool GetReceipt() anope_abstract;
+ virtual void SetReceipt(const bool &) anope_abstract;
+ };
+
+ /* Memo info structures. Since both nicknames and channels can have memos,
+ * we encapsulate memo data in a MemoInfo to make it easier to handle.
+ */
+ class MemoInfo : public Serialize::Object
+ {
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "memoinfo";
+
+ virtual Memo *GetMemo(unsigned index) anope_abstract;
+
+ virtual unsigned GetIndex(Memo *m) anope_abstract;
+
+ virtual void Del(unsigned index) anope_abstract;
+
+ virtual bool HasIgnore(User *u) anope_abstract;
+
+ 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 int16_t GetMemoMax() anope_abstract;
+ virtual void SetMemoMax(const int16_t &) anope_abstract;
+
+ virtual bool IsHardMax() anope_abstract;
+ virtual void SetHardMax(bool) anope_abstract;
+
+ virtual std::vector<Memo *> GetMemos() anope_abstract;
+ virtual std::vector<Ignore *> GetIgnores() anope_abstract;
+ };
+
+ class Ignore : public Serialize::Object
+ {
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "memoignore";
+
+ virtual MemoInfo *GetMemoInfo() anope_abstract;
+ virtual void SetMemoInfo(MemoInfo *) anope_abstract;
+
+ virtual Anope::string GetMask() anope_abstract;
+ virtual void SetMask(const Anope::string &mask) anope_abstract;
+ };
+}
diff --git a/include/modules/nickserv.h b/include/modules/nickserv.h
new file mode 100644
index 000000000..1316bb4cb
--- /dev/null
+++ b/include/modules/nickserv.h
@@ -0,0 +1,214 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2011-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
+
+#include "event.h"
+#include "service.h"
+#include "serialize.h"
+
+#include "nickserv/nick.h"
+#include "nickserv/account.h"
+
+namespace NickServ
+{
+ class Nick;
+ class Account;
+ class IdentifyRequestListener;
+
+ using nickalias_map = Anope::locale_hash_map<Nick *>;
+ using nickcore_map = Anope::locale_hash_map<Account *>;
+
+ class NickServService : public Service
+ {
+ public:
+ NickServService(Module *m) : Service(m, "NickServService", "NickServ")
+ {
+ }
+
+ virtual void Validate(User *u) anope_abstract;
+ virtual void Collide(User *u, Nick *na) anope_abstract;
+ virtual void Release(Nick *na) anope_abstract;
+
+ virtual IdentifyRequest *CreateIdentifyRequest(IdentifyRequestListener *l, Module *owner, const Anope::string &acc, const Anope::string &pass) anope_abstract;
+ virtual std::set<IdentifyRequest *>& GetIdentifyRequests() anope_abstract;
+
+ virtual std::vector<Nick *> GetNickList() anope_abstract;
+ virtual nickalias_map& GetNickMap() anope_abstract;
+
+ virtual std::vector<Account *> GetAccountList() anope_abstract;
+ virtual nickcore_map& GetAccountMap() anope_abstract;
+
+ virtual Nick *FindNick(const Anope::string &nick) anope_abstract;
+ virtual Account *FindAccount(const Anope::string &acc) anope_abstract;
+ };
+
+ extern NickServService *service;
+
+ inline Nick *FindNick(const Anope::string &nick)
+ {
+ return service ? service->FindNick(nick) : nullptr;
+ }
+
+ inline Account *FindAccount(const Anope::string &account)
+ {
+ return service ? service->FindAccount(account) : nullptr;
+ }
+
+ namespace Event
+ {
+ struct CoreExport PreNickExpire : Events
+ {
+ static constexpr const char *NAME = "prenickexpire";
+
+ using Events::Events;
+
+ /** Called before a nick expires
+ * @param na The nick
+ * @param expire Set to true to allow the nick to expire
+ */
+ virtual void OnPreNickExpire(Nick *na, bool &expire) anope_abstract;
+ };
+
+ struct CoreExport NickExpire : Events
+ {
+ static constexpr const char *NAME = "nickexpire";
+
+ using Events::Events;
+
+ /** Called when a nick drops
+ * @param na The nick
+ */
+ virtual void OnNickExpire(Nick *na) anope_abstract;
+ };
+
+ struct CoreExport NickRegister : Events
+ {
+ static constexpr const char *NAME = "nickregister";
+
+ using Events::Events;
+
+ /** Called when a nick is registered
+ * @param user The user registering the nick, of any
+ * @param The nick
+ * @param password The password of the nick
+ */
+ virtual void OnNickRegister(User *user, Nick *na, const Anope::string &password) anope_abstract;
+ };
+
+ struct CoreExport NickConfirm : Events
+ {
+ static constexpr const char *NAME = "nickconfirm";
+
+ using Events::Events;
+
+ virtual void OnNickConfirm(User *, Account *) anope_abstract;
+ };
+
+ struct CoreExport NickValidate : Events
+ {
+ static constexpr const char *NAME = "nickvalidate";
+
+ using Events::Events;
+
+ /** Called when a nick is validated. That is, to determine if a user is permissted
+ * to be on the given nick.
+ * @param u The user
+ * @param na The nick they are on
+ * @return EVENT_STOP to force the user off of the nick
+ */
+ virtual EventReturn OnNickValidate(User *u, Nick *na) anope_abstract;
+ };
+ }
+
+ /* A request to check if an account/password is valid. These can exist for
+ * extended periods due to the time some authentication modules take.
+ */
+ class CoreExport IdentifyRequest
+ {
+ protected:
+ /* Owner of this request, used to cleanup requests if a module is unloaded
+ * while a request us pending */
+ Module *owner;
+ IdentifyRequestListener *l;
+ Anope::string account;
+ Anope::string password;
+
+ std::set<Module *> holds;
+ bool dispatched = false;
+ bool success = false;
+
+ IdentifyRequest(IdentifyRequestListener *li, Module *o, const Anope::string &acc, const Anope::string &pass) : owner(o), l(li), account(acc), password(pass) { }
+ public:
+ virtual ~IdentifyRequest() { }
+
+ const Anope::string &GetAccount() const { return account; }
+ const Anope::string &GetPassword() const { return password; }
+ Module *GetOwner() const { return owner; }
+
+ /* Holds this request. When a request is held it must be Released later
+ * for the request to complete. Multiple modules may hold a request at any time,
+ * but the request is not complete until every module has released it. If you do not
+ * require holding this (eg, your password check is done in this thread and immediately)
+ * then you don't need to hold the request before Successing it.
+ * @param m The module holding this request
+ */
+ virtual void Hold(Module *m) anope_abstract;
+
+ /** Releases a held request
+ * @param m The module releaseing the hold
+ */
+ virtual void Release(Module *m) anope_abstract;
+
+ /** Called by modules when this IdentifyRequest has successeded successfully.
+ * If this request is behind held it must still be Released after calling this.
+ * @param m The module confirming authentication
+ */
+ virtual void Success(Module *m) anope_abstract;
+
+ /** Used to either finalize this request or marks
+ * it as dispatched and begins waiting for the module(s)
+ * that have holds to finish.
+ */
+ virtual void Dispatch() anope_abstract;
+ };
+
+ class IdentifyRequestListener
+ {
+ public:
+ virtual ~IdentifyRequestListener() { }
+ virtual void OnSuccess(IdentifyRequest *) anope_abstract;
+ virtual void OnFail(IdentifyRequest *) anope_abstract;
+ };
+
+ class Mode : public Serialize::Object
+ {
+ public:
+ static constexpr const char *const NAME = "mode";
+
+ using Serialize::Object::Object;
+
+ virtual Account *GetAccount() anope_abstract;
+ virtual void SetAccount(Account *) anope_abstract;
+
+ virtual Anope::string GetMode() anope_abstract;
+ virtual void SetMode(const Anope::string &) anope_abstract;
+ };
+
+}
diff --git a/include/modules/nickserv/access.h b/include/modules/nickserv/access.h
new file mode 100644
index 000000000..800014b9b
--- /dev/null
+++ b/include/modules/nickserv/access.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/>.
+ */
+
+class NickAccess : public Serialize::Object
+{
+ public:
+ static constexpr const char *const NAME = "nsaccess";
+
+ using Serialize::Object::Object;
+
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
+
+ virtual Anope::string GetMask() anope_abstract;
+ virtual void SetMask(const Anope::string &) anope_abstract;
+};
+
+
diff --git a/include/modules/nickserv/account.h b/include/modules/nickserv/account.h
new file mode 100644
index 000000000..e40ae75df
--- /dev/null
+++ b/include/modules/nickserv/account.h
@@ -0,0 +1,125 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2011-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
+
+namespace NickServ
+{
+
+/* A registered account. Each account must have a Nick with the same nick as the
+ * account's display.
+ */
+class CoreExport Account : public Serialize::Object
+{
+ public:
+ static constexpr const char *const NAME = "account";
+
+ /* Users online now logged into this account */
+ std::vector<User *> users;
+
+ using Serialize::Object::Object;
+
+ virtual Anope::string GetDisplay() anope_abstract;
+ virtual void SetDisplay(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetPassword() anope_abstract;
+ virtual void SetPassword(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetEmail() anope_abstract;
+ virtual void SetEmail(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetLanguage() anope_abstract;
+ virtual void SetLanguage(const Anope::string &) anope_abstract;
+
+ virtual Oper *GetOper() anope_abstract;
+ virtual void SetOper(Oper *) anope_abstract;
+
+ virtual Anope::string GetGreet() anope_abstract;
+ virtual void SetGreet(const Anope::string &) anope_abstract;
+
+ virtual bool IsUnconfirmed() anope_abstract;
+ virtual void SetUnconfirmed(bool) anope_abstract;
+
+ virtual bool IsPrivate() anope_abstract;
+ virtual void SetPrivate(bool) anope_abstract;
+
+ virtual bool IsAutoOp() anope_abstract;
+ virtual void SetAutoOp(bool) anope_abstract;
+
+ virtual bool IsKeepModes() anope_abstract;
+ virtual void SetKeepModes(bool) anope_abstract;
+
+ virtual bool IsKillProtect() anope_abstract;
+ virtual void SetKillProtect(bool) anope_abstract;
+
+ virtual bool IsKillQuick() anope_abstract;
+ virtual void SetKillQuick(bool) anope_abstract;
+
+ virtual bool IsKillImmed() anope_abstract;
+ virtual void SetKillImmed(bool) anope_abstract;
+
+ virtual bool IsMsg() anope_abstract;
+ virtual void SetMsg(bool) anope_abstract;
+
+ virtual bool IsSecure() anope_abstract;
+ virtual void SetSecure(bool) anope_abstract;
+
+ virtual bool IsMemoSignon() anope_abstract;
+ virtual void SetMemoSignon(bool) anope_abstract;
+
+ virtual bool IsMemoReceive() anope_abstract;
+ virtual void SetMemoReceive(bool) anope_abstract;
+
+ virtual bool IsMemoMail() anope_abstract;
+ virtual void SetMemoMail(bool) anope_abstract;
+
+ virtual bool IsHideEmail() anope_abstract;
+ virtual void SetHideEmail(bool) anope_abstract;
+
+ virtual bool IsHideMask() anope_abstract;
+ virtual void SetHideMask(bool) anope_abstract;
+
+ virtual bool IsHideStatus() anope_abstract;
+ virtual void SetHideStatus(bool) anope_abstract;
+
+ virtual bool IsHideQuit() anope_abstract;
+ virtual void SetHideQuit(bool) anope_abstract;
+
+ /** Changes the display for this account
+ * @param na The new display, must be grouped to this account.
+ */
+ virtual void SetDisplay(Nick *na) anope_abstract;
+
+ /** Is the given user on this accounts access list?
+ *
+ * @param u The user
+ *
+ * @return true if the user is on the access list
+ */
+ virtual bool IsOnAccess(User *u) anope_abstract;
+
+ virtual MemoServ::MemoInfo *GetMemos() anope_abstract;
+
+ virtual unsigned int GetChannelCount() anope_abstract;
+
+ virtual time_t GetLastMail() anope_abstract;
+ virtual void SetLastMail(time_t) anope_abstract;
+};
+
+} // namespace NickServ
diff --git a/include/modules/nickserv/ajoin.h b/include/modules/nickserv/ajoin.h
new file mode 100644
index 000000000..025f9796b
--- /dev/null
+++ b/include/modules/nickserv/ajoin.h
@@ -0,0 +1,37 @@
+/*
+ * 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 AutoJoin : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "autojoin";
+
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *acc) anope_abstract;
+
+ virtual Anope::string GetChannel() anope_abstract;
+ virtual void SetChannel(const Anope::string &c) anope_abstract;
+
+ virtual Anope::string GetKey() anope_abstract;
+ virtual void SetKey(const Anope::string &k) anope_abstract;
+};
+
diff --git a/include/modules/nickserv/cert.h b/include/modules/nickserv/cert.h
new file mode 100644
index 000000000..0db681122
--- /dev/null
+++ b/include/modules/nickserv/cert.h
@@ -0,0 +1,76 @@
+/*
+ * 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 NSCertEntry;
+
+class CertService : public Service
+{
+ public:
+ static constexpr const char *NAME = "certs";
+
+ CertService(Module *c) : Service(c, NAME) { }
+
+ virtual NickServ::Account* FindAccountFromCert(const Anope::string &cert) anope_abstract;
+
+ virtual bool Matches(User *, NickServ::Account *) anope_abstract;
+
+ virtual NSCertEntry *FindCert(const std::vector<NSCertEntry *> &cl, const Anope::string &certfp) anope_abstract;
+};
+
+class NSCertEntry : public Serialize::Object
+{
+ public:
+ static constexpr const char *NAME = "nscert";
+
+ using Serialize::Object::Object;
+
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
+
+ virtual Anope::string GetCert() anope_abstract;
+ virtual void SetCert(const Anope::string &) anope_abstract;
+};
+
+namespace Event
+{
+ struct CoreExport NickCertEvents : Events
+ {
+ static constexpr const char *NAME = "nickcertevents";
+
+ using Events::Events;
+
+ /** Called when a user adds an entry to their cert list
+ * @param nc The nick
+ * @param entry The entry
+ */
+ virtual void OnNickAddCert(NickServ::Account *nc, const Anope::string &entry) anope_abstract;
+
+ /** Called from NickServ::Account::EraseCert()
+ * @param nc pointer to the NickServ::Account
+ * @param entry The fingerprint
+ */
+ virtual void OnNickEraseCert(NickServ::Account *nc, const Anope::string &entry) anope_abstract;
+
+ /** called from NickServ::Account::ClearCert()
+ * @param nc pointer to the NickServ::Account
+ */
+ virtual void OnNickClearCert(NickServ::Account *nc) anope_abstract;
+ };
+}
+
diff --git a/include/modules/nickserv/drop.h b/include/modules/nickserv/drop.h
new file mode 100644
index 000000000..b01942702
--- /dev/null
+++ b/include/modules/nickserv/drop.h
@@ -0,0 +1,35 @@
+/*
+ * 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 NickDrop : Events
+ {
+ static constexpr const char *NAME = "nickdrop";
+
+ using Events::Events;
+
+ /** Called when a nick is dropped
+ * @param source The source of the command
+ * @param na The nick
+ */
+ virtual void OnNickDrop(CommandSource &source, NickServ::Nick *na) anope_abstract;
+ };
+}
+
diff --git a/include/modules/nickserv/group.h b/include/modules/nickserv/group.h
new file mode 100644
index 000000000..25fb288fd
--- /dev/null
+++ b/include/modules/nickserv/group.h
@@ -0,0 +1,35 @@
+/*
+ * 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 NickGroup : Events
+ {
+ static constexpr const char *NAME = "nickgroup";
+
+ using Events::Events;
+
+ /** Called when a user groups their nick
+ * @param u The user grouping
+ * @param target The target they're grouping to
+ */
+ virtual void OnNickGroup(User *u, NickServ::Nick *target) anope_abstract;
+ };
+}
+
diff --git a/include/modules/nickserv/info.h b/include/modules/nickserv/info.h
new file mode 100644
index 000000000..b836a8a85
--- /dev/null
+++ b/include/modules/nickserv/info.h
@@ -0,0 +1,37 @@
+/*
+ * 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 NickInfo : Events
+ {
+ static constexpr const char *NAME = "nickinfo";
+
+ using Events::Events;
+
+ /** Called when a user requests info for a nick
+ * @param source The user requesting info
+ * @param na The nick the user is requesting info from
+ * @param info Data to show the user requesting information
+ * @param show_hidden true if we should show the user everything
+ */
+ virtual void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_hidden) anope_abstract;
+ };
+}
+
diff --git a/include/modules/nickserv/nick.h b/include/modules/nickserv/nick.h
new file mode 100644
index 000000000..e5ee116d9
--- /dev/null
+++ b/include/modules/nickserv/nick.h
@@ -0,0 +1,63 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2011-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
+
+namespace NickServ
+{
+
+/* A registered nickname.
+ */
+class CoreExport Nick : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "nick";
+
+ virtual Anope::string GetNick() anope_abstract;
+ virtual void SetNick(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetLastQuit() anope_abstract;
+ virtual void SetLastQuit(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetLastRealname() anope_abstract;
+ virtual void SetLastRealname(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetLastUsermask() anope_abstract;
+ virtual void SetLastUsermask(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetLastRealhost() anope_abstract;
+ virtual void SetLastRealhost(const Anope::string &) anope_abstract;
+
+ virtual time_t GetTimeRegistered() anope_abstract;
+ virtual void SetTimeRegistered(const time_t &) anope_abstract;
+
+ virtual time_t GetLastSeen() anope_abstract;
+ virtual void SetLastSeen(const time_t &) anope_abstract;
+
+ virtual Account *GetAccount() anope_abstract;
+ virtual void SetAccount(Account *acc) anope_abstract;
+
+ virtual bool IsNoExpire() anope_abstract;
+ virtual void SetNoExpire(bool) anope_abstract;
+};
+
+} // namespace NickServ
diff --git a/include/modules/nickserv/set.h b/include/modules/nickserv/set.h
new file mode 100644
index 000000000..63d2a15f2
--- /dev/null
+++ b/include/modules/nickserv/set.h
@@ -0,0 +1,38 @@
+/*
+ * 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 SetNickOption : Events
+ {
+ static constexpr const char *NAME = "setnickoption";
+
+ using Events::Events;
+
+ /** Called when a nickserv/set command is used.
+ * @param source The source of the command
+ * @param cmd The command
+ * @param nc The nickcore being modifed
+ * @param setting The setting passed to the command. Probably ON/OFF.
+ * @return EVENT_STOP to halt immediately
+ */
+ virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickServ::Account *nc, const Anope::string &setting) anope_abstract;
+ };
+}
+
diff --git a/include/modules/nickserv/set_misc.h b/include/modules/nickserv/set_misc.h
new file mode 100644
index 000000000..8d49ac802
--- /dev/null
+++ b/include/modules/nickserv/set_misc.h
@@ -0,0 +1,37 @@
+/*
+ * 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 NSMiscData : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "nsmiscdata";
+
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
+
+ virtual Anope::string GetName() anope_abstract;
+ virtual void SetName(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetData() anope_abstract;
+ virtual void SetData(const Anope::string &) anope_abstract;
+};
+
diff --git a/include/modules/nickserv/suspend.h b/include/modules/nickserv/suspend.h
new file mode 100644
index 000000000..3f20d6d94
--- /dev/null
+++ b/include/modules/nickserv/suspend.h
@@ -0,0 +1,69 @@
+/*
+ * 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 NSSuspendInfo : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ static constexpr const char *const NAME = "nssuspendinfo";
+
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
+
+ virtual Anope::string GetBy() anope_abstract;
+ virtual void SetBy(const Anope::string &) anope_abstract;
+
+ virtual Anope::string GetReason() anope_abstract;
+ virtual void SetReason(const Anope::string &) anope_abstract;
+
+ virtual time_t GetWhen() anope_abstract;
+ virtual void SetWhen(const time_t &) anope_abstract;
+
+ virtual time_t GetExpires() anope_abstract;
+ virtual void SetExpires(const time_t &) anope_abstract;
+};
+
+namespace Event
+{
+ struct CoreExport NickSuspend : Events
+ {
+ static constexpr const char *NAME = "nicksuspend";
+
+ using Events::Events;
+
+ /** Called when a nick is suspended
+ * @param na The nick alias
+ */
+ virtual void OnNickSuspend(NickServ::Nick *na) anope_abstract;
+ };
+
+ struct CoreExport NickUnsuspend : Events
+ {
+ static constexpr const char *NAME = "nickunsuspend";
+
+ using Events::Events;
+
+ /** Called when a nick is unsuspneded
+ * @param na The nick alias
+ */
+ virtual void OnNickUnsuspend(NickServ::Nick *na) anope_abstract;
+ };
+}
diff --git a/include/modules/nickserv/update.h b/include/modules/nickserv/update.h
new file mode 100644
index 000000000..cc4702707
--- /dev/null
+++ b/include/modules/nickserv/update.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 NickUpdate : Events
+ {
+ static constexpr const char *NAME = "nickupdate";
+
+ using Events::Events;
+
+ /** Called when a user does /ns update
+ * @param u The user
+ */
+ virtual void OnNickUpdate(User *u) anope_abstract;
+ };
+}
+
diff --git a/include/modules/ns_cert.h b/include/modules/ns_cert.h
deleted file mode 100644
index b6d2fd2c4..000000000
--- a/include/modules/ns_cert.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* NickServ core functions
- *
- * (C) 2003-2017 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.
- */
-
-struct NSCertList
-{
- protected:
- NSCertList() { }
- public:
- virtual ~NSCertList() { }
-
- /** Add an entry to the nick's certificate list
- *
- * @param entry The fingerprint to add to the cert list
- *
- * Adds a new entry into the cert list.
- */
- virtual void AddCert(const Anope::string &entry) = 0;
-
- /** Get an entry from the nick's cert list by index
- *
- * @param entry Index in the certificaate list vector to retrieve
- * @return The fingerprint entry of the given index if within bounds, an empty string if the vector is empty or the index is out of bounds
- *
- * Retrieves an entry from the certificate list corresponding to the given index.
- */
- virtual Anope::string GetCert(unsigned entry) const = 0;
-
- virtual unsigned GetCertCount() const = 0;
-
- /** Find an entry in the nick's cert list
- *
- * @param entry The fingerprint to search for
- * @return True if the fingerprint is found in the cert list, false otherwise
- *
- * Search for an fingerprint within the cert list.
- */
- virtual bool FindCert(const Anope::string &entry) const = 0;
-
- /** Erase a fingerprint from the nick's certificate list
- *
- * @param entry The fingerprint to remove
- *
- * Removes the specified fingerprint from the cert list.
- */
- virtual void EraseCert(const Anope::string &entry) = 0;
-
- /** Clears the entire nick's cert list
- *
- * Deletes all the memory allocated in the certificate list vector and then clears the vector.
- */
- virtual void ClearCert() = 0;
-
- virtual void Check() = 0;
-};
-
-class CertService : public Service
-{
- public:
- CertService(Module *c) : Service(c, "CertService", "certs") { }
-
- virtual NickCore* FindAccountFromCert(const Anope::string &cert) = 0;
-};
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;
+};
+
diff --git a/include/modules/os_forbid.h b/include/modules/os_forbid.h
deleted file mode 100644
index 0742ecd8d..000000000
--- a/include/modules/os_forbid.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * (C) 2011-2017 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- */
-
-#ifndef OS_FORBID_H
-#define OS_FORBID_H
-
-enum ForbidType
-{
- FT_NICK = 1,
- FT_CHAN,
- FT_EMAIL,
- FT_REGISTER,
- FT_SIZE
-};
-
-struct ForbidData
-{
- Anope::string mask;
- Anope::string creator;
- Anope::string reason;
- time_t created;
- time_t expires;
- ForbidType type;
-
- virtual ~ForbidData() { }
- protected:
- ForbidData() : created(0), expires(0) { }
-};
-
-class ForbidService : public Service
-{
- public:
- ForbidService(Module *m) : Service(m, "ForbidService", "forbid") { }
-
- virtual void AddForbid(ForbidData *d) = 0;
-
- virtual void RemoveForbid(ForbidData *d) = 0;
-
- virtual ForbidData* CreateForbid() = 0;
-
- virtual ForbidData *FindForbid(const Anope::string &mask, ForbidType type) = 0;
-
- virtual std::vector<ForbidData *> GetForbids() = 0;
-};
-
-static ServiceReference<ForbidService> forbid_service("ForbidService", "forbid");
-
-#endif
diff --git a/include/modules/os_ignore.h b/include/modules/os_ignore.h
deleted file mode 100644
index 6d3680abb..000000000
--- a/include/modules/os_ignore.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* OperServ ignore interface
- *
- * (C) 2003-2017 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.
- */
-
-struct IgnoreData
-{
- Anope::string mask;
- Anope::string creator;
- Anope::string reason;
- time_t time; /* When do we stop ignoring them? */
-
- virtual ~IgnoreData() { }
- protected:
- IgnoreData() : time(0) { }
-};
-
-class IgnoreService : public Service
-{
- protected:
- IgnoreService(Module *c) : Service(c, "IgnoreService", "ignore") { }
-
- public:
- virtual void AddIgnore(IgnoreData *) = 0;
-
- virtual void DelIgnore(IgnoreData *) = 0;
-
- virtual void ClearIgnores() = 0;
-
- virtual IgnoreData *Create() = 0;
-
- virtual IgnoreData *Find(const Anope::string &mask) = 0;
-
- virtual std::vector<IgnoreData *> &GetIgnores() = 0;
-};
-
-static ServiceReference<IgnoreService> ignore_service("IgnoreService", "ignore");
diff --git a/include/modules/os_news.h b/include/modules/os_news.h
deleted file mode 100644
index c431071eb..000000000
--- a/include/modules/os_news.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *
- * (C) 2011-2017 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- */
-
-#ifndef OS_NEWS
-#define OS_NEWS
-
-enum NewsType
-{
- NEWS_LOGON,
- NEWS_RANDOM,
- NEWS_OPER
-};
-
-struct NewsMessages
-{
- NewsType type;
- Anope::string name;
- const char *msgs[10];
-};
-
-struct NewsItem : Serializable
-{
- NewsType type;
- Anope::string text;
- Anope::string who;
- time_t time;
-
- NewsItem() : Serializable("NewsItem") { }
-};
-
-class NewsService : public Service
-{
- public:
- NewsService(Module *m) : Service(m, "NewsService", "news") { }
-
- virtual NewsItem *CreateNewsItem() = 0;
-
- virtual void AddNewsItem(NewsItem *n) = 0;
-
- virtual void DelNewsItem(NewsItem *n) = 0;
-
- virtual std::vector<NewsItem *> &GetNewsList(NewsType t) = 0;
-};
-
-static ServiceReference<NewsService> news_service("NewsService", "news");
-
-#endif // OS_NEWS
diff --git a/include/modules/os_session.h b/include/modules/os_session.h
deleted file mode 100644
index cdb089800..000000000
--- a/include/modules/os_session.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- *
- * (C) 2011-2017 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- */
-
-#ifndef OS_SESSION_H
-#define OS_SESSION_H
-
-struct Session
-{
- cidr addr; /* A cidr (sockaddrs + len) representing this session */
- unsigned count; /* Number of clients with this host */
- unsigned hits; /* Number of subsequent kills for a host */
-
- Session(const sockaddrs &ip, int len) : addr(ip, len), count(1), hits(0) { }
-};
-
-struct Exception : Serializable
-{
- Anope::string mask; /* Hosts to which this exception applies */
- unsigned limit; /* Session limit for exception */
- Anope::string who; /* Nick of person who added the exception */
- Anope::string reason; /* Reason for exception's addition */
- time_t time; /* When this exception was added */
- time_t expires; /* Time when it expires. 0 == no expiry */
-
- Exception() : Serializable("Exception") { }
- void Serialize(Serialize::Data &data) const anope_override;
- static Serializable* Unserialize(Serializable *obj, Serialize::Data &data);
-};
-
-class SessionService : public Service
-{
- public:
- typedef TR1NS::unordered_map<cidr, Session *, cidr::hash> SessionMap;
- typedef std::vector<Exception *> ExceptionVector;
-
- SessionService(Module *m) : Service(m, "SessionService", "session") { }
-
- virtual Exception *CreateException() = 0;
-
- virtual void AddException(Exception *e) = 0;
-
- virtual void DelException(Exception *e) = 0;
-
- virtual Exception *FindException(User *u) = 0;
-
- virtual Exception *FindException(const Anope::string &host) = 0;
-
- virtual ExceptionVector &GetExceptions() = 0;
-
- virtual Session *FindSession(const Anope::string &ip) = 0;
-
- virtual SessionMap &GetSessions() = 0;
-};
-
-static ServiceReference<SessionService> session_service("SessionService", "session");
-
-void Exception::Serialize(Serialize::Data &data) const
-{
- data["mask"] << this->mask;
- data["limit"] << this->limit;
- data["who"] << this->who;
- data["reason"] << this->reason;
- data["time"] << this->time;
- data["expires"] << this->expires;
-}
-
-Serializable* Exception::Unserialize(Serializable *obj, Serialize::Data &data)
-{
- if (!session_service)
- return NULL;
-
- Exception *ex;
- if (obj)
- ex = anope_dynamic_static_cast<Exception *>(obj);
- else
- ex = new Exception;
- data["mask"] >> ex->mask;
- data["limit"] >> ex->limit;
- data["who"] >> ex->who;
- data["reason"] >> ex->reason;
- data["time"] >> ex->time;
- data["expires"] >> ex->expires;
-
- if (!obj)
- session_service->AddException(ex);
- return ex;
-}
-
-#endif
diff --git a/include/modules/protocol/bahamut.h b/include/modules/protocol/bahamut.h
new file mode 100644
index 000000000..beb17824e
--- /dev/null
+++ b/include/modules/protocol/bahamut.h
@@ -0,0 +1,270 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2003-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
+
+namespace bahamut
+{
+
+namespace senders
+{
+
+class Akill : public messages::Akill
+{
+ public:
+ using messages::Akill::Akill;
+
+ void Send(User *, XLine *) override;
+};
+
+class AkillDel : public messages::AkillDel
+{
+ public:
+ using messages::AkillDel::AkillDel;
+
+ void Send(XLine *) override;
+};
+
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
+
+ void Send(Channel *) override;
+};
+
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
+
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
+
+class Kill : public messages::Kill
+{
+ public:
+ using messages::Kill::Kill;
+
+ void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &reason) override;
+};
+
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
+
+ void Send(User *u, NickServ::Nick *na) override;
+};
+
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
+
+ void Send(User *u) override;
+};
+
+class ModeChannel : public messages::ModeChannel
+{
+ public:
+ using messages::ModeChannel::ModeChannel;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override;
+};
+
+class ModeUser : public messages::ModeUser
+{
+ public:
+ using messages::ModeUser::ModeUser;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class NOOP : public messages::NOOP
+{
+ public:
+ static constexpr const char *NAME = "noop";
+
+ using messages::NOOP::NOOP;
+
+ void Send(Server *s, bool mode) override;
+};
+
+class SGLine : public messages::SGLine
+{
+ public:
+ using messages::SGLine::SGLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SGLineDel : public messages::SGLineDel
+{
+ public:
+ using messages::SGLineDel::SGLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SQLine : public messages::SQLine
+{
+ public:
+ using messages::SQLine::SQLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SQLineDel : public messages::SQLineDel
+{
+ public:
+ using messages::SQLineDel::SQLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SZLine : public messages::SZLine
+{
+ public:
+ using messages::SZLine::SZLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SZLineDel : public messages::SZLineDel
+{
+ public:
+ using messages::SZLineDel::SZLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
+
+ void Send(const Anope::string &, time_t) override;
+};
+
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
+
+ void Send(const Anope::string &) override;
+};
+
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &source, const Anope::string &msg) override;
+};
+
+} // namespace senders
+
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator);
+
+ void SendBOB() override;
+
+ void SendEOB() override;
+
+ void Handshake() override;
+};
+
+class Burst : public IRCDMessage
+{
+ public:
+ Burst(Module *creator) : IRCDMessage(creator, "BURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Mode : public IRCDMessage
+{
+ public:
+ Mode(Module *creator, const Anope::string &sname) : IRCDMessage(creator, sname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Nick : public IRCDMessage
+{
+ public:
+ Nick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ServerMessage : public IRCDMessage
+{
+ public:
+ ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SJoin : public IRCDMessage
+{
+ public:
+ SJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Topic : public IRCDMessage
+{
+ public:
+ Topic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+} // namespace bahamut
diff --git a/include/modules/protocol/charybdis.h b/include/modules/protocol/charybdis.h
new file mode 100644
index 000000000..f3c06bfeb
--- /dev/null
+++ b/include/modules/protocol/charybdis.h
@@ -0,0 +1,144 @@
+/*
+ * 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
+
+#include "modules/protocol/ts6.h"
+#include "modules/protocol/ratbox.h"
+
+namespace charybdis
+{
+
+namespace senders
+{
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class SASL : public messages::SASL
+{
+ public:
+ using messages::SASL::SASL;
+
+ void Send(const ::SASL::Message &) override;
+};
+
+class SASLMechanisms : public messages::SASLMechanisms
+{
+ public:
+ using messages::SASLMechanisms::SASLMechanisms;
+
+ void Send(const std::vector<Anope::string> &mechanisms) override;
+};
+
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
+
+ void Send(const Anope::string &, time_t) override;
+};
+
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
+
+ void Send(const Anope::string &) override;
+};
+
+class SVSLogin : public messages::SVSLogin
+{
+ public:
+ using messages::SVSLogin::SVSLogin;
+
+ void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
+
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+} // namespace senders
+
+class Proto : public ts6::Proto
+{
+ ratbox::Proto ratbox;
+
+ public:
+ Proto(Module *creator);
+
+ bool IsIdentValid(const Anope::string &ident) override { return ratbox.IsIdentValid(ident); }
+
+ void Handshake() override;
+};
+
+class Encap : public IRCDMessage
+{
+ ServiceReference<SASL::Service> sasl;
+
+ public:
+ Encap(Module *creator) : IRCDMessage(creator, "ENCAP", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT);}
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class EUID : public IRCDMessage
+{
+ public:
+ EUID(Module *creator) : IRCDMessage(creator, "EUID", 11) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ServerMessage : public IRCDMessage
+{
+ public:
+ ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { }
+
+ // SERVER dev.anope.de 1 :charybdis test server
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Pass : public IRCDMessage
+{
+ public:
+ Pass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+} // namespace charybdis
diff --git a/include/modules/protocol/hybrid.h b/include/modules/protocol/hybrid.h
new file mode 100644
index 000000000..7843859c0
--- /dev/null
+++ b/include/modules/protocol/hybrid.h
@@ -0,0 +1,367 @@
+/*
+ * 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
+
+#include "modules/protocol/rfc1459.h"
+#include "modules/protocol/ts6.h"
+
+namespace hybrid
+{
+
+namespace senders
+{
+
+class Akill : public messages::Akill
+{
+ public:
+ using messages::Akill::Akill;
+
+ void Send(User *, XLine *) override;
+};
+
+class AkillDel : public messages::AkillDel
+{
+ public:
+ using messages::AkillDel::AkillDel;
+
+ void Send(XLine *) override;
+};
+
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
+
+ void Send(Channel *) override;
+};
+
+class GlobalNotice : public messages::GlobalNotice
+{
+ public:
+ using messages::GlobalNotice::GlobalNotice;
+
+ void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
+};
+
+class GlobalPrivmsg : public messages::GlobalPrivmsg
+{
+ public:
+ using messages::GlobalPrivmsg::GlobalPrivmsg;
+
+ void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
+};
+
+class Invite : public messages::Invite
+{
+ public:
+ using messages::Invite::Invite;
+
+ void Send(const MessageSource &source, Channel *chan, User *user) override;
+};
+
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
+
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
+
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
+
+ void Send(User *u, NickServ::Nick *na) override;
+};
+
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
+
+ void Send(User *u) override;
+};
+
+class ModeUser : public messages::ModeUser
+{
+ public:
+ using messages::ModeUser::ModeUser;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class MessageServer : public messages::MessageServer
+{
+ public:
+ using messages::MessageServer::MessageServer;
+
+ void Send(Server *server) override;
+};
+
+class SGLine : public messages::SGLine
+{
+ public:
+ using messages::SGLine::SGLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SGLineDel : public messages::SGLineDel
+{
+ public:
+ using messages::SGLineDel::SGLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SQLine : public messages::SQLine
+{
+ public:
+ using messages::SQLine::SQLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SQLineDel : public messages::SQLineDel
+{
+ public:
+ using messages::SQLineDel::SQLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SZLine : public messages::SZLine
+{
+ public:
+ using messages::SZLine::SZLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SZLineDel : public messages::SZLineDel
+{
+ public:
+ using messages::SZLineDel::SZLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
+
+ void Send(const Anope::string &, time_t) override;
+};
+
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
+
+ void Send(const Anope::string &) override;
+};
+
+class SVSJoin : public messages::SVSJoin
+{
+ public:
+ using messages::SVSJoin::SVSJoin;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override;
+};
+
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class SVSPart : public messages::SVSPart
+{
+ public:
+ using messages::SVSPart::SVSPart;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
+
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &source, const Anope::string &msg) override;
+};
+
+} // namespace senders
+
+class Proto : public ts6::Proto
+{
+ ServiceBot *FindIntroduced();
+
+ public:
+ Proto(Module *creator);
+
+ void Handshake() override;
+
+ void SendEOB() override;
+
+ bool IsIdentValid(const Anope::string &ident) override;
+};
+
+class BMask : public IRCDMessage
+{
+ public:
+ BMask(Module *creator) : IRCDMessage(creator, "BMASK", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class EOB : public IRCDMessage
+{
+ public:
+ EOB(Module *craetor) : IRCDMessage(craetor, "EOB", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Join : public rfc1459::Join
+{
+ public:
+ Join(Module *creator) : rfc1459::Join(creator, "JOIN") { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Nick : public IRCDMessage
+{
+ public:
+ Nick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Pong : public IRCDMessage
+{
+ public:
+ Pong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ServerMessage : public IRCDMessage
+{
+ public:
+ ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SID : public IRCDMessage
+{
+ public:
+ SID(Module *creator) : IRCDMessage(creator, "SID", 4) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SJoin : public IRCDMessage
+{
+ public:
+ SJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SVSMode : public IRCDMessage
+{
+ public:
+ SVSMode(Module *creator) : IRCDMessage(creator, "SVSMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class TBurst : public IRCDMessage
+{
+ public:
+ TBurst(Module *creator) : IRCDMessage(creator, "TBURST", 5) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class TMode : public IRCDMessage
+{
+ public:
+ TMode(Module *creator) : IRCDMessage(creator, "TMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class UID : public IRCDMessage
+{
+ public:
+ UID(Module *creator) : IRCDMessage(creator, "UID", 10) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class CertFP : public IRCDMessage
+{
+ public:
+ CertFP(Module *creator) : IRCDMessage(creator, "CERTFP", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+} // namespace hybrid
diff --git a/include/modules/protocol/inspircd20.h b/include/modules/protocol/inspircd20.h
new file mode 100644
index 000000000..efaec22a5
--- /dev/null
+++ b/include/modules/protocol/inspircd20.h
@@ -0,0 +1,506 @@
+/*
+ * 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
+
+#include "modules/protocol/ts6.h"
+
+namespace inspircd20
+{
+
+class Proto;
+
+namespace senders
+{
+
+class Akill : public messages::Akill
+{
+ Proto *proto = nullptr;
+
+ public:
+ Akill(Module *creator, Proto *p) : messages::Akill(creator),
+ proto(p)
+ {
+ }
+
+ void Send(User *, XLine *) override;
+};
+
+class AkillDel : public messages::AkillDel
+{
+ Proto *proto = nullptr;
+
+ public:
+ AkillDel(Module *creator, Proto *p) : messages::AkillDel(creator),
+ proto(p)
+ {
+ }
+
+ void Send(XLine *) override;
+};
+
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
+
+ void Send(Channel *) override;
+};
+
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
+
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
+
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
+
+ void Send(User *u, NickServ::Nick *na) override;
+};
+
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
+
+ void Send(User *u) override;
+};
+
+class ModeChannel : public messages::ModeChannel
+{
+ public:
+ using messages::ModeChannel::ModeChannel;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class MessageServer : public messages::MessageServer
+{
+ public:
+ using messages::MessageServer::MessageServer;
+
+ void Send(Server *server) override;
+};
+
+class SASL : public messages::SASL
+{
+ public:
+ using messages::SASL::SASL;
+
+ void Send(const ::SASL::Message &) override;
+};
+
+class SASLMechanisms : public messages::SASLMechanisms
+{
+ public:
+ using messages::SASLMechanisms::SASLMechanisms;
+
+ void Send(const std::vector<Anope::string> &mechanisms) override;
+};
+
+class SQLine : public messages::SQLine
+{
+ Proto *proto = nullptr;
+
+ public:
+ SQLine(Module *creator, Proto *p) : messages::SQLine(creator),
+ proto(p)
+ {
+ }
+
+ void Send(User *, XLine *) override;
+};
+
+class SQLineDel : public messages::SQLineDel
+{
+ Proto *proto = nullptr;
+
+ public:
+ SQLineDel(Module *creator, Proto *p) : messages::SQLineDel(creator),
+ proto(p)
+ {
+ }
+
+ void Send(XLine *) override;
+};
+
+class SQuit : public messages::SQuit
+{
+ public:
+ using messages::SQuit::SQuit;
+
+ void Send(Server *s, const Anope::string &message) override;
+};
+
+class SZLine : public messages::SZLine
+{
+ Proto *proto = nullptr;
+
+ public:
+ SZLine(Module *creator, Proto *p) : messages::SZLine(creator),
+ proto(p)
+ {
+ }
+
+ void Send(User *, XLine *) override;
+};
+
+class SZLineDel : public messages::SZLineDel
+{
+ Proto *proto = nullptr;
+
+ public:
+ SZLineDel(Module *creator, Proto *p) : messages::SZLineDel(creator),
+ proto(p)
+ {
+ }
+
+ void Send(XLine *) override;
+};
+
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
+
+ void Send(const Anope::string &, time_t) override;
+};
+
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
+
+ void Send(const Anope::string &) override;
+};
+
+class SVSJoin : public messages::SVSJoin
+{
+ public:
+ using messages::SVSJoin::SVSJoin;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override;
+};
+
+class SVSLogin : public messages::SVSLogin
+{
+ public:
+ using messages::SVSLogin::SVSLogin;
+
+ void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class SVSPart : public messages::SVSPart
+{
+ public:
+ using messages::SVSPart::SVSPart;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override;
+};
+
+class SWhois : public messages::SWhois
+{
+ public:
+ using messages::SWhois::SWhois;
+
+ void Send(const MessageSource &, User *user, const Anope::string &) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ Proto *proto = nullptr;
+
+ public:
+ VhostDel(Module *creator, Proto *p) : messages::VhostDel(creator),
+ proto(p)
+ {
+ }
+
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ Proto *proto = nullptr;
+
+ public:
+ VhostSet(Module *creator, Proto *p) : messages::VhostSet(creator),
+ proto(p)
+ {
+ }
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &source, const Anope::string &msg) override;
+};
+
+} // namespace senders
+
+class Proto : public ts6::Proto
+{
+ public:
+ Proto(Module *creator);
+
+ void SendChgIdentInternal(const Anope::string &nick, const Anope::string &vIdent);
+
+ void SendChgHostInternal(const Anope::string &nick, const Anope::string &vhost);
+
+ void SendAddLine(const Anope::string &xtype, const Anope::string &mask, time_t duration, const Anope::string &addedby, const Anope::string &reason);
+
+ void SendDelLine(const Anope::string &xtype, const Anope::string &mask);
+
+ void Handshake() override;
+
+ void SendNumeric(int numeric, User *dest, IRCMessage &message) override;
+
+ void SendBOB() override;
+
+ void SendEOB() override;
+
+ bool IsExtbanValid(const Anope::string &mask) override;
+
+ bool IsIdentValid(const Anope::string &ident) override;
+};
+
+class Capab : public rfc1459::Capab
+{
+ public:
+ Capab(Module *creator) : rfc1459::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ChgHost : public IRCDMessage
+{
+ public:
+ ChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ChgIdent : public IRCDMessage
+{
+ public:
+ ChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ChgName : public IRCDMessage
+{
+ public:
+ ChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Encap : public IRCDMessage
+{
+ public:
+ Encap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Endburst : public IRCDMessage
+{
+ public:
+ Endburst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class FHost : public IRCDMessage
+{
+ public:
+ FHost(Module *creator) : IRCDMessage(creator, "FHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class FIdent : public IRCDMessage
+{
+ public:
+ FIdent(Module *creator) : IRCDMessage(creator, "FIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class FJoin : public IRCDMessage
+{
+ public:
+ FJoin(Module *creator) : IRCDMessage(creator, "FJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class FMode : public IRCDMessage
+{
+ public:
+ FMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class FTopic : public IRCDMessage
+{
+ public:
+ FTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Idle : public IRCDMessage
+{
+ public:
+ Idle(Module *creator) : IRCDMessage(creator, "IDLE", 1) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Metadata : public IRCDMessage
+{
+ public:
+ const bool &do_topiclock, &do_mlock;
+
+ Metadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock)
+ : IRCDMessage(creator, "METADATA", 3)
+ , do_topiclock(handle_topiclock)
+ , do_mlock(handle_mlock)
+ {
+ SetFlag(IRCDMESSAGE_REQUIRE_SERVER);
+ }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Mode : public IRCDMessage
+{
+ public:
+ Mode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Nick : public IRCDMessage
+{
+ public:
+ Nick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class OperType : public IRCDMessage
+{
+ public:
+ OperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class RSQuit : public IRCDMessage
+{
+ public:
+ RSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Save : public IRCDMessage
+{
+ time_t last_collide = 0;
+
+ public:
+ Save(Module *creator) : IRCDMessage(creator, "SAVE", 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ServerMessage : public IRCDMessage
+{
+ public:
+ ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 5) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SQuit : public rfc1459::SQuit
+{
+ public:
+ using rfc1459::SQuit::SQuit;
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Time : public IRCDMessage
+{
+ public:
+ Time(Module *creator) : IRCDMessage(creator, "TIME", 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class UID : public IRCDMessage
+{
+ ServiceReference<SASL::Service> sasl;
+
+ public:
+ UID(Module *creator) : IRCDMessage(creator, "UID", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+} // namespace inspircd20
+
diff --git a/include/modules/protocol/ngircd.h b/include/modules/protocol/ngircd.h
new file mode 100644
index 000000000..793ffd5bf
--- /dev/null
+++ b/include/modules/protocol/ngircd.h
@@ -0,0 +1,213 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2011-2017 Anope Team <team@anope.org>
+ * Copyright (C) 2011-2012, 2014 Alexander Barton <alex@barton.de>
+ *
+ * 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
+
+namespace ngircd
+{
+
+namespace senders
+{
+
+class Akill : public messages::Akill
+{
+ public:
+ using messages::Akill::Akill;
+
+ void Send(User *, XLine *) override;
+};
+
+class AkillDel : public messages::AkillDel
+{
+ public:
+ using messages::AkillDel::AkillDel;
+
+ void Send(XLine *) override;
+};
+
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
+
+ void Send(Channel *) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
+
+ void Send(User *u, NickServ::Nick *na) override;
+};
+
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
+
+ void Send(User *u) override;
+};
+
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
+
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+}
+
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator);
+
+ void Handshake() override;
+
+ Anope::string Format(IRCMessage &message) override;
+};
+
+class Numeric005 : public IRCDMessage
+{
+ public:
+ Numeric005(Module *creator) : IRCDMessage(creator, "005", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ChanInfo : public IRCDMessage
+{
+ public:
+ ChanInfo(Module *creator) : IRCDMessage(creator, "CHANINFO", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ /*
+ * CHANINFO is used by servers to inform each other about a channel: its
+ * modes, channel key, user limits and its topic. The parameter combination
+ * <key> and <limit> is optional, as well as the <topic> parameter, so that
+ * there are three possible forms of this command:
+ *
+ * CHANINFO <chan> +<modes>
+ * CHANINFO <chan> +<modes> :<topic>
+ * CHANINFO <chan> +<modes> <key> <limit> :<topic>
+ *
+ * The parameter <key> must be ignored if a channel has no key (the parameter
+ * <modes> doesn't list the "k" channel mode). In this case <key> should
+ * contain "*" because the parameter <key> is required by the CHANINFO syntax
+ * and therefore can't be omitted. The parameter <limit> must be ignored when
+ * a channel has no user limit (the parameter <modes> doesn't list the "l"
+ * channel mode). In this case <limit> should be "0".
+ */
+ void Run(MessageSource &source, const std::vector<Anope::string> &params);
+};
+
+class Join : public rfc1459::Join
+{
+ public:
+ Join(Module *creator) : rfc1459::Join(creator, "JOIN") { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Metadata : public IRCDMessage
+{
+ public:
+ Metadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Mode : public IRCDMessage
+{
+ public:
+ Mode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+struct Nick : public IRCDMessage
+{
+ public:
+ Nick(Module *creator) : IRCDMessage(creator, "NICK", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class NJoin : public IRCDMessage
+{
+ public:
+ NJoin(Module *creator) : IRCDMessage(creator, "NJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); };
+
+ /*
+ * RFC 2813, 4.2.2: Njoin Message:
+ * The NJOIN message is used between servers only.
+ * It is used when two servers connect to each other to exchange
+ * the list of channel members for each channel.
+ *
+ * Even though the same function can be performed by using a succession
+ * of JOIN, this message SHOULD be used instead as it is more efficient.
+ *
+ * Received: :dev.anope.de NJOIN #test :DukeP2,@DukeP,%test,+test2
+ */
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Pong : public IRCDMessage
+{
+ public:
+ Pong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ServerMessage : public IRCDMessage
+{
+ public:
+ ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+} // namespace ngircd
diff --git a/include/modules/protocol/plexus.h b/include/modules/protocol/plexus.h
new file mode 100644
index 000000000..4d35cdd1f
--- /dev/null
+++ b/include/modules/protocol/plexus.h
@@ -0,0 +1,157 @@
+/*
+ * 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
+
+#include "modules/protocol/ts6.h"
+
+namespace plexus
+{
+
+namespace senders
+{
+
+class ModeUser : public messages::ModeUser
+{
+ public:
+ using messages::ModeUser::ModeUser;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class NOOP : public messages::NOOP
+{
+ public:
+ static constexpr const char *NAME = "noop";
+
+ using messages::NOOP::NOOP;
+
+ void Send(Server *s, bool mode) override;
+};
+
+class SASL : public messages::SASL
+{
+ public:
+ using messages::SASL::SASL;
+
+ void Send(const ::SASL::Message &) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class SVSJoin : public messages::SVSJoin
+{
+ public:
+ using messages::SVSJoin::SVSJoin;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override;
+};
+
+class SVSLogin : public messages::SVSLogin
+{
+ public:
+ using messages::SVSLogin::SVSLogin;
+
+ void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class SVSPart : public messages::SVSPart
+{
+ public:
+ using messages::SVSPart::SVSPart;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
+
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+} // namespace senders
+
+class Proto : public ts6::Proto
+{
+ public:
+ Proto(Module *creator);
+
+ void Handshake() override;
+};
+
+class Encap : public IRCDMessage
+{
+ ServiceReference<SASL::Service> sasl;
+
+ public:
+ Encap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ServerMessage : public IRCDMessage
+{
+ public:
+ ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class UID : public IRCDMessage
+{
+ public:
+ UID(Module *creator) : IRCDMessage(creator, "UID", 11) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+} // namespace plexus
+
diff --git a/include/modules/protocol/ratbox.h b/include/modules/protocol/ratbox.h
new file mode 100644
index 000000000..475b368cc
--- /dev/null
+++ b/include/modules/protocol/ratbox.h
@@ -0,0 +1,152 @@
+/*
+ * 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
+
+#include "modules/protocol/rfc1459.h"
+#include "modules/protocol/ts6.h"
+
+namespace ratbox
+{
+
+namespace senders
+{
+
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
+
+ void Send(User *u, NickServ::Nick *na) override;
+};
+
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
+
+ void Send(User *u) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class SQLine : public messages::SQLine
+{
+ public:
+ using messages::SQLine::SQLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SQLineDel : public messages::SQLineDel
+{
+ public:
+ using messages::SQLineDel::SQLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SVSNick : public messages::SVSNick
+{
+ public:
+ using messages::SVSNick::SVSNick;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class Topic : public rfc1459::senders::Topic
+{
+ public:
+ using rfc1459::senders::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &source, const Anope::string &msg) override;
+};
+
+} // senders
+
+class Proto : public ts6::Proto
+{
+ hybrid::Proto hybrid;
+
+ ServiceBot *FindIntroduced();
+
+ public:
+ Proto(Module *creator);
+
+ bool IsIdentValid(const Anope::string &ident) override { return hybrid.IsIdentValid(ident); }
+
+ void Handshake() override;
+};
+
+class Encap : public IRCDMessage
+{
+ public:
+ Encap(Module *creator) : IRCDMessage(creator, "ENCAP", 3) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ // Debug: Received: :00BAAAAAB ENCAP * LOGIN Adam
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Join : public rfc1459::Join
+{
+ public:
+ Join(Module *creator) : rfc1459::Join(creator, "JOIN") { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ServerMessage : public IRCDMessage
+{
+ public:
+ ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class TB : public IRCDMessage
+{
+ public:
+ TB(Module *creator) : IRCDMessage(creator, "TB", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class UID : public IRCDMessage
+{
+ public:
+ UID(Module *creator) : IRCDMessage(creator, "UID", 9) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+} // namespace ratbox
diff --git a/include/modules/protocol/rfc1459.h b/include/modules/protocol/rfc1459.h
new file mode 100644
index 000000000..54c4bada5
--- /dev/null
+++ b/include/modules/protocol/rfc1459.h
@@ -0,0 +1,355 @@
+/*
+ * 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
+
+namespace rfc1459
+{
+
+namespace senders
+{
+
+class GlobalNotice : public messages::GlobalNotice
+{
+ public:
+ using messages::GlobalNotice::GlobalNotice;
+
+ void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
+};
+
+class GlobalPrivmsg : public messages::GlobalPrivmsg
+{
+ public:
+ using messages::GlobalPrivmsg::GlobalPrivmsg;
+
+ void Send(const MessageSource &, Server *dest, const Anope::string &msg) override;
+};
+
+class Invite : public messages::Invite
+{
+ public:
+ using messages::Invite::Invite;
+
+ void Send(const MessageSource &source, Channel *chan, User *user) override;
+};
+
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
+
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
+
+class Kick : public messages::Kick
+{
+ public:
+ using messages::Kick::Kick;
+
+ void Send(const MessageSource &source, Channel *chan, User *user, const Anope::string &reason) override;
+};
+
+class Kill : public messages::Kill
+{
+ public:
+ using messages::Kill::Kill;
+
+ void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &reason) override;
+};
+
+class ModeChannel : public messages::ModeChannel
+{
+ public:
+ using messages::ModeChannel::ModeChannel;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &modes) override;
+};
+
+class ModeUser : public messages::ModeUser
+{
+ public:
+ using messages::ModeUser::ModeUser;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
+
+class NickChange : public messages::NickChange
+{
+ public:
+ using messages::NickChange::NickChange;
+
+ void Send(User *u, const Anope::string &newnick, time_t ts) override;
+};
+
+class Notice : public messages::Notice
+{
+ public:
+ using messages::Notice::Notice;
+
+ void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) override;
+};
+
+class Part : public messages::Part
+{
+ public:
+ using messages::Part::Part;
+
+ void Send(User *, Channel *chan, const Anope::string &reason) override;
+};
+
+class Ping : public messages::Ping
+{
+ public:
+ using messages::Ping::Ping;
+
+ void Send(const Anope::string &servname, const Anope::string &who) override;
+};
+
+class Pong : public messages::Pong
+{
+ public:
+ using messages::Pong::Pong;
+
+ void Send(const Anope::string &servname, const Anope::string &who) override;
+};
+
+class Privmsg : public messages::Privmsg
+{
+ public:
+ using messages::Privmsg::Privmsg;
+
+ void Send(const MessageSource &source, const Anope::string &dest, const Anope::string &msg) override;
+};
+
+class Quit : public messages::Quit
+{
+ public:
+ using messages::Quit::Quit;
+
+ void Send(User *user, const Anope::string &reason) override;
+};
+
+class MessageServer : public messages::MessageServer
+{
+ public:
+ using messages::MessageServer::MessageServer;
+
+ void Send(Server *server) override;
+};
+
+class SQuit : public messages::SQuit
+{
+ public:
+ using messages::SQuit::SQuit;
+
+ void Send(Server *s, const Anope::string &message) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &, const Anope::string &msg) override;
+};
+
+} // namespace senders
+
+class Away : public IRCDMessage
+{
+ public:
+ Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Capab : public IRCDMessage
+{
+ public:
+ Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Error : public IRCDMessage
+{
+ public:
+ Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Invite : public IRCDMessage
+{
+ public:
+ Invite(Module *creator, const Anope::string &mname = "INVITE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Join : public IRCDMessage
+{
+ public:
+ Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+
+ typedef std::pair<ChannelStatus, User *> SJoinUser;
+
+ /** Handle a SJOIN.
+ * @param source The source of the SJOIN
+ * @param chan The channel the users are joining to
+ * @param ts The TS for the channel
+ * @param modes The modes sent with the SJOIN, if any
+ * @param users The users and their status, if any
+ */
+ static void SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users);
+};
+
+class Kick : public IRCDMessage
+{
+ public:
+ Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Kill : public IRCDMessage
+{
+ public:
+ Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Mode : public IRCDMessage
+{
+ public:
+ Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class MOTD : public IRCDMessage
+{
+ public:
+ MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Notice : public IRCDMessage
+{
+ public:
+ Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Part : public IRCDMessage
+{
+ public:
+ Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Ping : public IRCDMessage
+{
+ public:
+ Ping(Module *creator, const Anope::string &mname = "PING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Privmsg : public IRCDMessage
+{
+ public:
+ Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Quit : public IRCDMessage
+{
+ public:
+ Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SQuit : public IRCDMessage
+{
+ public:
+ SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Stats : public IRCDMessage
+{
+ public:
+ Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Time : public IRCDMessage
+{
+ public:
+ Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Topic : public IRCDMessage
+{
+ public:
+ Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Version : public IRCDMessage
+{
+ public:
+ Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Whois : public IRCDMessage
+{
+ public:
+ Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+} // namespace rfc1459
diff --git a/include/modules/protocol/ts6.h b/include/modules/protocol/ts6.h
new file mode 100644
index 000000000..71748b5b7
--- /dev/null
+++ b/include/modules/protocol/ts6.h
@@ -0,0 +1,37 @@
+/*
+ * 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
+
+namespace ts6
+{
+
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator, const Anope::string &proto_name) : IRCDProto(creator, proto_name)
+ {
+ }
+
+ /* Retrieves the next free UID or SID */
+ Anope::string UID_Retrieve() override;
+ Anope::string SID_Retrieve() override;
+};
+
+} // namespace ts6
diff --git a/include/modules/protocol/unreal.h b/include/modules/protocol/unreal.h
new file mode 100644
index 000000000..21aa31f41
--- /dev/null
+++ b/include/modules/protocol/unreal.h
@@ -0,0 +1,430 @@
+/*
+ * Anope IRC Services
+ *
+ * Copyright (C) 2003-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
+
+namespace unreal
+{
+
+namespace senders
+{
+
+class Akill : public messages::Akill
+{
+ public:
+ using messages::Akill::Akill;
+
+ void Send(User *, XLine *) override;
+};
+
+class AkillDel : public messages::AkillDel
+{
+ public:
+ using messages::AkillDel::AkillDel;
+
+ void Send(XLine *) override;
+};
+
+class MessageChannel : public messages::MessageChannel
+{
+ public:
+ using messages::MessageChannel::MessageChannel;
+
+ void Send(Channel *) override;
+};
+
+class Join : public messages::Join
+{
+ public:
+ using messages::Join::Join;
+
+ void Send(User *u, Channel *c, const ChannelStatus *status) override;
+};
+
+class Login : public messages::Login
+{
+ public:
+ using messages::Login::Login;
+
+ void Send(User *u, NickServ::Nick *na) override;
+};
+
+class Logout : public messages::Logout
+{
+ public:
+ using messages::Logout::Logout;
+
+ void Send(User *u) override;
+};
+
+class Kill : public messages::Kill
+{
+ public:
+ using messages::Kill::Kill;
+
+ void Send(const MessageSource &source, const Anope::string &target, const Anope::string &reason) override;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &reason) override;
+};
+
+class ModeUser : public messages::ModeUser
+{
+ public:
+ using messages::ModeUser::ModeUser;
+
+ void Send(const MessageSource &source, User *user, const Anope::string &modes) override;
+};
+
+class NickIntroduction : public messages::NickIntroduction
+{
+ public:
+ using messages::NickIntroduction::NickIntroduction;
+
+ void Send(User *user) override;
+};
+
+class SASL : public messages::SASL
+{
+ public:
+ using messages::SASL::SASL;
+
+ void Send(const ::SASL::Message &) override;
+};
+
+class MessageServer : public messages::MessageServer
+{
+ public:
+ using messages::MessageServer::MessageServer;
+
+ void Send(Server *server) override;
+};
+
+class SGLine : public messages::SGLine
+{
+ public:
+ using messages::SGLine::SGLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SGLineDel : public messages::SGLineDel
+{
+ public:
+ using messages::SGLineDel::SGLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SQLine : public messages::SQLine
+{
+ public:
+ using messages::SQLine::SQLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SQLineDel : public messages::SQLineDel
+{
+ public:
+ using messages::SQLineDel::SQLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SZLine : public messages::SZLine
+{
+ public:
+ using messages::SZLine::SZLine;
+
+ void Send(User *, XLine *) override;
+};
+
+class SZLineDel : public messages::SZLineDel
+{
+ public:
+ using messages::SZLineDel::SZLineDel;
+
+ void Send(XLine *) override;
+};
+
+class SVSHold : public messages::SVSHold
+{
+ public:
+ using messages::SVSHold::SVSHold;
+
+ void Send(const Anope::string &, time_t) override;
+};
+
+class SVSHoldDel : public messages::SVSHoldDel
+{
+ public:
+ using messages::SVSHoldDel::SVSHoldDel;
+
+ void Send(const Anope::string &) override;
+};
+
+class SVSJoin : public messages::SVSJoin
+{
+ public:
+ using messages::SVSJoin::SVSJoin;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &key) override;
+};
+
+class SVSLogin : public messages::SVSLogin
+{
+ public:
+ using messages::SVSLogin::SVSLogin;
+
+ void Send(const Anope::string &uid, const Anope::string &acc, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class SVSPart : public messages::SVSPart
+{
+ public:
+ using messages::SVSPart::SVSPart;
+
+ void Send(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &reason) override;
+};
+
+class SWhois : public messages::SWhois
+{
+ public:
+ using messages::SWhois::SWhois;
+
+ void Send(const MessageSource &, User *user, const Anope::string &) override;
+};
+
+class Topic : public messages::Topic
+{
+ public:
+ using messages::Topic::Topic;
+
+ void Send(const MessageSource &source, Channel *channel, const Anope::string &topic, time_t topic_ts, const Anope::string &topic_setter) override;
+};
+
+class VhostDel : public messages::VhostDel
+{
+ public:
+ using messages::VhostDel::VhostDel;
+
+ void Send(User *u) override;
+};
+
+class VhostSet : public messages::VhostSet
+{
+ public:
+ using messages::VhostSet::VhostSet;
+
+ void Send(User *u, const Anope::string &vident, const Anope::string &vhost) override;
+};
+
+class Wallops : public messages::Wallops
+{
+ public:
+ using messages::Wallops::Wallops;
+
+ void Send(const MessageSource &source, const Anope::string &msg) override;
+};
+
+} // namespace senders
+
+class Proto : public IRCDProto
+{
+ public:
+ Proto(Module *creator);
+
+ private:
+
+ void Handshake() override;
+
+ void SendEOB() override;
+
+ bool IsNickValid(const Anope::string &nick) override;
+
+ bool IsChannelValid(const Anope::string &chan) override;
+
+ bool IsExtbanValid(const Anope::string &mask) override;
+
+ bool IsIdentValid(const Anope::string &ident) override;
+};
+
+class ChgHost : public IRCDMessage
+{
+ public:
+ ChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ChgIdent : public IRCDMessage
+{
+ public:
+ ChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ChgName : public IRCDMessage
+{
+ public:
+ ChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class MD : public IRCDMessage
+{
+ public:
+ MD(Module *creator) : IRCDMessage(creator, "MD", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Mode : public IRCDMessage
+{
+ public:
+ Mode(Module *creator, const Anope::string &mname) : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class NetInfo : public IRCDMessage
+{
+ public:
+ NetInfo(Module *creator) : IRCDMessage(creator, "NETINFO", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Nick : public IRCDMessage
+{
+ public:
+ Nick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Pong : public IRCDMessage
+{
+ public:
+ Pong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Protoctl : public rfc1459::Capab
+{
+ public:
+ Protoctl(Module *creator) : rfc1459::Capab(creator, "PROTOCTL") { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SASL : public IRCDMessage
+{
+ ServiceReference<::SASL::Service> sasl;
+
+ public:
+ SASL(Module *creator) : IRCDMessage(creator, "SASL", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SDesc : public IRCDMessage
+{
+ public:
+ SDesc(Module *creator) : IRCDMessage(creator, "SDESC", 1) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SetHost : public IRCDMessage
+{
+ public:
+ SetHost(Module *creator) : IRCDMessage(creator, "SETHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SetIdent : public IRCDMessage
+{
+ public:
+ SetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+struct SetName : IRCDMessage
+{
+ public:
+ SetName(Module *creator) : IRCDMessage(creator, "SETNAME", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class ServerMessage : public IRCDMessage
+{
+ public:
+ ServerMessage(Module *creator) : IRCDMessage(creator, "SERVER", 3) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SID : public IRCDMessage
+{
+ public:
+ SID(Module *creator) : IRCDMessage(creator, "SID", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class SJoin : public IRCDMessage
+{
+ public:
+ SJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Topic : public IRCDMessage
+{
+ public:
+ Topic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class UID : public IRCDMessage
+{
+ public:
+ UID(Module *creator) : IRCDMessage(creator, "UID", 12) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+class Umode2 : public IRCDMessage
+{
+ public:
+ Umode2(Module *creator) : IRCDMessage(creator, "UMODE2", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override;
+};
+
+} // namespace unreal
diff --git a/include/modules/pseudoclients/chanserv.h b/include/modules/pseudoclients/chanserv.h
deleted file mode 100644
index 96d3cfdcd..000000000
--- a/include/modules/pseudoclients/chanserv.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *
- * (C) 2011-2017 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- */
-
-#ifndef CHANSERV_H
-#define CHANSERV_H
-
-class ChanServService : public Service
-{
- public:
- ChanServService(Module *m) : Service(m, "ChanServService", "ChanServ")
- {
- }
-
- /* Have ChanServ hold the channel, that is, join and set +nsti and wait
- * for a few minutes so no one can join or rejoin.
- */
- virtual void Hold(Channel *c) = 0;
-};
-
-#endif // CHANSERV_H
diff --git a/include/modules/pseudoclients/global.h b/include/modules/pseudoclients/global.h
deleted file mode 100644
index 6d085f1a1..000000000
--- a/include/modules/pseudoclients/global.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * (C) 2011-2017 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- */
-
-#ifndef GLOBAL_H
-#define GLOBAL_H
-
-class GlobalService : public Service
-{
- public:
- GlobalService(Module *m) : Service(m, "GlobalService", "Global")
- {
- }
-
- /** Send out a global message to all users
- * @param sender Our client which should send the global
- * @param source The sender of the global
- * @param message The message
- */
- virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0;
-};
-
-#endif // GLOBAL_H
diff --git a/include/modules/pseudoclients/memoserv.h b/include/modules/pseudoclients/memoserv.h
deleted file mode 100644
index a83a3d6f9..000000000
--- a/include/modules/pseudoclients/memoserv.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * (C) 2011-2017 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- */
-
-#ifndef MEMOSERV_H
-#define MEMOSERV_H
-
-class MemoServService : public Service
-{
- public:
- enum MemoResult
- {
- MEMO_SUCCESS,
- MEMO_INVALID_TARGET,
- MEMO_TOO_FAST,
- MEMO_TARGET_FULL
- };
-
- MemoServService(Module *m) : Service(m, "MemoServService", "MemoServ")
- {
- }
-
- /** Sends a memo.
- * @param source The source of the memo, can be anythin.
- * @param target The target of the memo, nick or channel.
- * @param message Memo text
- * @param force true to force the memo, restrictions/delays etc are not checked
- */
- virtual MemoResult Send(const Anope::string &source, const Anope::string &target, const Anope::string &message, bool force = false) = 0;
-
- /** Check for new memos and notify the user if there are any
- * @param u The user
- */
- virtual void Check(User *u) = 0;
-};
-
-#endif // MEMOSERV_H
diff --git a/include/modules/pseudoclients/nickserv.h b/include/modules/pseudoclients/nickserv.h
deleted file mode 100644
index ce2823d65..000000000
--- a/include/modules/pseudoclients/nickserv.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *
- * (C) 2011-2017 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- */
-
-#ifndef NICKSERV_H
-#define NICKSERV_H
-
-class NickServService : public Service
-{
- public:
- NickServService(Module *m) : Service(m, "NickServService", "NickServ")
- {
- }
-
- virtual void Validate(User *u) = 0;
- virtual void Collide(User *u, NickAlias *na) = 0;
- virtual void Release(NickAlias *na) = 0;
-};
-
-#endif // NICKSERV_H
diff --git a/include/modules/redis.h b/include/modules/redis.h
index 4bb62c7c6..874bff998 100644
--- a/include/modules/redis.h
+++ b/include/modules/redis.h
@@ -1,9 +1,20 @@
/*
+ * Anope IRC Services
*
- * (C) 2003-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2013-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * 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 Redis
@@ -23,7 +34,7 @@ namespace Redis
Reply() { Clear(); }
~Reply() { Clear(); }
-
+
void Clear()
{
type = NOT_PARSED;
@@ -43,30 +54,46 @@ namespace Redis
class Interface
{
- public:
Module *owner;
+ public:
Interface(Module *m) : owner(m) { }
- virtual ~Interface() { }
+ virtual ~Interface() = default;
+
+ Module *GetOwner() const { return owner; }
- virtual void OnResult(const Reply &r) = 0;
- virtual void OnError(const Anope::string &error) { Log(owner) << error; }
+ virtual void OnResult(const Reply &r) anope_abstract;
+ virtual void OnError(const Anope::string &error) { owner->logger.Log(error); }
+ };
+
+ class FInterface : public Interface
+ {
+ public:
+ using Func = std::function<void(const Reply &)>;
+ Func function;
+
+ FInterface(Module *m, Func f) : Interface(m), function(f) { }
+
+ void OnResult(const Reply &r) override { function(r); }
};
class Provider : public Service
{
public:
- Provider(Module *c, const Anope::string &n) : Service(c, "Redis::Provider", n) { }
+ static constexpr const char *NAME = "redis";
+
+ Provider(Module *c, const Anope::string &n) : Service(c, NAME, n) { }
- virtual void SendCommand(Interface *i, const std::vector<Anope::string> &cmds) = 0;
- virtual void SendCommand(Interface *i, const Anope::string &str) = 0;
+ virtual void SendCommand(Interface *i, const std::vector<Anope::string> &cmds) anope_abstract;
+ virtual void SendCommand(Interface *i, const Anope::string &str) anope_abstract;
- virtual bool BlockAndProcess() = 0;
+ virtual bool BlockAndProcess() anope_abstract;
- virtual void Subscribe(Interface *i, const Anope::string &pattern) = 0;
- virtual void Unsubscribe(const Anope::string &pattern) = 0;
+ virtual void Subscribe(Interface *i, const Anope::string &) anope_abstract;
+ virtual void Unsubscribe(const Anope::string &pattern) anope_abstract;
- virtual void StartTransaction() = 0;
- virtual void CommitTransaction() = 0;
+ virtual void StartTransaction() anope_abstract;
+ virtual void CommitTransaction() anope_abstract;
};
}
+
diff --git a/include/modules/sasl.h b/include/modules/sasl.h
index e2c832c7b..980a5da2e 100644
--- a/include/modules/sasl.h
+++ b/include/modules/sasl.h
@@ -1,9 +1,20 @@
/*
+ * Anope IRC Services
*
- * (C) 2014-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2014-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * 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 SASL
@@ -23,115 +34,74 @@ namespace SASL
class Service : public ::Service
{
public:
- Service(Module *o) : ::Service(o, "SASL::Service", "sasl") { }
+ static constexpr const char *NAME = "sasl";
+
+ Service(Module *o) : ::Service(o, NAME) { }
- virtual void ProcessMessage(const Message &) = 0;
+ virtual void ProcessMessage(const Message &) anope_abstract;
- virtual Anope::string GetAgent() = 0;
+ virtual Anope::string GetAgent() anope_abstract;
- virtual Session* GetSession(const Anope::string &uid) = 0;
+ virtual Session* GetSession(const Anope::string &uid) anope_abstract;
- virtual void SendMessage(SASL::Session *session, const Anope::string &type, const Anope::string &data) = 0;
+ virtual void SendMessage(SASL::Session *session, const Anope::string &type, const Anope::string &data) anope_abstract;
- virtual void Succeed(Session *, NickCore *) = 0;
- virtual void Fail(Session *) = 0;
- virtual void SendMechs(Session *) = 0;
- virtual void DeleteSessions(Mechanism *, bool = false) = 0;
- virtual void RemoveSession(Session *) = 0;
+ virtual void Succeed(Session *, NickServ::Account *) anope_abstract;
+ virtual void Fail(Session *) anope_abstract;
+ virtual void SendMechs(Session *) anope_abstract;
+ virtual void DeleteSessions(Mechanism *, bool = false) anope_abstract;
+ virtual void RemoveSession(Session *) anope_abstract;
};
- static ServiceReference<SASL::Service> sasl("SASL::Service", "sasl");
-
- struct Session
+ class Session
{
+ SASL::Service *service;
+
+ public:
time_t created;
Anope::string uid;
- Anope::string hostname, ip;
Reference<Mechanism> mech;
- Session(Mechanism *m, const Anope::string &u) : created(Anope::CurTime), uid(u), mech(m) { }
+ Session(SASL::Service *s, Mechanism *m, const Anope::string &u) : service(s), created(Anope::CurTime), uid(u), mech(m) { }
+
virtual ~Session()
{
- if (sasl)
- sasl->RemoveSession(this);
+ service->RemoveSession(this);
}
};
/* PLAIN, EXTERNAL, etc */
class Mechanism : public ::Service
{
+ SASL::Service *service;
+
public:
- Mechanism(Module *o, const Anope::string &sname) : Service(o, "SASL::Mechanism", sname) { }
+ static constexpr const char *NAME = "sasl/mechanism";
+
+ Mechanism(SASL::Service *s, Module *o, const Anope::string &sname) : Service(o, NAME, sname), service(s) { }
+
+ SASL::Service *GetService() const { return service; }
- virtual Session* CreateSession(const Anope::string &uid) { return new Session(this, uid); }
+ virtual Session* CreateSession(const Anope::string &uid) { return new Session(service, this, uid); }
- virtual void ProcessMessage(Session *session, const Message &) = 0;
+ virtual void ProcessMessage(Session *session, const Message &) anope_abstract;
virtual ~Mechanism()
{
- if (sasl)
- sasl->DeleteSessions(this, true);
+ service->DeleteSessions(this, true);
}
};
- class IdentifyRequest : public ::IdentifyRequest
+ class IdentifyRequestListener : public NickServ::IdentifyRequestListener
{
+ SASL::Service *service = nullptr;
Anope::string uid;
- Anope::string hostname, ip;
public:
- IdentifyRequest(Module *m, const Anope::string &id, const Anope::string &acc, const Anope::string &pass, const Anope::string &h, const Anope::string &i) : ::IdentifyRequest(m, acc, pass), uid(id), hostname(h), ip(i) { }
+ IdentifyRequestListener(SASL::Service *s, const Anope::string &id) : service(s), uid(id) { }
- void OnSuccess() anope_override
- {
- if (!sasl)
- return;
-
- NickAlias *na = NickAlias::Find(GetAccount());
- if (!na || na->nc->HasExt("NS_SUSPENDED"))
- return OnFail();
-
- unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins");
- if (maxlogins && na->nc->users.size() >= maxlogins)
- return OnFail();
-
- Session *s = sasl->GetSession(uid);
- if (s)
- {
- Anope::string user = "A user";
- if (!hostname.empty() && !ip.empty())
- user = hostname + " (" + ip + ")";
-
- Log(Config->GetClient("NickServ"), "sasl") << user << " identified to account " << this->GetAccount() << " using SASL";
- sasl->Succeed(s, na->nc);
- delete s;
- }
- }
+ void OnSuccess(NickServ::IdentifyRequest *req) override;
- void OnFail() anope_override
- {
- if (!sasl)
- return;
-
- Session *s = sasl->GetSession(uid);
- if (s)
- {
- sasl->Fail(s);
- delete s;
- }
-
- Anope::string accountstatus;
- NickAlias *na = NickAlias::Find(GetAccount());
- if (!na)
- accountstatus = "nonexistent ";
- else if (na->nc->HasExt("NS_SUSPENDED"))
- accountstatus = "suspended ";
-
- Anope::string user = "A user";
- if (!hostname.empty() && !ip.empty())
- user = hostname + " (" + ip + ")";
-
- Log(Config->GetClient("NickServ"), "sasl") << user << " failed to identify for " << accountstatus << "account " << this->GetAccount() << " using SASL";
- }
+ void OnFail(NickServ::IdentifyRequest *req) override;
};
}
diff --git a/include/modules/set_misc.h b/include/modules/set_misc.h
deleted file mode 100644
index 9ca771925..000000000
--- a/include/modules/set_misc.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- *
- * (C) 2003-2017 Anope Team
- * Contact us at team@anope.org
- *
- * Please read COPYING and README for further details.
- */
-
-struct MiscData
-{
- Anope::string object;
- Anope::string name;
- Anope::string data;
-
- MiscData() { }
- virtual ~MiscData() { }
-};
diff --git a/include/modules/sql.h b/include/modules/sql.h
index 471d18d07..bf1ebc3ee 100644
--- a/include/modules/sql.h
+++ b/include/modules/sql.h
@@ -1,80 +1,24 @@
/*
+ * Anope IRC Services
*
- * (C) 2003-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2010-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * 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 SQL
{
-
- class Data : public Serialize::Data
- {
- public:
- typedef std::map<Anope::string, std::stringstream *> Map;
- Map data;
- std::map<Anope::string, Type> types;
-
- ~Data()
- {
- Clear();
- }
-
- std::iostream& operator[](const Anope::string &key) anope_override
- {
- std::stringstream *&ss = data[key];
- if (!ss)
- ss = new std::stringstream();
- return *ss;
- }
-
- std::set<Anope::string> KeySet() const anope_override
- {
- std::set<Anope::string> keys;
- for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
- keys.insert(it->first);
- return keys;
- }
-
- size_t Hash() const anope_override
- {
- size_t hash = 0;
- for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
- if (!it->second->str().empty())
- hash ^= Anope::hash_cs()(it->second->str());
- return hash;
- }
-
- std::map<Anope::string, std::iostream *> GetData() const
- {
- std::map<Anope::string, std::iostream *> d;
- for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
- d[it->first] = it->second;
- return d;
- }
-
- void Clear()
- {
- for (Map::const_iterator it = this->data.begin(), it_end = this->data.end(); it != it_end; ++it)
- delete it->second;
- this->data.clear();
- }
-
- void SetType(const Anope::string &key, Type t) anope_override
- {
- this->types[key] = t;
- }
-
- Type GetType(const Anope::string &key) const anope_override
- {
- std::map<Anope::string, Type>::const_iterator it = this->types.find(key);
- if (it != this->types.end())
- return it->second;
- return DT_TEXT;
- }
- };
-
/** A SQL exception, can be thrown at various points
*/
class Exception : public ModuleException
@@ -92,6 +36,7 @@ namespace SQL
{
Anope::string data;
bool escape;
+ bool null;
};
struct Query
@@ -129,15 +74,41 @@ namespace SQL
}
catch (const ConvertException &ex) { }
}
+
+ void SetNull(const Anope::string &key)
+ {
+ QueryData &qd = this->parameters[key];
+
+ qd.data = "";
+ qd.escape = false;
+ qd.null = true;
+ }
+
+ Anope::string Unsafe() const
+ {
+ Anope::string q = query;
+ for (auto it = parameters.begin(); it != parameters.end(); ++it)
+ q = q.replace_all_cs("@" + it->first + "@", it->second.data);
+ return q;
+ }
};
/** A result from a SQL query
*/
class Result
{
+ public:
+ struct Value
+ {
+ bool null = false;
+ Anope::string value;
+ };
+
protected:
- /* Rows, column, item */
- std::vector<std::map<Anope::string, Anope::string> > entries;
+ std::vector<Anope::string> columns;
+ // row, column
+ std::vector<std::vector<Value>> values;
+
Query query;
Anope::string error;
public:
@@ -149,17 +120,20 @@ namespace SQL
inline operator bool() const { return this->error.empty(); }
- inline const unsigned int GetID() const { return this->id; }
+ inline unsigned int GetID() const { return this->id; }
inline const Query &GetQuery() const { return this->query; }
inline const Anope::string &GetError() const { return this->error; }
- int Rows() const { return this->entries.size(); }
+ int Rows() const
+ {
+ return this->values.size();
+ }
- const std::map<Anope::string, Anope::string> &Row(size_t index) const
+ const std::vector<Value> &Row(size_t index) const
{
try
{
- return this->entries.at(index);
+ return this->values.at(index);
}
catch (const std::out_of_range &)
{
@@ -167,15 +141,35 @@ namespace SQL
}
}
- const Anope::string Get(size_t index, const Anope::string &col) const
+ const Value &GetValue(size_t index, const Anope::string &col) const
{
- const std::map<Anope::string, Anope::string> rows = this->Row(index);
+ const std::vector<Value> &v = this->Row(index);
- std::map<Anope::string, Anope::string>::const_iterator it = rows.find(col);
- if (it == rows.end())
+ auto it = std::find(this->columns.begin(), this->columns.end(), col);
+ if (it == this->columns.end())
throw Exception("Unknown column name in SQLResult: " + col);
+ unsigned int col_idx = it - this->columns.begin();
- return it->second;
+ try
+ {
+ return v[col_idx];
+ }
+ catch (const std::out_of_range &)
+ {
+ throw Exception("Out of bounds access to SQLResult");
+ }
+ }
+
+ const Anope::string &Get(size_t index, const Anope::string &col) const
+ {
+ const Value &value = GetValue(index, col);
+ return value.value;
+ }
+
+ bool IsNull(size_t index, const Anope::string &col) const
+ {
+ const Value &value = GetValue(index, col);
+ return value.null;
}
};
@@ -189,8 +183,8 @@ namespace SQL
Interface(Module *m) : owner(m) { }
virtual ~Interface() { }
- virtual void OnResult(const Result &r) = 0;
- virtual void OnError(const Result &r) = 0;
+ virtual void OnResult(const Result &r) anope_abstract;
+ virtual void OnError(const Result &r) anope_abstract;
};
/** Class providing the SQL service, modules call this to execute queries
@@ -198,19 +192,28 @@ namespace SQL
class Provider : public Service
{
public:
- Provider(Module *c, const Anope::string &n) : Service(c, "SQL::Provider", n) { }
+ static constexpr const char *NAME = "sql";
+
+ Provider(Module *c, const Anope::string &n) : Service(c, NAME, n) { }
- virtual void Run(Interface *i, const Query &query) = 0;
+ virtual void Run(Interface *i, const Query &query) anope_abstract;
- virtual Result RunQuery(const Query &query) = 0;
+ virtual Result RunQuery(const Query &query) anope_abstract;
- virtual std::vector<Query> CreateTable(const Anope::string &table, const Data &data) = 0;
+ virtual std::vector<Query> InitSchema(const Anope::string &prefix) anope_abstract;
+ virtual std::vector<Query> Replace(const Anope::string &table, const Query &, const std::set<Anope::string> &) anope_abstract;
+ virtual std::vector<Query> CreateTable(const Anope::string &prefix, Serialize::TypeBase *) anope_abstract;
+ virtual std::vector<Query> AlterTable(const Anope::string &, Serialize::TypeBase *, Serialize::FieldBase *) anope_abstract;
+ virtual std::vector<Query> CreateIndex(const Anope::string &table, const Anope::string &field) anope_abstract;
+ virtual Query SelectFind(const Anope::string &table, const Anope::string &field) anope_abstract;
- virtual Query BuildInsert(const Anope::string &table, unsigned int id, Data &data) = 0;
+ virtual Query BeginTransaction() anope_abstract;
+ virtual Query Commit() anope_abstract;
- virtual Query GetTables(const Anope::string &prefix) = 0;
+ virtual Serialize::ID GetID(const Anope::string &prefix, const Anope::string &type) anope_abstract;
- virtual Anope::string FromUnixtime(time_t) = 0;
+ virtual Query GetTables(const Anope::string &prefix) anope_abstract;
};
}
+
diff --git a/include/modules/ssl.h b/include/modules/ssl.h
index 5d3ae2b97..06db2473e 100644
--- a/include/modules/ssl.h
+++ b/include/modules/ssl.h
@@ -1,15 +1,31 @@
/*
+ * Anope IRC Services
*
- * (C) 2010-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2010-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * 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 SSLService : public Service
{
public:
- SSLService(Module *o, const Anope::string &n) : Service(o, "SSLService", n) { }
+ static constexpr const char *NAME = "ssl";
- virtual void Init(Socket *s) = 0;
+ SSLService(Module *o, const Anope::string &n) : Service(o, NAME, n) { }
+
+ virtual void Init(Socket *s) anope_abstract;
};
+
diff --git a/include/modules/suspend.h b/include/modules/suspend.h
deleted file mode 100644
index 59b5535ec..000000000
--- a/include/modules/suspend.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- *
- * (C) 2003-2017 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.
- */
-
-struct SuspendInfo
-{
- Anope::string what, by, reason;
- time_t when, expires;
-
- SuspendInfo() { }
- virtual ~SuspendInfo() { }
-};
diff --git a/include/modules/xmlrpc.h b/include/modules/xmlrpc.h
index dc1e9d259..43205a4b2 100644
--- a/include/modules/xmlrpc.h
+++ b/include/modules/xmlrpc.h
@@ -1,11 +1,24 @@
/*
+ * Anope IRC Services
*
- * (C) 2010-2017 Anope Team
- * Contact us at team@anope.org
+ * Copyright (C) 2010-2017 Anope Team <team@anope.org>
*
- * Please read COPYING and README for further details.
+ * 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
+
#include "httpd.h"
class XMLRPCRequest
@@ -17,7 +30,7 @@ class XMLRPCRequest
Anope::string id;
std::deque<Anope::string> data;
HTTPReply& r;
-
+
XMLRPCRequest(HTTPReply &_r) : r(_r) { }
inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.insert(std::make_pair(dname, ddata)); }
inline const std::map<Anope::string, Anope::string> &get_replies() { return this->replies; }
@@ -29,19 +42,22 @@ class XMLRPCEvent
{
public:
virtual ~XMLRPCEvent() { }
- virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0;
+ virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) anope_abstract;
};
class XMLRPCServiceInterface : public Service
{
public:
- XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, "XMLRPCServiceInterface", sname) { }
+ static constexpr const char *NAME = "XMLRPCServiceInterface";
+
+ XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, NAME) { }
- virtual void Register(XMLRPCEvent *event) = 0;
+ virtual void Register(XMLRPCEvent *event) anope_abstract;
- virtual void Unregister(XMLRPCEvent *event) = 0;
+ virtual void Unregister(XMLRPCEvent *event) anope_abstract;
- virtual Anope::string Sanitize(const Anope::string &string) = 0;
+ virtual Anope::string Sanitize(const Anope::string &string) anope_abstract;
- virtual void Reply(XMLRPCRequest &request) = 0;
+ virtual void Reply(XMLRPCRequest &request) anope_abstract;
};
+