InspIRCd  3.0
Public Member Functions | Protected Attributes | List of all members
PrefixMode Class Reference

#include <mode.h>

Inheritance diagram for PrefixMode:
ModeHandler ServiceProvider classbase ModeChannelOp ModeChannelVoice

Public Member Functions

 PrefixMode (Module *Creator, const std::string &Name, char ModeLetter, unsigned int Rank=0, char PrefixChar=0)
 
ModeAction OnModeChange (User *source, User *dest, Channel *channel, std::string &param, bool adding)
 
void RemoveMode (Channel *channel, Modes::ChangeList &changelist)
 
char GetPrefix () const
 
unsigned int GetPrefixRank () const
 
- Public Member Functions inherited from ModeHandler
 ModeHandler (Module *me, const std::string &name, char modeletter, ParamSpec params, ModeType type, Class mclass=MC_OTHER)
 
virtual CullResult cull () CXX11_OVERRIDE
 
void RegisterService () CXX11_OVERRIDE
 
bool IsListMode () const
 
PrefixModeIsPrefixMode ()
 
const PrefixModeIsPrefixMode () const
 
ListModeBaseIsListModeBase ()
 
const ListModeBaseIsListModeBase () const
 
ParamModeBaseIsParameterMode ()
 
const ParamModeBaseIsParameterMode () 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 ModResult AccessCheck (User *source, Channel *channel, std::string &parameter, bool adding)
 
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 () const
 
- Public Member Functions inherited from ServiceProvider
 ServiceProvider (Module *Creator, const std::string &Name, ServiceType Type)
 
void DisableAutoRegister ()
 

Protected Attributes

char prefix
 
unsigned int prefixrank
 
- Protected Attributes inherited from ModeHandler
ParamSpec parameters_taken
 
char mode
 
bool oper
 
bool list
 
ModeType m_type
 
const Class type_id
 
int levelrequired
 

Additional Inherited Members

- Public Types inherited from ModeHandler
enum  Class { MC_PREFIX, MC_LIST, MC_PARAM, MC_OTHER }
 
typedef size_t Id
 
- Public Attributes inherited from ServiceProvider
ModuleRef creator
 
const std::string name
 
const ServiceType service
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PrefixMode()

PrefixMode::PrefixMode ( Module Creator,
const std::string &  Name,
char  ModeLetter,
unsigned int  Rank = 0,
char  PrefixChar = 0 
)

Constructor

Parameters
CreatorThe module creating this mode
NameThe user-friendly one word name of the prefix mode, e.g.: "op", "voice"
ModeLetterThe mode letter of this mode
RankRank given by this prefix mode, see explanation above
PrefixCharPrefix character, or 0 if the mode has no prefix character

Member Function Documentation

◆ GetPrefix()

char PrefixMode::GetPrefix ( ) const
inline

Mode prefix or 0. If this is defined, you should also implement GetPrefixRank() to return an integer value for this mode prefix.

◆ GetPrefixRank()

unsigned int PrefixMode::GetPrefixRank ( ) const
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.

◆ OnModeChange()

ModeAction PrefixMode::OnModeChange ( User source,
User dest,
Channel channel,
std::string &  param,
bool  adding 
)
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.

Parameters
sourceSource of the mode change, an error message is sent to this user if the target is not found
destUnused
channelThe channel the mode change is happening on
paramThe nickname or uuid of the target user
addingTrue when the mode is being set, false when it is being unset
Returns
MODEACTION_ALLOW if the change happened, MODEACTION_DENY if no change happened The latter occurs either when the member cannot be found or when the member already has this prefix set (when setting) or doesn't have this prefix set (when unsetting).

Reimplemented from ModeHandler.

◆ RemoveMode()

void PrefixMode::RemoveMode ( Channel channel,
Modes::ChangeList changelist 
)
virtual

Removes this prefix mode from all users on the given channel

Parameters
channelThe channel which the server wants to remove your mode from
changelistMode change list to populate with the removal of this mode

Reimplemented from ModeHandler.

Member Data Documentation

◆ prefix

char PrefixMode::prefix
protected

The prefix character granted by this mode. '@' for op, '+' for voice, etc. If 0, this mode does not have a visible prefix character.

◆ prefixrank

unsigned int PrefixMode::prefixrank
protected

The prefix rank of this mode, used to compare prefix modes


The documentation for this class was generated from the following files: