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

ModeChannelBan Class Reference

Channel mode +b. More...

#include <cmode_b.h>

Inheritance diagram for ModeChannelBan:

Inheritance graph
[legend]
Collaboration diagram for ModeChannelBan:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModeChannelBan (InspIRCd *Instance)
ModeAction OnModeChange (User *source, User *dest, Channel *channel, std::string &parameter, bool adding, bool servermode)
 Called when a mode change for your mode occurs.
std::stringAddBan (User *user, std::string &dest, Channel *chan, int status, bool servermode)
std::stringDelBan (User *user, std::string &dest, Channel *chan, int status)
void DisplayList (User *user, Channel *channel)
 If your mode is a listmode, then this method will be called for displaying an item list, e.g.
void DisplayEmptyList (User *user, Channel *channel)
 If your mode is a listmode, this method will be called to display an empty list (just the end of list numeric).
ModePair ModeSet (User *source, User *dest, Channel *channel, const std::string &parameter)
 When a remote server needs to bounce a set of modes, it will call this method for every mode in the mode string to determine if the mode is set or not.
void RemoveMode (User *user, irc::modestacker *stack=NULL)
 When a MODETYPE_USER mode handler is being removed, the server will call this method for every user on the server.
void RemoveMode (Channel *channel, irc::modestacker *stack=NULL)
 When a MODETYPE_CHANNEL mode handler is being removed, the server will call this method for every channel on the server.

Private Attributes

BanItem b

Detailed Description

Channel mode +b.

Definition at line 21 of file cmode_b.h.


Constructor & Destructor Documentation

ModeChannelBan::ModeChannelBan InspIRCd Instance  ) 
 

Definition at line 28 of file cmode_b.cpp.


Member Function Documentation

std::string & ModeChannelBan::AddBan User user,
std::string dest,
Channel chan,
int  status,
bool  servermode
 

Definition at line 95 of file cmode_b.cpp.

References b, Channel::bans, ModeParser::CleanMask(), InspIRCd::Config, HostItem::data, DEFAULT, FOREACH_RESULT, Channel::GetMaxBans(), I_OnAddBan, IS_LOCAL, LogManager::Log(), InspIRCd::Logs, MAXBUF, Channel::name, User::nick, ModeHandler::ServerInstance, ServerConfig::ServerName, HostItem::set_by, HostItem::set_time, InspIRCd::Time(), and User::WriteServ().

Referenced by OnModeChange().

std::string & ModeChannelBan::DelBan User user,
std::string dest,
Channel chan,
int  status
 

Definition at line 155 of file cmode_b.cpp.

References Channel::bans, ModeParser::CleanMask(), DEFAULT, FOREACH_RESULT, I_OnDelBan, LogManager::Log(), InspIRCd::Logs, and ModeHandler::ServerInstance.

Referenced by OnModeChange().

void ModeChannelBan::DisplayEmptyList User user,
Channel channel
[virtual]
 

If your mode is a listmode, this method will be called to display an empty list (just the end of list numeric).

Parameters:
user The user issuing the command
channel The channel tehy're requesting an item list of (e.g. a banlist, or an exception list etc)

Reimplemented from ModeHandler.

Definition at line 90 of file cmode_b.cpp.

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

void ModeChannelBan::DisplayList User user,
Channel channel
[virtual]
 

If your mode is a listmode, then this method will be called for displaying an item list, e.g.

on MODE channel +modechar without any parameter or other modes in the command.

Parameters:
user The user issuing the command
channel The channel they're requesting an item list of (e.g. a banlist, or an exception list etc)

Reimplemented from ModeHandler.

Definition at line 79 of file cmode_b.cpp.

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

ModePair ModeChannelBan::ModeSet User source,
User dest,
Channel channel,
const std::string parameter
[virtual]
 

When a remote server needs to bounce a set of modes, it will call this method for every mode in the mode string to determine if the mode is set or not.

Parameters:
source of the mode change, this will be NULL for a server mode
dest Target user of the mode change, if this is a user mode
channel Target channel of the mode change, if this is a channel mode
parameter The parameter given for the mode change, or an empty string
Returns:
The first value of the pair should be true if the mode is set with the given parameter. In the case of permissions modes such as channelmode +o, this should return true if the user given as the parameter has the given privilage on the given channel. The string value of the pair will hold the current setting for this mode set locally, when the bool is true, or, the parameter given. This allows the local server to enforce our locally set parameters back to a remote server.

Reimplemented from ModeHandler.

Definition at line 143 of file cmode_b.cpp.

References Channel::bans.

ModeAction ModeChannelBan::OnModeChange User source,
User dest,
Channel channel,
std::string parameter,
bool  adding,
bool  servermode
[virtual]
 

Called when a mode change for your mode occurs.

Parameters:
source Contains the user setting the mode.
dest For usermodes, contains the destination user the mode is being set on. For channelmodes, this is an undefined value.
channel For channel modes, contains the destination channel the modes are being set on. For usermodes, this is an undefined value.
parameter The parameter for your mode, if you indicated that your mode requires a parameter when being set or unset. Note that if you alter this value, the new value becomes the one displayed and send out to the network, also, if you set this to an empty string but you specified your mode REQUIRES a parameter, this is equivalent to returning MODEACTION_DENY and will prevent the mode from being displayed.
adding This value is true when the mode is being set, or false when it is being unset.
Returns:
MODEACTION_ALLOW to allow the mode, or MODEACTION_DENY to prevent the mode, also see the description of 'parameter'.

Reimplemented from ModeHandler.

Definition at line 32 of file cmode_b.cpp.

References AddBan(), DelBan(), Channel::GetStatus(), and MODEACTION_ALLOW.

void ModeChannelBan::RemoveMode Channel channel,
irc::modestacker stack = NULL
[virtual]
 

When a MODETYPE_CHANNEL mode handler is being removed, the server will call this method for every channel on the server.

Your mode handler should remove its user mode from the channel by sending the appropriate server modes using InspIRCd::SendMode(). The default implementation of this method can remove simple modes which have no parameters, and can be used when your mode is of this type, otherwise you must implement a more advanced version of it to remove your mode properly from each channel. Note that in the case of listmodes, you should remove the entire list of items.

Parameters:
channel The channel which the server wants to remove your mode from

Reimplemented from ModeHandler.

Definition at line 52 of file cmode_b.cpp.

References Channel::bans, InspIRCd::FakeClient, Channel::name, irc::modestacker::Push(), InspIRCd::SendMode(), and ModeHandler::ServerInstance.

void ModeChannelBan::RemoveMode User user,
irc::modestacker stack = NULL
[virtual]
 

When a MODETYPE_USER mode handler is being removed, the server will call this method for every user on the server.

Your mode handler should remove its user mode from the user by sending the appropriate server modes using InspIRCd::SendMode(). The default implementation of this method can remove simple modes which have no parameters, and can be used when your mode is of this type, otherwise you must implement a more advanced version of it to remove your mode properly from each user.

Parameters:
user The user which the server wants to remove your mode from

Reimplemented from ModeHandler.

Definition at line 75 of file cmode_b.cpp.


Member Data Documentation

BanItem ModeChannelBan::b [private]
 

Definition at line 24 of file cmode_b.h.

Referenced by AddBan().


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