The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ModuleOverride Class Reference

Inheritance diagram for ModuleOverride:

Inheritance graph
[legend]
Collaboration diagram for ModuleOverride:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleOverride (InspIRCd *Me)
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
virtual void OnPostCommand (const std::string &command, const std::vector< std::string > &parameters, User *user, CmdResult result, const std::string &original_line)
 Called after any command has been executed.
virtual void On005Numeric (std::string &output)
 Called when a 005 numeric is about to be output.
virtual bool CanOverride (User *source, const char *token)
virtual int OnLocalTopicChange (User *source, Channel *channel, const std::string &topic)
 Called whenever a topic is changed by a local user.
virtual int OnUserPreKick (User *source, User *user, Channel *chan, const std::string &reason)
 Called whenever a user is about to be kicked.
virtual int OnAccessCheck (User *source, User *dest, Channel *channel, int access_type)
 Called before an action which requires a channel privilage check.
virtual int OnUserPreJoin (User *user, Channel *chan, const char *cname, std::string &privs, const std::string &keygiven)
 Called whenever a user is about to join a channel, before any processing is done.
virtual ~ModuleOverride ()
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

override_t overrides
bool RequireKey
bool NoisyOverride
bool OverriddenMode
int OverOps
int OverDeops
int OverVoices
int OverDevoices
int OverHalfops
int OverDehalfops

Detailed Description

Definition at line 20 of file m_override.cpp.


Constructor & Destructor Documentation

ModuleOverride::ModuleOverride InspIRCd Me  )  [inline]
 

Definition at line 30 of file m_override.cpp.

References ModuleManager::Attach(), SnomaskManager::EnableSnomask(), I_On005Numeric, I_OnAccessCheck, I_OnLocalTopicChange, I_OnPostCommand, I_OnRehash, I_OnUserPreJoin, I_OnUserPreKick, InspIRCd::Modules, OnRehash(), OverDehalfops, OverDeops, OverDevoices, OverHalfops, OverOps, OverriddenMode, OverVoices, Module::ServerInstance, and InspIRCd::SNO.

virtual ModuleOverride::~ModuleOverride  )  [inline, virtual]
 

Definition at line 316 of file m_override.cpp.

References SnomaskManager::DisableSnomask(), Module::ServerInstance, and InspIRCd::SNO.


Member Function Documentation

virtual bool ModuleOverride::CanOverride User source,
const char *  token
[inline, virtual]
 

Definition at line 91 of file m_override.cpp.

References User::oper, and overrides.

Referenced by OnAccessCheck(), OnLocalTopicChange(), OnUserPreJoin(), and OnUserPreKick().

virtual Version ModuleOverride::GetVersion  )  [inline, virtual]
 

Returns the version number of a Module.

The method should return a Version object with its version information assigned via Version::Version

Reimplemented from Module.

Definition at line 321 of file m_override.cpp.

References API_VERSION, and VF_VENDOR.

virtual void ModuleOverride::On005Numeric std::string output  )  [inline, virtual]
 

Called when a 005 numeric is about to be output.

The module should modify the 005 numeric if needed to indicate its features.

Parameters:
output The 005 string to be modified if neccessary.

Reimplemented from Module.

Definition at line 86 of file m_override.cpp.

virtual int ModuleOverride::OnAccessCheck User source,
User dest,
Channel channel,
int  access_type
[inline, virtual]
 

Called before an action which requires a channel privilage check.

This function is called before many functions which check a users status on a channel, for example before opping a user, deopping a user, kicking a user, etc. There are several values for access_type which indicate for what reason access is being checked. These are:

