anope

- supernets anope source code & configuration
git clone git://git.acid.vegas/anope.git
Log | Files | Refs | Archive | README

cs_mode.h (2596B)

      1 /* ChanServ core functions
      2  *
      3  * (C) 2003-2022 Anope Team
      4  * Contact us at team@anope.org
      5  *
      6  * Please read COPYING and README for further details.
      7  *
      8  * Based on the original code of Epona by Lara.
      9  * Based on the original code of Services by Andy Church.
     10  */
     11 
     12 struct ModeLock
     13 {
     14 	Anope::string ci;
     15 	bool set;
     16 	Anope::string name;
     17 	Anope::string param;
     18 	Anope::string setter;
     19 	time_t created;
     20 
     21 	virtual ~ModeLock() { }
     22  protected:
     23 	ModeLock() { }
     24 };
     25 
     26 struct ModeLocks
     27 {
     28 	typedef std::vector<ModeLock *> ModeList;
     29 
     30 	virtual ~ModeLocks() { }
     31 
     32 	/** Check if a mode is mlocked
     33 	 * @param mode The mode
     34 	 * @param An optional param
     35 	 * @param status True to check mlock on, false for mlock off
     36 	 * @return true on success, false on fail
     37 	 */
     38 	virtual bool HasMLock(ChannelMode *mode, const Anope::string &param, bool status) const = 0;
     39 
     40 	/** Set a mlock
     41 	 * @param mode The mode
     42 	 * @param status True for mlock on, false for mlock off
     43 	 * @param param An optional param arg for + mlocked modes
     44 	 * @param setter Who is setting the mlock
     45 	 * @param created When the mlock was created
     46 	 * @return true on success, false on failure (module blocking)
     47 	 */
     48 	virtual bool SetMLock(ChannelMode *mode, bool status, const Anope::string &param = "", Anope::string setter = "", time_t created = Anope::CurTime) = 0;
     49 
     50 	/** Remove a mlock
     51 	 * @param mode The mode
     52 	 * @param status True for mlock on, false for mlock off
     53 	 * @param param The param of the mode, required if it is a list or status mode
     54 	 * @return true on success, false on failure
     55 	 */
     56 	virtual bool RemoveMLock(ChannelMode *mode, bool status, const Anope::string &param = "") = 0;
     57 
     58 	virtual void RemoveMLock(ModeLock *mlock) = 0;
     59 
     60 	/** Clear all mlocks on the channel
     61 	 */
     62 	virtual void ClearMLock() = 0;
     63 
     64 	/** Get all of the mlocks for this channel
     65 	 * @return The mlocks
     66 	 */
     67 	virtual const ModeList &GetMLock() const = 0;
     68 
     69 	/** Get a list of mode locks on a channel
     70 	 * @param name The mode name to get a list of
     71 	 * @return a list of mlocks for the given mode
     72 	 */
     73 	virtual std::list<ModeLock *> GetModeLockList(const Anope::string &name) = 0;
     74 
     75 	/** Get details for a specific mlock
     76 	 * @param mname The mode name
     77 	 * @param An optional param to match with
     78 	 * @return The MLock, if any
     79 	 */
     80 	virtual const ModeLock *GetMLock(const Anope::string &mname, const Anope::string &param = "") = 0;
     81 
     82 	/** Get the current mode locks as a string
     83 	 * @param complete True to show mlock parameters as well
     84 	 * @return A string of mode locks, eg: +nrt
     85 	 */
     86 	virtual Anope::string GetMLockAsString(bool complete) const = 0;
     87 
     88 	virtual void Check() = 0;
     89 };