summaryrefslogtreecommitdiff
path: root/src/modules/opflags.h
blob: 65ad10f77447e9e95d4a1e08a15debc9601ac020 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*       +------------------------------------+
 *       | Inspire Internet Relay Chat Daemon |
 *       +------------------------------------+
 *
 *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
 * See: http://wiki.inspircd.org/Credits
 *
 * This program is free but copyrighted software; see
 *	    the file COPYING for details.
 *
 * ---------------------------------------------------
 */

#ifndef __OPFLAGS_H__
#define __OPFLAGS_H__

class OpFlagProvider : public DataProvider
{
 public:
	OpFlagProvider(Module* mod, const std::string& Name) : DataProvider(mod, Name) {}

	/** Get the list of flags for a user */
	virtual std::string GetFlags(Membership* memb) = 0;

	/** Set the flag list for a user */
	virtual void SetFlags(Membership* memb, const std::string& flags) = 0;
	virtual std::string SetFlags(Membership* memb, const std::set<std::string>& flags) = 0;

	/**
	 * Check if the user has permission based on a mode/flag list
	 * @param memb The user/channel to check
	 * @param needed The string of modes to check. In the format [level]{,flag}*
	 * @return True to allow, false to deny
	 *
	 * Example: "op,speaker,moderator" will allow anyone with op or higher,
	 * in addition to anyone who has the "speaker" or "moderator" flags. You can
	 * also do "*,speaker" to only permit those with the "speaker" flag.
	 */
	virtual ModResult PermissionCheck(Membership*, const std::string& needed) = 0;
};

#endif