1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 19:14:47 +02:00
Files
anope/include/modules/chanserv/mode.h
T
2025-11-12 19:49:59 +00:00

95 lines
2.8 KiB
C++

// Anope IRC Services <https://www.anope.org/>
//
// Copyright (C) 2003-2025 Anope Contributors
//
// Anope is free software. You can use, modify, and/or distribute it under the
// terms of version 2 of the GNU General Public License. See docs/LICENSE.txt
// for the complete terms of this license and docs/AUTHORS.txt for a list of
// contributors.
//
// Based on the original code of Epona by Lara
// Based on the original code of Services by Andy Church
//
// SPDX-License-Identifier: GPL-2.0-only
#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;
};