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

ListModeBase Class Reference

The base class for list modes, should be inherited. More...

#include <u_listmode.h>

Inheritance diagram for ListModeBase:

Inheritance graph
[legend]
Collaboration diagram for ListModeBase:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ListModeBase (InspIRCd *Instance, char modechar, const std::string &eolstr, unsigned int lnum, unsigned int eolnum, bool autotidy, const std::string &ctag="banlist")
 Constructor.
std::pair< bool, std::stringModeSet (User *, User *, Channel *channel, const std::string &parameter)
 See mode.h.
virtual void DisplayList (User *user, Channel *channel)
 Display the list for this mode.
virtual 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).
virtual void RemoveMode (Channel *channel, irc::modestacker *stack)
 Remove all instances of the mode from a channel.
virtual void RemoveMode (User *, irc::modestacker *stack)
 See mode.h.
virtual void DoRehash ()
 Perform a rehash of this mode's configuration data.
virtual void DoImplements (Module *m)
 Populate the Implements list with the correct events for a List Mode.
virtual ModeAction OnModeChange (User *source, User *, Channel *channel, std::string &parameter, bool adding, bool servermode)
 Handle the list mode.
virtual std::stringGetInfoKey ()
 Get Extensible key for this mode.
virtual void DoChannelDelete (Channel *chan)
 Handle channel deletion.
virtual void DoSyncChannel (Channel *chan, Module *proto, void *opaque)
 Syncronize channel item list with another server.
virtual void DoCleanup (int, void *)
 Clean up module on unload.
virtual bool ValidateParam (User *, Channel *, std::string &)
 Validate parameters.
virtual bool TellListTooLong (User *, Channel *, std::string &)
 Tell the user the list is too long.
virtual void TellAlreadyOnList (User *, Channel *, std::string &)
 Tell the user an item is already on the list.
virtual void TellNotSet (User *, Channel *, std::string &)
 Tell the user that the parameter is not in the list.
virtual const char * DoOnRequest (Request *request)

Protected Attributes

std::string infokey
 Storage key.
unsigned int listnumeric
 Numeric to use when outputting the list.
unsigned int endoflistnumeric
 Numeric to indicate end of list.
std::string endofliststring
 String to send for end of list.
bool tidy
 Automatically tidy up entries.
std::string configtag
 Config tag to check for max items per channel.
limitlist chanlimits
 Limits on a per-channel basis read from the tag specified in ListModeBase::configtag.

Detailed Description

The base class for list modes, should be inherited.

Definition at line 107 of file u_listmode.h.


Constructor & Destructor Documentation

ListModeBase::ListModeBase InspIRCd Instance,
char  modechar,
const std::string eolstr,
unsigned int  lnum,
unsigned int  eolnum,
bool  autotidy,
const std::string ctag = "banlist"
[inline]
 

Constructor.

Parameters:
Instance The creator of this class
modechar Mode character
eolstr End of list string lnum List numeric
eolnum End of list numeric
autotidy Automatically tidy list entries on add
ctag Configuration tag to get limits from

Definition at line 143 of file u_listmode.h.

References DoRehash(), infokey, and ModeHandler::mode.


Member Function Documentation

virtual void ListModeBase::DisplayEmptyList User user,
Channel channel
[inline, 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 187 of file u_listmode.h.

References endoflistnumeric, endofliststring, Channel::name, User::nick, and User::WriteNumeric().

virtual void ListModeBase::DisplayList User user,
Channel channel
[inline, virtual]
 

Display the list for this mode.

Parameters:
user The user to send the list to
channel The channel the user is requesting the list for

Reimplemented from ModeHandler.

Definition at line 173 of file u_listmode.h.

References InspIRCd::Config, endoflistnumeric, endofliststring, Extensible::GetExt(), infokey, listnumeric, Channel::name, User::nick, ModeHandler::ServerInstance, ServerConfig::ServerName, and User::WriteNumeric().

virtual void ListModeBase::DoChannelDelete Channel chan  )  [inline, virtual]
 

Handle channel deletion.

See modules.h.

Parameters:
chan Channel being deleted

Definition at line 402 of file u_listmode.h.

