InspIRCd  4.0
Classes | Public Types | Public Member Functions | Protected Attributes | List of all members
ListModeBase Class Reference

#include <listmode.h>

Inheritance diagram for ListModeBase:
ModeHandler ServiceProvider Cullable insp::uncopiable

Classes

struct  ListItem
 

Public Types

typedef std::vector< ListItemModeList
 
- Public Types inherited from ModeHandler
enum  Class { MC_PREFIX , MC_LIST , MC_PARAM , MC_OTHER }
 
typedef size_t Id
 

Public Member Functions

 ListModeBase (Module *Creator, const std::string &Name, char modechar, const std::string &eolstr, unsigned int lnum, unsigned int eolnum, bool autotidy)
 
bool HasVariableLength () const
 
unsigned long GetLimit (Channel *channel)
 
unsigned long GetLowerLimit ()
 
ModeListGetList (Channel *channel)
 
void DisplayList (User *user, Channel *channel) override
 
void DisplayEmptyList (User *user, Channel *channel) override
 
void RemoveMode (Channel *channel, Modes::ChangeList &changelist) override
 
void DoRehash ()
 
ModeAction OnModeChange (User *source, User *, Channel *channel, Modes::Change &change) override
 
virtual bool ValidateParam (User *user, Channel *channel, std::string &parameter)
 
virtual void OnParameterMissing (User *user, User *dest, Channel *channel) override
 
virtual void TellListTooLong (User *source, Channel *channel, std::string &parameter)
 
virtual void TellAlreadyOnList (User *source, Channel *channel, std::string &parameter)
 
virtual void TellNotSet (User *source, Channel *channel, std::string &parameter)
 
- Public Member Functions inherited from ModeHandler
 ModeHandler (Module *me, const std::string &name, char modeletter, ParamSpec params, ModeType type, Class mclass=MC_OTHER)
 
Cullable::Result Cull () override
 
void RegisterService () 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, Modes::Change &change)
 
virtual void OnParameterInvalid (User *user, Channel *targetchannel, User *targetuser, const std::string &parameter)
 