AC_KICK (0) - A user is being kicked
AC_DEOP (1) - a user is being deopped
AC_OP (2) - a user is being opped
AC_VOICE (3) - a user is being voiced
AC_DEVOICE (4) - a user is being devoiced
AC_HALFOP (5) - a user is being halfopped
AC_DEHALFOP (6) - a user is being dehalfopped
AC_INVITE () - a user is being invited
AC_GENERAL_MODE (8) - a user channel mode is being changed<br>
Upon returning from your function you must return either ACR_DEFAULT, to indicate the module wishes to do nothing, or ACR_DENY where approprate to deny the action, and ACR_ALLOW where appropriate to allow the action. Please note that in the case of some access checks (such as AC_GENERAL_MODE) access may be denied 'upstream' causing other checks such as AC_DEOP to not be reached. Be very careful with use of the AC_GENERAL_MODE type, as it may inadvertently override the behaviour of other modules. When the access_type is AC_GENERAL_MODE, the destination of the mode will be NULL (as it has not yet been determined).

Parameters:
source The source of the access check
dest The destination of the access check
channel The channel which is being checked
access_type See above

Reimplemented from Module.

Definition at line 138 of file m_override.cpp.

References AC_DEHALFOP, AC_DEOP, AC_DEVOICE, AC_HALFOP, AC_OP, AC_VOICE, ACR_ALLOW, ACR_DEFAULT, CanOverride(), Channel::GetStatus(), Channel::HasUser(), IS_OPER, OverDehalfops, OverDeops, OverDevoices, OverHalfops, OverOps, OverriddenMode, OverVoices, STATUS_HOP, and STATUS_OP.

virtual int ModuleOverride::OnLocalTopicChange User source,
Channel channel,
const std::string topic
[inline, virtual]
 

Called whenever a topic is changed by a local user.

Return 1 to deny the topic change, 0 to check details on the change, -1 to let it through with no checks

Parameters:
user The user changing the topic
chan The channels who's topic is being changed
topic The actual topic text
1 to block the topic change, 0 to allow

Reimplemented from Module.

Definition at line 107 of file m_override.cpp.

References CanOverride(), Channel::GetStatus(), Channel::HasUser(), IS_OPER, Channel::IsModeSet(), Channel::name, Module::ServerInstance, InspIRCd::SNO, STATUS_HOP, and SnomaskManager::WriteToSnoMask().

virtual void ModuleOverride::OnPostCommand const std::string command,
const std::vector< std::string > &  parameters,
User user,
CmdResult  result,
const std::string original_line
[inline, virtual]
 

Called after any command has been executed.

This event occurs for all registered commands, wether they are registered in the core, or another module, but it will not occur for invalid commands (e.g. ones which do not exist within the command table). The result code returned by the command handler is provided.

Parameters:
command The command being executed
parameters An array of array of characters containing the parameters for the command
pcnt The nuimber of parameters passed to the command
user the user issuing the command
result The return code given by the command handler, one of CMD_SUCCESS or CMD_FAILURE
original_line The entire original line as passed to the parser from the user

Reimplemented from Module.

Definition at line 64 of file m_override.cpp.

References CMD_SUCCESS, ConvToStr(), ModeParser::GetLastParse(), InspIRCd::Modes, User::nick, OverDehalfops, OverDeops, OverDevoices, OverHalfops, OverOps, OverriddenMode, OverVoices, Module::ServerInstance, InspIRCd::SNO, and SnomaskManager::WriteToSnoMask().

virtual void ModuleOverride::OnRehash User user,
const std::string parameter
[inline, virtual]
 

Called on rehash.

This method is called prior to a /REHASH or when a SIGHUP is received from the operating system. You should use it to reload any files so that your module keeps in step with the rest of the application. If a parameter is given, the core has done nothing. The module receiving the event can decide if this parameter has any relevence to it.

Parameters:
user The user performing the rehash, if any -- if this is server initiated, the value of this variable will be NULL.
parameter The (optional) parameter given to REHASH from the user.

Reimplemented from Module.

Definition at line 42 of file m_override.cpp.

References Conf, NoisyOverride, overrides, ConfigReader::ReadFlag(), ConfigReader::ReadValue(), RequireKey, and Module::ServerInstance.

Referenced by ModuleOverride().

virtual int ModuleOverride::OnUserPreJoin User user,
Channel chan,
const char *  cname,
std::string privs,
const std::string keygiven
[inline, virtual]
 

Called whenever a user is about to join a channel, before any processing is done.

