Static Public Member Functions | Static Public Attributes | Static Protected Member Functions | Static Protected Attributes

ModeManager Class Reference

#include <modes.h>

Collaboration diagram for ModeManager:
Collaboration graph
[legend]

Static Public Member Functions

static bool AddUserMode (UserMode *um)
static bool AddChannelMode (ChannelMode *cm)
static void RemoveUserMode (UserMode *um)
static void RemoveChannelMode (ChannelMode *cm)
static ChannelModeFindChannelModeByChar (char mode)
static UserModeFindUserModeByChar (char mode)
static ChannelModeFindChannelModeByName (const Anope::string &name)
static UserModeFindUserModeByName (const Anope::string &name)
static char GetStatusChar (char symbol)
static void StackerAdd (const BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const Anope::string &param="")
static void StackerAdd (const BotInfo *bi, User *u, UserMode *um, bool set, const Anope::string &param="")
static void ProcessModes ()
static void StackerDel (User *u)
static void StackerDel (Channel *c)
static void StackerDel (Mode *m)
static void UpdateDefaultMLock (ServerConfig *config)

Static Public Attributes

static std::vector< ChannelMode * > ChannelModes
static std::vector< UserMode * > UserModes
static unsigned GenericChannelModes = 0
static unsigned GenericUserModes = 0
static std::list< std::pair
< Anope::string, Anope::string > > 
ModeLockOn
static std::list< Anope::stringModeLockOff
static ChannelStatus DefaultBotModes

Static Protected Member Functions

static std::list< Anope::stringBuildModeStrings (StackerInfo *info)

Static Protected Attributes

static std::map< User
*, StackerInfo * > 
UserStackerObjects
static std::map< Channel
*, StackerInfo * > 
ChannelStackerObjects

Detailed Description

This is the mode manager It contains functions for adding modes to Anope so Anope can track them and do things such as MLOCK. This also contains a mode stacker that will combine multiple modes and set them on a channel or user at once

Definition at line 282 of file modes.h.


Member Function Documentation

bool ModeManager::AddChannelMode ( ChannelMode cm  )  [static]
bool ModeManager::AddUserMode ( UserMode um  )  [static]
std::list< Anope::string > ModeManager::BuildModeStrings ( StackerInfo info  )  [static, protected]

Build a list of mode strings to send to the IRCd from the mode stacker

Parameters:
info The stacker info for a channel or user
Returns:
a list of strings

Definition at line 236 of file modes.cpp.

References StackerInfo::AddModes, Anope::string::clear(), StackerInfo::DelModes, Anope::string::empty(), Anope::string::erase(), IRCD, Anope::string::length(), IRCDProto::MaxModes, and Anope::string::push_back().

Referenced by ProcessModes().

ChannelMode * ModeManager::FindChannelModeByChar ( char  mode  )  [static]
ChannelMode * ModeManager::FindChannelModeByName ( const Anope::string name  )  [static]
UserMode * ModeManager::FindUserModeByChar ( char  mode  )  [static]

Find a user mode

Parameters:
mode The mode
Returns:
The mode class

Definition at line 369 of file modes.cpp.

References Mode::mchar, and UserModes.

Referenced by AddUserMode(), User::SetModes(), and User::SetModesInternal().

UserMode * ModeManager::FindUserModeByName ( const Anope::string name  )  [static]
char ModeManager::GetStatusChar ( char  symbol  )  [static]

Gets the channel mode char for a symbol (eg + returns v)

Parameters:
symbol The symbol
Returns:
The char

Definition at line 405 of file modes.cpp.

References anope_dynamic_static_cast(), ChannelModes, Mode::mchar, MODE_STATUS, ChannelModeStatus::Symbol, and Mode::type.

Referenced by DoServices(), CommandCSLog::Execute(), UnrealExtBan::Matches(), InspIRCdExtBan::Matches(), IRCDMessageNJoin::Run(), IRCDMessageFJoin::Run(), IRCDMessageSJoin::Run(), and Server::Server().

void ModeManager::ProcessModes (  )  [static]

Process all of the modes in the stacker and send them to the IRCd to be set on channels/users

Definition at line 450 of file modes.cpp.

References StackerInfo::bi, BuildModeStrings(), ChannelStackerObjects, IRCD, IRCDProto::SendMode(), and UserStackerObjects.

Referenced by BotInfo::Join(), ModePipe::OnNotify(), ngIRCdProto::SendVhost(), and UnrealIRCdProto::SendVhostDel().

