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

ModuleChanProtect Class Reference

Inheritance diagram for ModuleChanProtect:

Inheritance graph
[legend]
Collaboration diagram for ModuleChanProtect:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleChanProtect (InspIRCd *Me)
virtual void OnUserKick (User *source, User *user, Channel *chan, const std::string &reason, bool &silent)
 Called whenever a user is kicked.
virtual void OnUserPart (User *user, Channel *channel, std::string &partreason, bool &silent)
 Called when a user parts a channel.
void LoadSettings ()
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 void OnPostJoin (User *user, Channel *channel)
 Called after a user joins a channel Identical to OnUserJoin, but called immediately afterwards, when any linking module has seen the join.
virtual int OnAccessCheck (User *source, User *dest, Channel *channel, int access_type)
 Called before an action which requires a channel privilage check.
virtual ~ModuleChanProtect ()
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

bool FirstInGetsFounder
char QPrefix
char APrefix
bool DeprivSelf
bool DeprivOthers
bool booting
ChanProtectcp
ChanFoundercf

Detailed Description

Definition at line 288 of file m_chanprotect.cpp.


Constructor & Destructor Documentation

ModuleChanProtect::ModuleChanProtect InspIRCd Me  )  [inline]
 

Definition at line 302 of file m_chanprotect.cpp.

References ModeParser::AddMode(), APrefix, ModuleManager::Attach(), booting, cf, cp, DeprivOthers, DeprivSelf, I_OnAccessCheck, I_OnPostJoin, I_OnUserKick, I_OnUserPart, I_OnUserPreJoin, LoadSettings(), InspIRCd::Modes, InspIRCd::Modules, QPrefix, and Module::ServerInstance.

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

Definition at line 478 of file m_chanprotect.cpp.

References cf, cp, ModeParser::DelMode(), InspIRCd::Modes, and Module::ServerInstance.


Member Function Documentation

virtual Version ModuleChanProtect::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 486 of file m_chanprotect.cpp.

References API_VERSION, VF_COMMON, and VF_VENDOR.

void ModuleChanProtect::LoadSettings  )  [inline]
 

Definition at line 339 of file m_chanprotect.cpp.

References APrefix, cf, Conf, cp, DeprivOthers, DeprivSelf, ModeParser::FindPrefix(), FirstInGetsFounder, InspIRCd::Modes, QPrefix, ConfigReader::ReadFlag(), ConfigReader::ReadValue(), and Module::ServerInstance.

Referenced by ModuleChanProtect().

virtual int ModuleChanProtect::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 389 of file m_chanprotect.cpp.

References AC_DEHALFOP, AC_DEOP, AC_DEVOICE, AC_KICK, ACR_ALLOW, ACR_DEFAULT, ACR_DENY, DeprivOthers, DeprivSelf, Extensible::GetExt(), Channel::name, User::nick, User::server, Module::ServerInstance, InspIRCd::ULine(), and User::WriteNumeric().

virtual void ModuleChanProtect::OnPostJoin User user,
Channel channel
[inline, virtual]
 

Called after a user joins a channel Identical to OnUserJoin, but called immediately afterwards, when any linking module has seen the join.

Parameters:
user The user who is joining
channel The channel being joined

Reimplemented from Module.

Definition at line 375 of file m_chanprotect.cpp.

References FirstInGetsFounder, Channel::GetUserCounter(), Channel::name, User::nick, and User::WriteServ().

virtual void ModuleChanProtect::OnUserKick User source,
User user,
Channel chan,
const std::string reason,
bool &  silent
[inline, virtual]
 

Called whenever a user is kicked.

If this method is called, the kick is already underway and cannot be prevented, so to prevent a kick, please use Module::OnUserPreKick instead of this method.

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
silent Change this to true if you want to conceal the PART command from the other users of the channel (useful for modules such as auditorium)

Reimplemented from Module.

Definition at line 325 of file m_chanprotect.cpp.

References Channel::name, and Extensible::Shrink().

virtual void ModuleChanProtect::OnUserPart User user,
Channel channel,
std::string partreason,
bool &  silent
[inline, virtual]
 

Called when a user parts a channel.

The details of the leaving user are available to you in the parameter User *user, and the details of the channel they have left is available in the variable Channel *channel

Parameters:
user The user who is parting
channel The channel being parted
partmessage The part message, or an empty string (may be modified)
silent Change this to true if you want to conceal the PART command from the other users of the channel (useful for modules such as auditorium)

Reimplemented from Module.

Definition at line 332 of file m_chanprotect.cpp.

References Channel::name, and Extensible::Shrink().

virtual int ModuleChanProtect::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 364 of file m_chanprotect.cpp.

References FirstInGetsFounder, and QPrefix.


Member Data Documentation

char ModuleChanProtect::APrefix [private]
 

Definition at line 293 of file m_chanprotect.cpp.

Referenced by LoadSettings(), and ModuleChanProtect().

bool ModuleChanProtect::booting [private]
 

Definition at line 296 of file m_chanprotect.cpp.

Referenced by ModuleChanProtect().

ChanFounder* ModuleChanProtect::cf [private]
 

Definition at line 298 of file m_chanprotect.cpp.

Referenced by LoadSettings(), ModuleChanProtect(), and ~ModuleChanProtect().

ChanProtect* ModuleChanProtect::cp [private]
 

Definition at line 297 of file m_chanprotect.cpp.

Referenced by LoadSettings(), ModuleChanProtect(), and ~ModuleChanProtect().

bool ModuleChanProtect::DeprivOthers [private]
 

Definition at line 295 of file m_chanprotect.cpp.

Referenced by LoadSettings(), ModuleChanProtect(), and OnAccessCheck().

bool ModuleChanProtect::DeprivSelf [private]
 

Definition at line 294 of file m_chanprotect.cpp.

Referenced by LoadSettings(), ModuleChanProtect(), and OnAccessCheck().

bool ModuleChanProtect::FirstInGetsFounder [private]
 

Definition at line 291 of file m_chanprotect.cpp.

Referenced by LoadSettings(), OnPostJoin(), and OnUserPreJoin().

char ModuleChanProtect::QPrefix [private]
 

Definition at line 292 of file m_chanprotect.cpp.

Referenced by LoadSettings(), ModuleChanProtect(), and OnUserPreJoin().


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