Returning a value of 1 from this function stops the process immediately, causing no output to be sent to the user by the core. If you do this you must produce your own numerics, notices etc. This is useful for modules which may want to mimic +b, +k, +l etc. Returning -1 from this function forces the join to be allowed, bypassing restrictions such as banlists, invite, keys etc.

IMPORTANT NOTE!

If the user joins a NEW channel which does not exist yet, OnUserPreJoin will be called BEFORE the channel record is created. This will cause Channel* chan to be NULL. There is very little you can do in form of processing on the actual channel record at this point, however the channel NAME will still be passed in char* cname, so that you could for example implement a channel blacklist or whitelist, etc.

Parameters:
user The user joining the channel
chan If the channel is a new channel, this will be NULL, otherwise it will be a pointer to the channel being joined
cname The channel name being joined. For new channels this is valid where chan is not.
privs A string containing the users privilages when joining the channel. For new channels this will contain "@". You may alter this string to alter the user's modes on the channel.
keygiven The key given to join the channel, or an empty string if none was provided
Returns:
1 To prevent the join, 0 to allow it.

Reimplemented from Module.

Definition at line 242 of file m_override.cpp.

References CanOverride(), CM_INVITEONLY, CM_KEY, CM_LIMIT, InspIRCd::Config, IS_LOCAL, IS_OPER, User::IsInvited(), User::nick, NoisyOverride, RequireKey, Module::ServerInstance, ServerConfig::ServerName, InspIRCd::SNO, User::WriteServ(), and SnomaskManager::WriteToSnoMask().

virtual int ModuleOverride::OnUserPreKick User source,
User user,
Channel chan,
const std::string reason
[inline, virtual]
 

Called whenever a user is about to be kicked.

Returning a value of 1 from this function stops the process immediately, causing no output to be sent to the user by the core. If you do this you must produce your own numerics, notices etc.

Parameters:
source The user issuing the kick
user The user being kicked
chan The channel the user is being kicked from
reason The kick reason
Returns:
1 to prevent the kick, 0 to continue normally, -1 to explicitly allow the kick regardless of normal operation

Reimplemented from Module.

Definition at line 123 of file m_override.cpp.

References CanOverride(), Channel::GetStatus(), IS_OPER, Channel::name, Module::ServerInstance, InspIRCd::SNO, STATUS_VOICE, and SnomaskManager::WriteToSnoMask().


Member Data Documentation

bool ModuleOverride::NoisyOverride [private]
 

Definition at line 24 of file m_override.cpp.

Referenced by OnRehash(), and OnUserPreJoin().

int ModuleOverride::OverDehalfops [private]
 

Definition at line 26 of file m_override.cpp.

Referenced by ModuleOverride(), OnAccessCheck(), and OnPostCommand().

int ModuleOverride::OverDeops [private]
 

Definition at line 26 of file m_override.cpp.

Referenced by ModuleOverride(), OnAccessCheck(), and OnPostCommand().

int ModuleOverride::OverDevoices [private]
 

Definition at line 26 of file m_override.cpp.

Referenced by ModuleOverride(), OnAccessCheck(), and OnPostCommand().

int ModuleOverride::OverHalfops [private]
 

Definition at line 26 of file m_override.cpp.

Referenced by ModuleOverride(), OnAccessCheck(), and OnPostCommand().

int ModuleOverride::OverOps [private]
 

Definition at line 26 of file m_override.cpp.

Referenced by ModuleOverride(), OnAccessCheck(), and OnPostCommand().

bool ModuleOverride::OverriddenMode [private]
 

Definition at line 25 of file m_override.cpp.

Referenced by ModuleOverride(), OnAccessCheck(), and OnPostCommand().

override_t ModuleOverride::overrides [private]
 

Definition at line 22 of file m_override.cpp.

Referenced by CanOverride(), and OnRehash().

int ModuleOverride::OverVoices [private]
 

Definition at line 26 of file m_override.cpp.

Referenced by ModuleOverride(), OnAccessCheck(), and OnPostCommand().

bool ModuleOverride::RequireKey [private]
 

Definition at line 23 of file m_override.cpp.

Referenced by OnRehash(), and OnUserPreJoin().


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