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

ModuleCensor Class Reference

Inheritance diagram for ModuleCensor:

Inheritance graph
[legend]
Collaboration diagram for ModuleCensor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleCensor (InspIRCd *Me)
virtual ~ModuleCensor ()
virtual void ReplaceLine (irc::string &text, irc::string pattern, irc::string replace)
virtual int OnUserPreMessage (User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
 Called whenever a user is about to PRIVMSG A user or a channel, before any processing is done.
virtual int OnUserPreNotice (User *user, void *dest, int target_type, std::string &text, char status, CUList &exempt_list)
 Called whenever a user is about to NOTICE A user or a channel, before any processing is done.
virtual void OnRehash (User *user, const std::string &parameter)
 Called on rehash.
virtual Version GetVersion ()
 Returns the version number of a Module.

Private Attributes

censor_t censors
CensorUsercu
CensorChannelcc

Detailed Description

Definition at line 39 of file m_censor.cpp.


Constructor & Destructor Documentation

ModuleCensor::ModuleCensor InspIRCd Me  )  [inline]
 

Definition at line 46 of file m_censor.cpp.

References ModeParser::AddMode(), ModuleManager::Attach(), cc, cu, I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice, InspIRCd::Modes, InspIRCd::Modules, OnRehash(), and Module::ServerInstance.

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

Definition at line 65 of file m_censor.cpp.

References cc, cu, ModeParser::DelMode(), InspIRCd::Modes, and Module::ServerInstance.


Member Function Documentation

virtual Version ModuleCensor::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 151 of file m_censor.cpp.

References API_VERSION, VF_COMMON, and VF_VENDOR.

virtual void ModuleCensor::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 132 of file m_censor.cpp.

References censors, ConfigReader::ReadValue(), and Module::ServerInstance.

Referenced by ModuleCensor().

virtual int ModuleCensor::OnUserPreMessage User user,
void *  dest,
int  target_type,
std::string text,
char  status,
CUList exempt_list
[inline, virtual]
 

Called whenever a user is about to PRIVMSG A user or a channel, before any processing is done.

Returning any nonzero value 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 filter or redirect messages. target_type can be one of TYPE_USER or TYPE_CHANNEL. If the target_type value is a user, you must cast dest to a User* otherwise you must cast it to a Channel*, this is the details of where the message is destined to be sent.

Parameters:
user The user sending the message
dest The target of the message (Channel* or User*)
target_type The type of target (TYPE_USER or TYPE_CHANNEL)
text Changeable text being sent by the user
status The status being used, e.g. PRIVMSG #chan has status== '@', 0 to send to everyone.
exempt_list A list of users not to send to. For channel messages, this will usually contain just the sender. It will be ignored for private messages.
Returns:
1 to deny the NOTICE, 0 to allow it

Reimplemented from Module.

Definition at line 87 of file m_censor.cpp.

References censors, CHANOPS_EXEMPT, ERR_WORDFILTERED, Channel::GetStatus(), IS_LOCAL, User::nick, ReplaceLine(), Module::ServerInstance, STATUS_OP, TYPE_CHANNEL, TYPE_USER, and User::WriteNumeric().

Referenced by OnUserPreNotice().

virtual int ModuleCensor::OnUserPreNotice User user,
void *  dest,
int  target_type,
std::string text,
char  status,
CUList exempt_list
[inline, virtual]
 

Called whenever a user is about to NOTICE A user or a channel, before any processing is done.

Returning any nonzero value 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 filter or redirect messages. target_type can be one of TYPE_USER or TYPE_CHANNEL. If the target_type value is a user, you must cast dest to a User* otherwise you must cast it to a Channel*, this is the details of where the message is destined to be sent. You may alter the message text as you wish before relinquishing control to the next module in the chain, and if no other modules block the text this altered form of the text will be sent out to the user and possibly to other servers.

Parameters:
user The user sending the message
dest The target of the message (Channel* or User*)
target_type The type of target (TYPE_USER or TYPE_CHANNEL)
text Changeable text being sent by the user
status The status being used, e.g. PRIVMSG #chan has status== '@', 0 to send to everyone.
exempt_list A list of users not to send to. For channel notices, this will usually contain just the sender. It will be ignored for private notices.
Returns:
1 to deny the NOTICE, 0 to allow it

Reimplemented from Module.

Definition at line 127 of file m_censor.cpp.

References OnUserPreMessage().

virtual void ModuleCensor::ReplaceLine irc::string text,
irc::string  pattern,
irc::string  replace
[inline, virtual]
 

Definition at line 73 of file m_censor.cpp.

Referenced by OnUserPreMessage().


Member Data Documentation

CensorChannel* ModuleCensor::cc [private]
 

Definition at line 43 of file m_censor.cpp.

Referenced by ModuleCensor(), and ~ModuleCensor().

censor_t ModuleCensor::censors [private]
 

Definition at line 41 of file m_censor.cpp.

Referenced by OnRehash(), and OnUserPreMessage().

CensorUser* ModuleCensor::cu [private]
 

Definition at line 42 of file m_censor.cpp.

Referenced by ModuleCensor(), and ~ModuleCensor().


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