InspIRCd
3.0
|
#include <mode.h>
Public Member Functions | |
PrefixMode (Module *Creator, const std::string &Name, char ModeLetter, unsigned int Rank=0, char PrefixChar=0) | |
ModResult | AccessCheck (User *source, Channel *channel, std::string ¶meter, bool adding) CXX11_OVERRIDE |
ModeAction | OnModeChange (User *source, User *dest, Channel *channel, std::string ¶m, bool adding) CXX11_OVERRIDE |
void | Update (unsigned int rank, unsigned int setrank, unsigned int unsetrank, bool selfrm) |
void | RemoveMode (Channel *channel, Modes::ChangeList &changelist) CXX11_OVERRIDE |
bool | CanSelfRemove () const |
char | GetPrefix () const |
unsigned int | GetPrefixRank () const |
![]() | |
ModeHandler (Module *me, const std::string &name, char modeletter, ParamSpec params, ModeType type, Class mclass=MC_OTHER) | |
CullResult | cull () CXX11_OVERRIDE |
void | RegisterService () CXX11_OVERRIDE |
bool | IsListMode () const |
PrefixMode * | IsPrefixMode () |
const PrefixMode * | IsPrefixMode () const |
ListModeBase * | IsListModeBase () |
const ListModeBase * | IsListModeBase () const |
ParamModeBase * | IsParameterMode () |
const ParamModeBase * | IsParameterMode () const |
ModeType | GetModeType () const |
bool | NeedsOper () const |
bool | NeedsParam (bool adding) const |
char | GetModeChar () const |
Id | GetId () const |
virtual std::string | GetUserParameter (const User *user) const |
virtual void | DisplayList (User *user, Channel *channel) |
virtual void | OnParameterMissing (User *user, User *dest, Channel *channel) |
virtual void | DisplayEmptyList (User *user, Channel *channel) |
virtual bool | ResolveModeConflict (std::string &their_param, const std::string &our_param, Channel *channel) |
void | RemoveMode (User *user) |
unsigned int | GetLevelRequired (bool adding) const |
const std::string & | GetSyntax () const |
![]() | |
ServiceProvider (Module *Creator, const std::string &Name, ServiceType Type) | |
void | DisableAutoRegister () |
Protected Attributes | |
char | prefix |
unsigned int | prefixrank |
bool | selfremove |
![]() | |
ParamSpec | parameters_taken |
char | mode |
bool | oper |
bool | list |
ModeType | m_type |
const Class | type_id |
unsigned int | ranktoset |
unsigned int | ranktounset |
std::string | syntax |
Additional Inherited Members | |
![]() | |
enum | Class { MC_PREFIX, MC_LIST, MC_PARAM, MC_OTHER } |
typedef size_t | Id |
![]() | |
ModuleRef | creator |
const std::string | name |
const ServiceType | service |
Prefix modes are channel modes that grant a specific rank to members having prefix mode set. They require a parameter when setting and unsetting; the parameter is always a member of the channel. A prefix mode may be set on any number of members on a channel, but for a given member a given prefix mode is either set or not set, in other words members cannot have the same prefix mode set more than once.
A rank of a member is defined as the rank given by the 'strongest' prefix mode that member has. Other parts of the IRCd use this rank to determine whether a channel action is allowable for a user or not. The rank of a prefix mode is constant, i.e. the same rank value is given to all users having that prefix mode set.
Note that it is possible that the same action requires a different rank on a different channel; for example changing the topic on a channel having +t set requires a rank that is >= than the rank of a halfop, but there is no such restriction when +t isn't set.
PrefixMode::PrefixMode | ( | Module * | Creator, |
const std::string & | Name, | ||
char | ModeLetter, | ||
unsigned int | Rank = 0 , |
||
char | PrefixChar = 0 |
||
) |
Constructor
Creator | The module creating this mode |
Name | The user-friendly one word name of the prefix mode, e.g.: "op", "voice" |
ModeLetter | The mode letter of this mode |
Rank | Rank given by this prefix mode, see explanation above |
PrefixChar | Prefix character, or 0 if the mode has no prefix character |
|
virtual |
Called when a channel mode change access check for your mode occurs.
source | Contains the user setting the mode. |
channel | contains the destination channel the modes are being set on. |
parameter | The parameter for your mode. This is modifiable. |
adding | This value is true when the mode is being set, or false when it is being unset. |
Reimplemented from ModeHandler.
|
inline |
Determines whether a user with this prefix mode can remove it.
|
inline |
Mode prefix or 0. If this is defined, you should also implement GetPrefixRank() to return an integer value for this mode prefix.
|
inline |
Get the 'value' of this modes prefix. determines which to display when there are multiple. The mode with the highest value is ranked first. See the PrefixModeValue enum and Channel::GetPrefixValue() for more information.
|
virtual |
Handles setting and unsetting the prefix mode. Finds the given member of the given channel, if it's not found an error message is sent to 'source' and MODEACTION_DENY is returned. Otherwise the mode change is attempted.
source | Source of the mode change, an error message is sent to this user if the target is not found |
dest | Unused |
channel | The channel the mode change is happening on |
param | The nickname or uuid of the target user |
adding | True when the mode is being set, false when it is being unset |
Reimplemented from ModeHandler.
|
virtual |
Removes this prefix mode from all users on the given channel
channel | The channel which the server wants to remove your mode from |
changelist | Mode change list to populate with the removal of this mode |
Reimplemented from ModeHandler.
void PrefixMode::Update | ( | unsigned int | rank, |
unsigned int | setrank, | ||
unsigned int | unsetrank, | ||
bool | selfrm | ||
) |
Updates the configuration of this prefix.
rank | The prefix rank of this mode. |
setrank | The prefix rank required to set this mode on channels. |
unsetrank | The prefix rank required to set this unmode on channels. |
selfrm | Whether a client with this prefix can remove it from themself. |
|
protected |
The prefix character granted by this mode. '@' for op, '+' for voice, etc. If 0, this mode does not have a visible prefix character.
|
protected |
The prefix rank of this mode, used to compare prefix modes
|
protected |
Whether a client with this prefix can remove it from themself.