virtual bool ResolveModeConflict (const 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
 
- Public Member Functions inherited from ServiceProvider
 ServiceProvider (Module *Creator, const std::string &Name, ServiceType Type)
 
const char * GetTypeString () const
 
void DisableAutoRegister ()
 
- Public Member Functions inherited from Cullable
virtual ~Cullable ()
 

Protected Attributes

unsigned int listnumeric
 
unsigned int endoflistnumeric
 
std::string endofliststring
 
bool tidy
 
limitlist chanlimits
 
SimpleExtItem< ChanData > extItem
 
- Protected Attributes inherited from ModeHandler
ParamSpec parameters_taken
 
char mode
 
bool oper = false
 
bool list = false
 
ModeType m_type
 
const Class type_id
 
unsigned int ranktoset = HALFOP_VALUE
 
unsigned int ranktounset = HALFOP_VALUE
 
std::string syntax
 

Additional Inherited Members

- Public Attributes inherited from ServiceProvider
ModuleRef creator
 
const std::string name
 
const ServiceType service
 
- Protected Member Functions inherited from Cullable
 Cullable ()
 

Detailed Description

The base class for list modes, should be inherited.

Member Typedef Documentation

◆ ModeList

typedef std::vector<ListItem> ListModeBase::ModeList

Items stored in the channel's list

Constructor & Destructor Documentation

◆ ListModeBase()

ListModeBase::ListModeBase ( Module Creator,
const std::string &  Name,
char  modechar,
const std::string &  eolstr,
unsigned int  lnum,
unsigned int  eolnum,
bool  autotidy 
)

Constructor.

Parameters
CreatorThe creator of this class
NameMode name
modecharMode character
eolstrEnd of list string
lnumList numeric
eolnumEnd of list numeric
autotidyAutomatically tidy list entries on add

Member Function Documentation

◆ DisplayEmptyList()

void ListModeBase::DisplayEmptyList ( User user,
Channel channel 
)
overridevirtual

Tell a user that a list contains no elements. Sends 'eolnum' numeric with text 'eolstr', unless overridden (see constructor)

Parameters
userThe user issuing the command
channelThe channel that has the empty list See mode.h

Reimplemented from ModeHandler.

◆ DisplayList()

void ListModeBase::DisplayList ( User user,
Channel channel 
)
overridevirtual

Display the list for this mode See mode.h

Parameters
userThe user to send the list to
channelThe channel the user is requesting the list for

Reimplemented from ModeHandler.

◆ DoRehash()

void ListModeBase::DoRehash ( )

Perform a rehash of this mode's configuration data

◆ GetLimit()

unsigned long ListModeBase::GetLimit ( Channel channel)

Get limit of this mode on a channel

Parameters
channelThe channel to inspect
Returns
Maximum number of modes of this type that can be placed on the given channel

◆ GetList()

ListModeBase::ModeList * ListModeBase::GetList ( Channel channel)
inline

Retrieves the list of all modes set on the given channel

Parameters
channelChannel to get the list from
Returns
A list with all modes of this type set on the given channel, can be NULL

◆ GetLowerLimit()

unsigned long ListModeBase::GetLowerLimit ( )

Gets the lower list limit for this listmode.

◆ HasVariableLength()

bool ListModeBase::HasVariableLength ( ) const
inline

Determines whether some channels have longer lists than others.

◆ OnModeChange()

ModeAction ListModeBase::OnModeChange ( User source,
User ,
Channel channel,
Modes::Change change 
)
overridevirtual

Handle the list mode. See mode.h

Reimplemented from ModeHandler.

◆ OnParameterMissing()

void ListModeBase::OnParameterMissing ( User user,
User dest,
Channel channel 
)
overridevirtual

In the event that the mode should be given a parameter, and no parameter was provided, this method is called. This allows you to give special information to the user, or handle this any way you like.

Parameters
userThe user issuing the mode change
destFor user mode changes, the target of the mode. For channel mode changes, NULL.
channelFor channel mode changes, the target of the mode. For user mode changes, NULL. See mode.h

Reimplemented from ModeHandler.

◆ RemoveMode()

void ListModeBase::RemoveMode ( Channel channel,
Modes::ChangeList changelist 
)
overridevirtual

Remove all instances of the mode from a channel. Populates the given modestack with modes that remove every instance of this mode from the channel. See mode.h for more details.

Parameters
channelThe channel to remove all instances of the mode from
changelistMode change list to populate with the removal of this mode

Reimplemented from ModeHandler.

◆ TellAlreadyOnList()

void ListModeBase::TellAlreadyOnList ( User source,
Channel channel,
std::string &  parameter 
)
virtual

Tell the user an item is already on the list. Overridden by implementing module.

Parameters
sourceSource user adding the parameter
channelChannel the parameter is being added to
parameterThe actual parameter being added

◆ TellListTooLong()

void ListModeBase::TellListTooLong ( User source,
Channel channel,
std::string &  parameter 
)
virtual

Tell the user the list is too long. Overridden by implementing module.

Parameters
sourceSource user adding the parameter
channelChannel the parameter is being added to
parameterThe actual parameter being added

◆ TellNotSet()

void ListModeBase::TellNotSet ( User source,
Channel channel,
std::string &  parameter 
)
virtual

Tell the user that the parameter is not in the list. Overridden by implementing module.

Parameters
sourceSource user removing the parameter
channelChannel the parameter is being removed from
parameterThe actual parameter being removed

◆ ValidateParam()

bool ListModeBase::ValidateParam ( User user,
Channel channel,
std::string &  parameter 
)
virtual

Validate parameters. Overridden by implementing module.

Parameters
userSource user adding the parameter
channelChannel the parameter is being added to
parameterThe actual parameter being added
Returns
true if the parameter is valid

Member Data Documentation

◆ chanlimits

limitlist ListModeBase::chanlimits
protected

Limits on a per-channel basis read from the <listmode> config tag.

◆ endoflistnumeric

unsigned int ListModeBase::endoflistnumeric
protected

Numeric to indicate end of list

◆ endofliststring

std::string ListModeBase::endofliststring
protected

String to send for end of list

◆ extItem

SimpleExtItem<ChanData> ListModeBase::extItem
protected

Storage key

◆ listnumeric

unsigned int ListModeBase::listnumeric
protected

Numeric to use when outputting the list

◆ tidy

bool ListModeBase::tidy
protected

Automatically tidy up entries


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