summaryrefslogtreecommitdiff
path: root/include/modules/chanserv
diff options
context:
space:
mode:
Diffstat (limited to 'include/modules/chanserv')
-rw-r--r--include/modules/chanserv/entrymsg.h37
-rw-r--r--include/modules/chanserv/log.h45
-rw-r--r--include/modules/chanserv/mode.h91
-rw-r--r--include/modules/chanserv/service.h23
4 files changed, 196 insertions, 0 deletions
diff --git a/include/modules/chanserv/entrymsg.h b/include/modules/chanserv/entrymsg.h
new file mode 100644
index 000000000..2672f8ac0
--- /dev/null
+++ b/include/modules/chanserv/entrymsg.h
@@ -0,0 +1,37 @@
+/*
+ *
+ * (C) 2003-2025 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+#pragma once
+
+struct EntryMsg
+{
+ Anope::string chan;
+ Anope::string creator;
+ Anope::string message;
+ time_t when;
+
+ virtual ~EntryMsg() = default;
+protected:
+ EntryMsg() = default;
+};
+
+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/chanserv/log.h b/include/modules/chanserv/log.h
new file mode 100644
index 000000000..f9549126b
--- /dev/null
+++ b/include/modules/chanserv/log.h
@@ -0,0 +1,45 @@
+/* ChanServ core functions
+ *
+ * (C) 2003-2025 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.
+ */
+
+#pragma once
+
+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() = default;
+protected:
+ LogSetting() = default;
+};
+
+struct LogSettings
+ : Serialize::Checker<std::vector<LogSetting *> >
+{
+ typedef std::vector<LogSetting *>::iterator iterator;
+
+protected:
+ LogSettings() : Serialize::Checker<std::vector<LogSetting *> >("LogSetting")
+ {
+ }
+
+public:
+ virtual ~LogSettings() = default;
+ virtual LogSetting *Create() = 0;
+};
diff --git a/include/modules/chanserv/mode.h b/include/modules/chanserv/mode.h
new file mode 100644
index 000000000..f3668c004
--- /dev/null
+++ b/include/modules/chanserv/mode.h
@@ -0,0 +1,91 @@
+/* ChanServ core functions
+ *
+ * (C) 2003-2025 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.
+ */
+
+#pragma once
+
+struct ModeLock
+{
+ Anope::string ci;
+ bool set;
+ Anope::string name;
+ Anope::string param;
+ Anope::string setter;
+ time_t created;
+
+ virtual ~ModeLock() = default;
+protected:
+ ModeLock() = default;
+};
+
+struct ModeLocks
+{
+ typedef std::vector<ModeLock *> ModeList;
+
+ virtual ~ModeLocks() = default;
+
+ /** 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/chanserv/service.h b/include/modules/chanserv/service.h
new file mode 100644
index 000000000..5bef94340
--- /dev/null
+++ b/include/modules/chanserv/service.h
@@ -0,0 +1,23 @@
+/*
+ *
+ * (C) 2011-2025 Anope Team
+ * Contact us at team@anope.org
+ *
+ * Please read COPYING and README for further details.
+ */
+
+#pragma once
+
+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;
+};