summaryrefslogtreecommitdiff
path: root/include/modules/chanserv
diff options
context:
space:
mode:
Diffstat (limited to 'include/modules/chanserv')
-rw-r--r--include/modules/chanserv/access.h28
-rw-r--r--include/modules/chanserv/akick.h64
-rw-r--r--include/modules/chanserv/drop.h22
-rw-r--r--include/modules/chanserv/entrymsg.h29
-rw-r--r--include/modules/chanserv/info.h24
-rw-r--r--include/modules/chanserv/log.h44
-rw-r--r--include/modules/chanserv/mode.h123
-rw-r--r--include/modules/chanserv/set.h26
-rw-r--r--include/modules/chanserv/set_misc.h25
-rw-r--r--include/modules/chanserv/suspend.h53
10 files changed, 438 insertions, 0 deletions
diff --git a/include/modules/chanserv/access.h b/include/modules/chanserv/access.h
new file mode 100644
index 000000000..54eb3f353
--- /dev/null
+++ b/include/modules/chanserv/access.h
@@ -0,0 +1,28 @@
+/*
+ *
+ * (C) 2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ */
+
+static Serialize::TypeReference<ChanServ::ChanAccess> accesschanaccess("AccessChanAccess");
+static Serialize::TypeReference<ChanServ::ChanAccess> flagschanaccess("FlagsChanAccess");
+static Serialize::TypeReference<ChanServ::ChanAccess> xopchanaccess("XOPChanAccess");
+
+namespace Event
+{
+ struct CoreExport LevelChange : 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;
+ };
+}
+
+template<> struct EventName<Event::LevelChange> { static constexpr const char *const name = "OnLevelChange"; };
diff --git a/include/modules/chanserv/akick.h b/include/modules/chanserv/akick.h
new file mode 100644
index 000000000..966dac15b
--- /dev/null
+++ b/include/modules/chanserv/akick.h
@@ -0,0 +1,64 @@
+/*
+ *
+ * (C) 2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ */
+
+#include "modules/nickserv.h"
+
+ /* AutoKick data. */
+class CoreExport AutoKick : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+ public:
+ 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;
+};
+
+static Serialize::TypeReference<AutoKick> autokick("AutoKick");
+
+namespace Event
+{
+ struct CoreExport Akick : 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;
+ };
+}
+
+template<> struct EventName<Event::Akick> { static constexpr const char *const name = "Akick"; };
diff --git a/include/modules/chanserv/drop.h b/include/modules/chanserv/drop.h
new file mode 100644
index 000000000..db231059b
--- /dev/null
+++ b/include/modules/chanserv/drop.h
@@ -0,0 +1,22 @@
+/*
+ *
+ * (C) 2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ */
+
+namespace Event
+{
+ struct CoreExport ChanDrop : 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;
+ };
+}
+
+template<> struct EventName<Event::ChanDrop> { static constexpr const char *const name = "OnChanDrop"; };
diff --git a/include/modules/chanserv/entrymsg.h b/include/modules/chanserv/entrymsg.h
new file mode 100644
index 000000000..b5804068f
--- /dev/null
+++ b/include/modules/chanserv/entrymsg.h
@@ -0,0 +1,29 @@
+/*
+ * (C) 2003-2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ */
+
+class EntryMsg : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ 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;
+};
+
+static Serialize::TypeReference<EntryMsg> entrymsg("EntryMsg");
+
diff --git a/include/modules/chanserv/info.h b/include/modules/chanserv/info.h
new file mode 100644
index 000000000..f80e3daf2
--- /dev/null
+++ b/include/modules/chanserv/info.h
@@ -0,0 +1,24 @@
+/*
+ *
+ * (C) 2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ */
+
+namespace Event
+{
+ struct CoreExport ChanInfo : 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;
+ };
+}
+
+template<> struct EventName<Event::ChanInfo> { static constexpr const char *const name = "OnChanInfo"; };
diff --git a/include/modules/chanserv/log.h b/include/modules/chanserv/log.h
new file mode 100644
index 000000000..d940f5e87
--- /dev/null
+++ b/include/modules/chanserv/log.h
@@ -0,0 +1,44 @@
+/* ChanServ core functions
+ *
+ * (C) 2003-2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ * Based on the original code of Epona by Lara.
+ * Based on the original code of Services by Andy Church.
+ */
+
+class LogSetting : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ 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;
+};
+
+static Serialize::TypeReference<LogSetting> logsetting("LogSetting");
+
diff --git a/include/modules/chanserv/mode.h b/include/modules/chanserv/mode.h
new file mode 100644
index 000000000..4c7965e2a
--- /dev/null
+++ b/include/modules/chanserv/mode.h
@@ -0,0 +1,123 @@
+/* ChanServ core functions
+ *
+ * (C) 2003-2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ * Based on the original code of Epona by Lara.
+ * Based on the original code of Services by Andy Church.
+ */
+
+class ModeLock : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ 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;
+};
+
+static Serialize::TypeReference<ModeLock> modelock("ModeLock");
+
+class ModeLocks : public Service
+{
+ public:
+ ModeLocks(Module *me) : Service(me, "ModeLocks", "mlocks") { }
+
+ 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;
+};
+
+static ServiceReference<ModeLocks> mlocks("ModeLocks", "mlocks");
+
+namespace Event
+{
+ struct CoreExport MLockEvents : 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;
+ };
+}
+
+template<> struct EventName<Event::MLockEvents> { static constexpr const char *const name = "MLock"; };
diff --git a/include/modules/chanserv/set.h b/include/modules/chanserv/set.h
new file mode 100644
index 000000000..a0e81c888
--- /dev/null
+++ b/include/modules/chanserv/set.h
@@ -0,0 +1,26 @@
+/*
+ *
+ * (C) 2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ */
+
+namespace Event
+{
+ struct CoreExport SetChannelOption : 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;
+ };
+ static EventHandlersReference<SetChannelOption> OnSetChannelOption;
+}
+
+template<> struct EventName<Event::SetChannelOption> { static constexpr const char *const name = "OnSetChannelOption"; };
diff --git a/include/modules/chanserv/set_misc.h b/include/modules/chanserv/set_misc.h
new file mode 100644
index 000000000..65b92cc89
--- /dev/null
+++ b/include/modules/chanserv/set_misc.h
@@ -0,0 +1,25 @@
+/*
+ * (C) 2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+class CSMiscData : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ 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;
+};
+
+static Serialize::TypeReference<CSMiscData> csmiscdata("CSMiscData");
+
diff --git a/include/modules/chanserv/suspend.h b/include/modules/chanserv/suspend.h
new file mode 100644
index 000000000..27187ea09
--- /dev/null
+++ b/include/modules/chanserv/suspend.h
@@ -0,0 +1,53 @@
+/*
+ * (C) 2014 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ *
+ */
+
+class CSSuspendInfo : public Serialize::Object
+{
+ protected:
+ using Serialize::Object::Object;
+
+ public:
+ 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;
+};
+
+static Serialize::TypeReference<CSSuspendInfo> cssuspendinfo("CSSuspendInfo");
+
+namespace Event
+{
+ struct CoreExport ChanSuspend : Events
+ {
+ /** Called when a channel is suspended
+ * @param ci The channel
+ */
+ virtual void OnChanSuspend(ChanServ::Channel *ci) anope_abstract;
+ };
+ struct CoreExport ChanUnsuspend : Events
+ {
+ /** Called when a channel is unsuspended
+ * @param ci The channel
+ */
+ virtual void OnChanUnsuspend(ChanServ::Channel *ci) anope_abstract;
+ };
+ extern CoreExport EventHandlers<ChanUnsuspend> OnChanUnsuspend;
+}
+
+template<> struct EventName<Event::ChanSuspend> { static constexpr const char *const name = "OnChanSuspend"; };
+template<> struct EventName<Event::ChanUnsuspend> { static constexpr const char *const name = "OnChanUnsuspend"; };