References Extensible::GetExt(), infokey, and Extensible::Shrink().

Referenced by ModuleInviteException::OnChannelDelete(), ModuleChanFilter::OnChannelDelete(), and ModuleBanException::OnChannelDelete().

virtual void ListModeBase::DoCleanup int  ,
void * 
[inline, virtual]
 

Clean up module on unload.

Parameters:
target_type Type of target to clean
item Item to clean

Definition at line 445 of file u_listmode.h.

Referenced by ModuleInviteException::OnCleanup(), ModuleChanFilter::OnCleanup(), and ModuleBanException::OnCleanup().

virtual void ListModeBase::DoImplements Module m  )  [inline, virtual]
 

Populate the Implements list with the correct events for a List Mode.

Definition at line 266 of file u_listmode.h.

References ModuleManager::Attach(), I_OnChannelDelete, I_OnCleanup, I_OnRehash, I_OnRequest, I_OnSyncChannel, InspIRCd::Modules, and ModeHandler::ServerInstance.

Referenced by ModuleBanException::ModuleBanException(), ModuleChanFilter::ModuleChanFilter(), and ModuleInviteException::ModuleInviteException().

virtual const char* ListModeBase::DoOnRequest Request request  )  [inline, virtual]
 

Definition at line 493 of file u_listmode.h.

References ListModeRequest::chan, ListModeRequest::extban, Extensible::GetExt(), User::GetFullHost(), User::GetFullRealHost(), Request::GetId(), GetInfoKey(), User::GetIPString(), User::ident, ListModeRequest::literal, InspIRCd::Match(), InspIRCd::MatchCIDR(), User::nick, and ListModeRequest::user.

Referenced by ModuleInviteException::OnRequest(), ModuleChanFilter::OnRequest(), and ModuleBanException::OnRequest().

virtual void ListModeBase::DoRehash  )  [inline, virtual]
 

Perform a rehash of this mode's configuration data.

Definition at line 239 of file u_listmode.h.

References chanlimits, Conf, configtag, ConfigReader::Enumerate(), ListLimit::limit, ListLimit::mask, ConfigReader::ReadInteger(), ConfigReader::ReadValue(), and ModeHandler::ServerInstance.

Referenced by ListModeBase(), ModuleInviteException::OnRehash(), ModuleChanFilter::OnRehash(), and ModuleBanException::OnRehash().

virtual void ListModeBase::DoSyncChannel Channel chan,
Module proto,
void *  opaque
[inline, virtual]
 

Syncronize channel item list with another server.

See modules.h

Parameters:
chan Channel to syncronize
proto Protocol module pointer
opaque Opaque connection handle

Definition at line 420 of file u_listmode.h.

References Extensible::GetExt(), irc::stringjoiner::GetJoined(), irc::modestacker::GetStackedLine(), infokey, ModeHandler::mode, Module::ProtoSendMode(), irc::modestacker::Push(), ModeHandler::ServerInstance, and TYPE_CHANNEL.

Referenced by ModuleInviteException::OnSyncChannel(), ModuleChanFilter::OnSyncChannel(), and ModuleBanException::OnSyncChannel().

virtual std::string& ListModeBase::GetInfoKey  )  [inline, virtual]
 

Get Extensible key for this mode.

Definition at line 393 of file u_listmode.h.

References infokey.

Referenced by DoOnRequest(), ModuleBanException::OnCheckBan(), ModuleBanException::OnCheckExtBan(), ModuleInviteException::OnCheckInvite(), ModuleBanException::OnCheckStringExtBan(), and ModuleChanFilter::ProcessMessages().

std::pair<bool,std::string> ListModeBase::ModeSet User ,
User ,
Channel channel,
const std::string parameter
[inline, virtual]
 

See mode.h.

Reimplemented from ModeHandler.

Definition at line 152 of file u_listmode.h.

References Extensible::GetExt(), and infokey.

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

Handle the list mode.

See mode.h

Reimplemented from ModeHandler.

Definition at line 275 of file u_listmode.h.