void ModeManager::RemoveChannelMode ( ChannelMode cm  )  [static]

Remove a channel mode from Anope

Parameters:
um A ChanneMode to remove

Definition at line 342 of file modes.cpp.

References ChannelModes, and StackerDel().

Referenced by ProtoRatbox::AddModes(), and ProtoPlexus::AddModes().

void ModeManager::RemoveUserMode ( UserMode um  )  [static]

Remove a user mode from Anope

Parameters:
um A UserMode to remove

Definition at line 327 of file modes.cpp.

References StackerDel(), and UserModes.

Referenced by ProtoRatbox::AddModes(), and ProtoPlexus::AddModes().

void ModeManager::StackerAdd ( const BotInfo bi,
Channel c,
ChannelMode cm,
bool  set,
const Anope::string param = "" 
) [static]

Add a mode to the stacker to be set on a channel

Parameters:
bi The client to set the modes from
c The channel
cm The channel mode
set true for setting, false for removing
param The param, if there is one

Definition at line 422 of file modes.cpp.

References StackerInfo::AddMode(), StackerInfo::bi, ChannelStackerObjects, Channel::ci, GetInfo(), modePipe, and Pipe::Notify().

Referenced by User::RemoveMode(), Channel::RemoveMode(), User::SetMode(), and Channel::SetMode().

void ModeManager::StackerAdd ( const BotInfo bi,
User u,
UserMode um,
bool  set,
const Anope::string param = "" 
) [static]

Add a mode to the stacker to be set on a user

Parameters:
bi The client to set the modes from
u The user
um The user mode
set true for setting, false for removing
param The param, if there is one

Definition at line 436 of file modes.cpp.

References StackerInfo::AddMode(), StackerInfo::bi, GetInfo(), modePipe, Pipe::Notify(), and UserStackerObjects.

void ModeManager::StackerDel ( User u  )  [static]

Delete a user, channel, or mode from the stacker

Definition at line 483 of file modes.cpp.

References UserStackerObjects.

Referenced by RemoveChannelMode(), RemoveUserMode(), Channel::~Channel(), and User::~User().

void ModeManager::StackerDel ( Mode m  )  [static]
void ModeManager::StackerDel ( Channel c  )  [static]

Definition at line 488 of file modes.cpp.

References ChannelStackerObjects.

void ModeManager::UpdateDefaultMLock ( ServerConfig config  )  [static]

Updates the default mode locks and default bot modes

Parameters:
config The configuration to read from. This is often called during a config reload.

Definition at line 540 of file modes.cpp.

References ServerConfig::BotModes, DefaultBotModes, FindChannelModeByChar(), sepstream::GetToken(), Anope::string::length(), Mode::mchar, ServerConfig::MLock, MODE_LIST, MODE_REGULAR, MODE_STATUS, ModeLockOff, ModeLockOn, ChannelStatus::modes, Mode::name, and Mode::type.

Referenced by AddChannelMode(), and ServerConfig::ServerConfig().


Field Documentation

std::vector< ChannelMode * > ModeManager::ChannelModes [static]
std::map< Channel *, StackerInfo * > ModeManager::ChannelStackerObjects [static, protected]

Definition at line 287 of file modes.h.

Referenced by ProcessModes(), StackerAdd(), and StackerDel().

unsigned ModeManager::GenericChannelModes = 0 [static]

Definition at line 301 of file modes.h.

Referenced by AddChannelMode().

unsigned ModeManager::GenericUserModes = 0 [static]

Definition at line 302 of file modes.h.

Referenced by AddUserMode().

std::list< Anope::string > ModeManager::ModeLockOff [static]

Definition at line 305 of file modes.h.

Referenced by CommandCSRegister::Execute(), and UpdateDefaultMLock().

std::list< std::pair< Anope::string, Anope::string > > ModeManager::ModeLockOn [static]

Definition at line 304 of file modes.h.

Referenced by CommandCSRegister::Execute(), and UpdateDefaultMLock().

std::vector< UserMode * > ModeManager::UserModes [static]

Definition at line 298 of file modes.h.

Referenced by AddUserMode(), FindUserModeByChar(), FindUserModeByName(), and RemoveUserMode().

std::map< User *, StackerInfo * > ModeManager::UserStackerObjects [static, protected]

Definition at line 286 of file modes.h.

Referenced by ProcessModes(), StackerAdd(), and StackerDel().


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