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

irc::modestacker Class Reference

irc::modestacker stacks mode sequences into a list. More...

#include <hashcomp.h>

Inheritance diagram for irc::modestacker:

Inheritance graph
[legend]
Collaboration diagram for irc::modestacker:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 modestacker (InspIRCd *Instance, bool add)
 Construct a new modestacker.
void Push (char modeletter, const std::string &parameter)
 Push a modeletter and its parameter onto the stack.
void Push (char modeletter)
 Push a modeletter without parameter onto the stack.
void PushPlus ()
 Push a '+' symbol onto the stack.
void PushMinus ()
 Push a '-' symbol onto the stack.
int GetStackedLine (std::deque< std::string > &result, int max_line_size=360)
 Return zero or more elements which form the mode line.

Private Attributes

InspIRCdServerInstance
std::deque< std::stringsequence
 The mode sequence and its parameters.
bool adding
 True if the mode sequence is initially adding characters, false if it is initially removing them.

Detailed Description

irc::modestacker stacks mode sequences into a list.

It can then reproduce this list, clamped to a maximum of MAXMODES values per line.

Definition at line 197 of file hashcomp.h.


Constructor & Destructor Documentation

irc::modestacker::modestacker InspIRCd Instance,
bool  add
 

Construct a new modestacker.

Parameters:
add True if the stack is adding modes, false if it is removing them

Definition at line 319 of file hashcomp.cpp.

References sequence.


Member Function Documentation

int irc::modestacker::GetStackedLine std::deque< std::string > &  result,
int  max_line_size = 360
 

Return zero or more elements which form the mode line.

This will be clamped to a max of MAXMODES items (MAXMODES-1 mode parameters and one mode sequence string), and max_line_size characters. As specified below, this function should be called in a loop until it returns zero, indicating there are no more modes to return.

Parameters:
result The deque to populate. This will be cleared before it is used.
max_line_size The maximum size of the line to build, in characters, seperate to MAXMODES.
Returns:
The number of elements in the deque. The function should be called repeatedly until it returns 0, in case there are multiple lines of mode changes to be obtained.

Definition at line 346 of file hashcomp.cpp.

References adding, InspIRCd::Config, ServerConfig::Limits, ServerLimits::MaxModes, sequence, and ServerInstance.

Referenced by ListModeBase::DoSyncChannel(), TreeSocket::ForceJoin(), ModuleBanRedirect::OnCleanup(), ListModeBase::RemoveMode(), FounderProtectBase::RemoveMode(), and TreeSocket::RemoveStatus().

void irc::modestacker::Push char  modeletter  ) 
 

Push a modeletter without parameter onto the stack.

No checking is performed as to if this mode actually requires a parameter. If you stack invalid mode sequences, they will be tidied if and when they are passed to a mode parser.

Parameters:
modeletter The mode letter to insert

Definition at line 331 of file hashcomp.cpp.

References Push().

void irc::modestacker::Push char  modeletter,
const std::string parameter
 

Push a modeletter and its parameter onto the stack.

No checking is performed as to if this mode actually requires a parameter. If you stack invalid mode sequences, they will be tidied if and when they are passed to a mode parser.

Parameters:
modeletter The mode letter to insert
parameter The parameter for the mode

Definition at line 325 of file hashcomp.cpp.

References sequence.

Referenced by ListModeBase::DoSyncChannel(), TreeSocket::ForceJoin(), ModuleBanRedirect::OnCleanup(), Push(), PushMinus(), PushPlus(), ListModeBase::RemoveMode(), ModeHandler::RemoveMode(), FounderProtectBase::RemoveMode(), ModeChannelVoice::RemoveMode(), ModeChannelOp::RemoveMode(), ModeChannelKey::RemoveMode(), ModeChannelHalfOp::RemoveMode(), and ModeChannelBan::RemoveMode().

void irc::modestacker::PushMinus  ) 
 

Push a '-' symbol onto the stack.

Definition at line 341 of file hashcomp.cpp.

References Push().

void irc::modestacker::PushPlus  ) 
 

Push a '+' symbol onto the stack.

Definition at line 336 of file hashcomp.cpp.

References Push().

Referenced by ModuleBanRedirect::OnCleanup().


Member Data Documentation

bool irc::modestacker::adding [private]
 

True if the mode sequence is initially adding characters, false if it is initially removing them.

Definition at line 208 of file hashcomp.h.

Referenced by GetStackedLine().

std::deque<std::string> irc::modestacker::sequence [private]
 

The mode sequence and its parameters.

Definition at line 203 of file hashcomp.h.

Referenced by GetStackedLine(), modestacker(), and Push().

InspIRCd* irc::modestacker::ServerInstance [private]
 

Definition at line 200 of file hashcomp.h.

Referenced by GetStackedLine().


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