InspIRCd  2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations
Public Member Functions | Public Attributes | Protected Attributes | List of all members
ModeWatcher Class Reference

#include <mode.h>

Inheritance diagram for ModeWatcher:
classbase

Public Member Functions

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

Public Attributes

ModuleRef creator
 

Protected Attributes

char mode
 
ModeType m_type
 

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 ( Module creator,
char  modeletter,
ModeType  type 
)

The constructor initializes the mode and the mode type

ModeWatcher::~ModeWatcher ( )
virtual

The default destructor does nothing.

Member Function Documentation

void ModeWatcher::AfterMode ( User source,
User dest,
Channel channel,
const std::string &  parameter,
bool  adding,
ModeType  type 
)
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
typeThe mode type, either MODETYPE_USER or MODETYPE_CHANNEL
bool ModeWatcher::BeforeMode ( User source,
User dest,
Channel channel,
std::string &  parameter,
bool  adding,
ModeType  type 
)
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
typeThe mode type, either MODETYPE_USER or MODETYPE_CHANNEL
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.
char ModeWatcher::GetModeChar ( )

Get the mode character being watched

Returns
The mode character being watched
ModeType ModeWatcher::GetModeType ( )

Get the mode type being watched

Returns
The mode type being watched (user or channel)

Member Data Documentation

ModeType ModeWatcher::m_type
protected

The mode type being watched (user or channel)

char ModeWatcher::mode
protected

The mode letter this class is watching


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