InspIRCd  4.0
Public Member Functions | Public Attributes | List of all members
ModeWatcher Class Reference

#include <mode.h>

Inheritance diagram for ModeWatcher:
Cullable insp::uncopiable

Public Member Functions

 ModeWatcher (Module *creator, const std::string &modename, ModeType type)
 
 ~ModeWatcher () override
 
const std::string & GetModeName () const
 
ModeType GetModeType () const
 
virtual bool BeforeMode (User *source, User *dest, Channel *channel, Modes::Change &change)
 
virtual void AfterMode (User *source, User *dest, Channel *channel, const Modes::Change &change)
 
- Public Member Functions inherited from Cullable
virtual ~Cullable ()
 
virtual Result Cull ()
 

Public Attributes

ModuleRef creator
 

Additional Inherited Members

- Protected Member Functions inherited from Cullable
 Cullable ()
 

Detailed Description

The ModeWatcher class can be used to alter the behaviour of a mode implemented by the core or by another module. To use ModeWatcher, derive a class from it, and attach it to the mode using Server::AddModeWatcher and Server::DelModeWatcher. A ModeWatcher will be called both before and after the mode change.

Constructor & Destructor Documentation

◆ ModeWatcher()

ModeWatcher::ModeWatcher ( Module creator,
const std::string &  modename,
ModeType  type 
)

The constructor initializes the mode and the mode type

◆ ~ModeWatcher()

ModeWatcher::~ModeWatcher ( )
override

The default destructor does nothing.

Member Function Documentation

◆ AfterMode()

void ModeWatcher::AfterMode ( User source,
User dest,
Channel channel,
const Modes::Change change 
)
virtual

After the mode character has been processed by the ModeHandler, this method will be called.

Parameters
sourceThe sender of the mode
destThe target user for the mode, if you are watching a user mode
channelThe target channel for the mode, if you are watching a channel mode
changeInformation regarding the mode change.

◆ BeforeMode()

bool ModeWatcher::BeforeMode ( User source,
User dest,
Channel channel,
Modes::Change change 
)
virtual

Before the mode character is processed by its handler, this method will be called.

Parameters
sourceThe sender of the mode
destThe target user for the mode, if you are watching a user mode
channelThe target channel for the mode, if you are watching a channel mode
changeInformation regarding the mode change. If you alter the parameter you are given, the mode handler will see your atered version when it handles the mode.
Returns
True to allow the mode change to go ahead, false to abort it. If you abort the change, the mode handler (and ModeWatcher::AfterMode()) will never see the mode change.

◆ GetModeName()

const std::string& ModeWatcher::GetModeName ( ) const
inline

Get the mode name being watched

Returns
The mode name being watched

◆ GetModeType()

ModeType ModeWatcher::GetModeType ( ) const
inline

Get the mode type being watched

Returns
The mode type being watched (user or channel)

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