InspIRCd
3.0
|
#include <xline.h>
Public Member Functions | |
XLineManager () | |
~XLineManager () | |
IdentHostPair | IdentSplit (const std::string &ident_and_host) |
void | CheckELines () |
XLineLookup * | GetAll (const std::string &type) |
void | DelAll (const std::string &type) |
std::vector< std::string > | GetAllTypes () |
bool | AddLine (XLine *line, User *user) |
bool | DelLine (const char *hostmask, const std::string &type, std::string &reason, User *user, bool simulate=false) |
bool | RegisterFactory (XLineFactory *xlf) |
bool | UnregisterFactory (XLineFactory *xlf) |
XLineFactory * | GetFactory (const std::string &type) |
XLine * | MatchesLine (const std::string &type, User *user) |
XLine * | MatchesLine (const std::string &type, const std::string &pattern) |
void | ExpireLine (ContainerIter container, LookupIter item, bool silent=false) |
void | ApplyLines () |
DEPRECATED_METHOD (void InvokeStats(const std::string &type, unsigned int numeric, Stats::Context &stats)) | |
bool | InvokeStats (const std::string &type, Stats::Context &context) |
void | ExpireRemovedConfigLines (const std::string &type, const insp::flat_set< std::string > &configlines) |
Protected Attributes | |
std::vector< XLine * > | pending_lines |
XLineFactMap | line_factory |
XLineContainer | lookup_lines |
XLineManager is a class used to manage G-lines, K-lines, E-lines, Z-lines and Q-lines, or any other line created by a module. It also manages XLineFactory classes which can generate a specialized XLine for use by another module.
XLineManager::XLineManager | ( | ) |
Constructor
XLineManager::~XLineManager | ( | ) |
Destructor
Add a new XLine
line | The line to be added |
user | The user adding the line or NULL for the local server |
void XLineManager::ApplyLines | ( | ) |
Apply any new lines that are pending to be applied. This will only apply lines in the pending_lines list, to save on CPU time.
void XLineManager::CheckELines | ( | ) |
Checks what users match E-lines and sets their ban exempt flag accordingly.
void XLineManager::DelAll | ( | const std::string & | type | ) |
Remove all lines of a certain type.
bool XLineManager::DelLine | ( | const char * | hostmask, |
const std::string & | type, | ||
std::string & | reason, | ||
User * | user, | ||
bool | simulate = false |
||
) |
Delete an XLine
hostmask | The xline-specific string identifying the line, e.g. "*@foo" |
type | The type of xline |
reason | The xline reason, if it is being removed successfully |
user | The user removing the line or NULL if its the local server |
simulate | If this is true, don't actually remove the line, just return |
XLineManager::DEPRECATED_METHOD | ( | void | InvokeStatsconst std::string &type, unsigned int numeric, Stats::Context &stats | ) |
DEPRECATED: use the bool InvokeStats(const std::string&, Stats::Context&)
overload instead.
void XLineManager::ExpireLine | ( | ContainerIter | container, |
LookupIter | item, | ||
bool | silent = false |
||
) |
Expire a line given two iterators which identify it in the main map.
container | Iterator to the first level of entries the map |
item | Iterator to the second level of entries in the map |
silent | If true, doesn't send an expiry SNOTICE. |
void XLineManager::ExpireRemovedConfigLines | ( | const std::string & | type, |
const insp::flat_set< std::string > & | configlines | ||
) |
Expire X-lines which were added by the server configuration and have been removed.
XLineLookup * XLineManager::GetAll | ( | const std::string & | type | ) |
Get all lines of a certain type to an XLineLookup (std::map<std::string, XLine*>). NOTE: When this function runs any expired items are removed from the list before it is returned to the caller.
type | The type to look up |
std::vector< std::string > XLineManager::GetAllTypes | ( | ) |
Return all known types of line currently stored by the XLineManager.
XLineFactory * XLineManager::GetFactory | ( | const std::string & | type | ) |
Get the XLineFactory for a specific type. Returns NULL if there is no known handler for this xline type.
type | The type of XLine you require the XLineFactory for |
IdentHostPair XLineManager::IdentSplit | ( | const std::string & | ident_and_host | ) |
Split an ident and host into two separate strings. This allows for faster matching.
bool XLineManager::InvokeStats | ( | const std::string & | type, |
Stats::Context & | context | ||
) |
Generates a /STATS response for the given X-line type.
type | The type of X-line to look up. |
context | The stats context to respond with. |
XLine * XLineManager::MatchesLine | ( | const std::string & | type, |
const std::string & | pattern | ||
) |
Check if a user matches an XLine
type | The type of line to look up |
user | The user to match against (what is checked is specific to the xline type) |
bool XLineManager::RegisterFactory | ( | XLineFactory * | xlf | ) |
Registers an xline factory. An xline factory is a class which when given a particular xline type, will generate a new XLine specialized to that type. For example if you pass the XLineFactory that handles G-lines some data it will return a pointer to a GLine, polymorphically represented as XLine. This is used where you do not know the full details of the item you wish to create, e.g. in a server protocol module like m_spanningtree, when you receive xlines from other servers.
xlf | XLineFactory pointer to register |
bool XLineManager::UnregisterFactory | ( | XLineFactory * | xlf | ) |
Unregisters an xline factory. You must do this when your module unloads.
xlf | XLineFactory pointer to unregister |
|
protected |
Current xline factories
|
protected |
Container of all lines, this is a map of maps which allows for fast lookup for add/remove of a line, and the shortest possible timed O(n) for checking a user against a line.
|
protected |
Used to hold XLines which have not yet been applied.