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

#include <mode.h>

Inheritance diagram for ModeWatcher:
classbase

Public Member Functions

 ModeWatcher (Module *creator, const std::string &modename, ModeType type)
 
virtual ~ModeWatcher ()
 
const std::string & GetModeName () const
 
ModeType GetModeType () const
 
virtual bool BeforeMode (User *source, User *dest, Channel *channel, std::string &parameter, bool adding)
 
virtual void AfterMode (User *source, User *dest, Channel *channel, const std::string &parameter, bool adding)
 
- Public Member Functions inherited from classbase
virtual CullResult cull ()
 

Public Attributes

ModuleRef creator
 

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

The default destructor does nothing.

Member Function Documentation

◆ AfterMode()

void ModeWatcher::AfterMode ( User source,
User dest,
Channel channel,
const std::string &  parameter,
bool  adding 
)
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
parameterThe parameter of the mode, if the mode is supposed to have a parameter. You cannot alter the parameter here, as the mode handler has already processed it.
addingTrue if the mode is being added and false if it is being removed

◆ BeforeMode()

bool ModeWatcher::BeforeMode ( User source,
User dest,
Channel channel,
std::string &  parameter,
bool  adding 
)
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
parameterThe parameter of the mode, if the mode is supposed to have a parameter. If you alter the parameter you are given, the mode handler will see your atered version when it handles the mode.
addingTrue if the mode is being added and false if it is being removed
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: