InspIRCd  3.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 classbase ModeChannelBan

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, const std::string &ctag="banlist")
 
unsigned int GetLimit (Channel *channel)
 
unsigned int GetLowerLimit ()
 
ModeListGetList (Channel *channel)
 
virtual void DisplayList (User *user, Channel *channel)
 
virtual void DisplayEmptyList (User *user, Channel *channel)
 
virtual void RemoveMode (Channel *channel, Modes::ChangeList &changelist)
 
void DoRehash ()
 
virtual ModeAction OnModeChange (User *source, User *, Channel *channel, std::string &parameter, bool adding)
 
virtual bool ValidateParam (User *user, Channel *channel, std::string &parameter)
 
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)
 
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 OnParameterMissing (User *user, User *dest, 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

unsigned int listnumeric
 
unsigned int endoflistnumeric
 
std::string endofliststring
 
bool tidy
 
std::string configtag
 
limitlist chanlimits
 
SimpleExtItem< ChanData > extItem
 
- 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 Attributes inherited from ServiceProvider
ModuleRef creator
 
const std::string name
 
const ServiceType service
 

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,
const std::string &  ctag = "banlist" 
)

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
ctagConfiguration tag to get limits from

Member Function Documentation

◆ DisplayEmptyList()

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

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 
)
virtual

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 int 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 int ListModeBase::GetLowerLimit ( )

Gets the lower list limit for this listmode.

◆ OnModeChange()

ModeAction ListModeBase::OnModeChange ( User source,
User ,
Channel channel,
std::string &  parameter,
bool  adding 
)
virtual

Handle the list mode. See mode.h

Reimplemented from ModeHandler.

◆ RemoveMode()

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

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 tag specified in ListModeBase::configtag

◆ configtag

std::string ListModeBase::configtag
protected

Config tag to check for max items per channel

◆ 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: