summaryrefslogtreecommitdiff
path: root/include/modules/cs_mode.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-07-01 22:17:52 -0400
committerAdam <Adam@anope.org>2013-07-01 22:17:52 -0400
commit1a3d9a016d3adc49788bbff73aac9b3b5ea85b17 (patch)
treec0ecf92ed768473bc82ff64a7fce827245f37ba9 /include/modules/cs_mode.h
parent518182ac9204f815258b0de91b3f884d8efa1502 (diff)
Change extensible keys to require explicitly having a type defined for it. Completely modularize more features like bs_kick, entrymsg, log, mode, etc. Move fantasy to its own module. Move greet to its own module.
Diffstat (limited to 'include/modules/cs_mode.h')
-rw-r--r--include/modules/cs_mode.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/include/modules/cs_mode.h b/include/modules/cs_mode.h
new file mode 100644
index 000000000..4d016e672
--- /dev/null
+++ b/include/modules/cs_mode.h
@@ -0,0 +1,87 @@
+/* ChanServ core functions
+ *
+ * (C) 2003-2013 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;
+
+ protected:
+ ModeLock() { }
+};
+
+struct ModeLocks
+{
+ 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(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 aswell
+ * @return A string of mode locks, eg: +nrt
+ */
+ virtual Anope::string GetMLockAsString(bool complete) const = 0;
+
+ virtual void Check() = 0;
+};
+