References chanlimits, ModeParser::CleanMask(), InspIRCd::Config, Extensible::Extend(), Extensible::GetExt(), infokey, IS_LOCAL, ListItem::mask, InspIRCd::Match(), MODEACTION_ALLOW, MODEACTION_DENY, Channel::name, User::nick, ListItem::nick, ModeHandler::ServerInstance, ServerConfig::ServerName, Extensible::Shrink(), stringtime(), TellAlreadyOnList(), TellListTooLong(), TellNotSet(), ListItem::time, ValidateParam(), and User::WriteNumeric().

virtual void ListModeBase::RemoveMode User ,
irc::modestacker stack
[inline, virtual]
 

See mode.h.

Reimplemented from ModeHandler.

Definition at line 232 of file u_listmode.h.

virtual void ListModeBase::RemoveMode Channel channel,
irc::modestacker stack
[inline, virtual]
 

Remove all instances of the mode from a channel.

See mode.h

Parameters:
channel The channel to remove all instances of the mode from

Reimplemented from ModeHandler.

Definition at line 196 of file u_listmode.h.

References Extensible::GetExt(), irc::modestacker::GetStackedLine(), infokey, Channel::name, irc::modestacker::Push(), and ModeHandler::ServerInstance.

virtual void ListModeBase::TellAlreadyOnList User ,
Channel ,
std::string
[inline, virtual]
 

Tell the user an item is already on the list.

Overridden by implementing module.

Parameters:
source Source user adding the parameter
channel Channel the parameter is being added to
parameter The actual parameter being added

Reimplemented in ChanFilter.

Definition at line 479 of file u_listmode.h.

Referenced by OnModeChange().

virtual bool ListModeBase::TellListTooLong User ,
Channel ,
std::string
[inline, virtual]
 

Tell the user the list is too long.

Overridden by implementing module.

Parameters:
source Source user adding the parameter
channel Channel the parameter is being added to
parameter The actual parameter being added
Returns:
Ignored

Reimplemented in ChanFilter.

Definition at line 468 of file u_listmode.h.

Referenced by OnModeChange().

virtual void ListModeBase::TellNotSet User ,
Channel ,
std::string
[inline, virtual]
 

Tell the user that the parameter is not in the list.

Overridden by implementing module.

Parameters:
source Source user removing the parameter
channel Channel the parameter is being removed from
parameter The actual parameter being removed

Reimplemented in ChanFilter.

Definition at line 489 of file u_listmode.h.

Referenced by OnModeChange().

virtual bool ListModeBase::ValidateParam User ,
Channel ,
std::string
[inline, virtual]
 

Validate parameters.

Overridden by implementing module.

Parameters:
source Source user adding the parameter
channel Channel the parameter is being added to
parameter The actual parameter being added
Returns:
true if the parameter is valid

Reimplemented in ChanFilter.

Definition at line 456 of file u_listmode.h.

Referenced by OnModeChange().


Member Data Documentation

limitlist ListModeBase::chanlimits [protected]
 

Limits on a per-channel basis read from the tag specified in ListModeBase::configtag.

Definition at line 131 of file u_listmode.h.

Referenced by DoRehash(), and OnModeChange().

std::string ListModeBase::configtag [protected]
 

Config tag to check for max items per channel.

Definition at line 127 of file u_listmode.h.

Referenced by DoRehash().

unsigned int ListModeBase::endoflistnumeric [protected]
 

Numeric to indicate end of list.

Definition at line 118 of file u_listmode.h.

Referenced by DisplayEmptyList(), and DisplayList().

std::string ListModeBase::endofliststring [protected]
 

String to send for end of list.

Definition at line 121 of file u_listmode.h.

Referenced by DisplayEmptyList(), and DisplayList().

std::string ListModeBase::infokey [protected]
 

Storage key.

Definition at line 112 of file u_listmode.h.

Referenced by DisplayList(), DoChannelDelete(), DoSyncChannel(), GetInfoKey(), ListModeBase(), ModeSet(), OnModeChange(), and RemoveMode().

unsigned int ListModeBase::listnumeric [protected]
 

Numeric to use when outputting the list.

Definition at line 115 of file u_listmode.h.

Referenced by DisplayList().

bool ListModeBase::tidy [protected]
 

Automatically tidy up entries.

Definition at line 124 of file u_listmode.h.


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