#include <xline.h>
|
| 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, 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) |
|
void | ApplyLines () |
|
void | InvokeStats (const std::string &type, int numeric, User *user, string_list &results) |
|
XLineManager is a class used to manage glines, klines, elines, zlines and qlines, 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::XLineManager |
( |
| ) |
|
◆ ~XLineManager()
XLineManager::~XLineManager |
( |
| ) |
|
◆ AddLine()
bool XLineManager::AddLine |
( |
XLine * |
line, |
|
|
User * |
user |
|
) |
| |
Add a new XLine
- Parameters
-
line | The line to be added |
user | The user adding the line or NULL for the local server |
- Returns
- True if the line was added successfully
◆ ApplyLines()
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.
◆ CheckELines()
void XLineManager::CheckELines |
( |
| ) |
|
Checks what users match e:lines and sets their ban exempt flag accordingly.
◆ DelAll()
void XLineManager::DelAll |
( |
const std::string & |
type | ) |
|
Remove all lines of a certain type.
◆ DelLine()
bool XLineManager::DelLine |
( |
const char * |
hostmask, |
|
|
const std::string & |
type, |
|
|
User * |
user, |
|
|
bool |
simulate = false |
|
) |
| |
Delete an XLine
- Parameters
-
hostmask | The xline-specific string identifying the line, e.g. "*@foo" |
type | The type of xline |
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 |
- Returns
- True if the line was deleted successfully
◆ ExpireLine()
void XLineManager::ExpireLine |
( |
ContainerIter |
container, |
|
|
LookupIter |
item |
|
) |
| |
Expire a line given two iterators which identify it in the main map.
- Parameters
-
container | Iterator to the first level of entries the map |
item | Iterator to the second level of entries in the map |
◆ GetAll()
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.
- Parameters
-
- Returns
- A list of all XLines of the given type.
◆ GetAllTypes()
std::vector< std::string > XLineManager::GetAllTypes |
( |
| ) |
|
Return all known types of line currently stored by the XLineManager.
- Returns
- A vector containing all known line types currently stored in the main list.
◆ GetFactory()
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.
- Parameters
-
◆ IdentSplit()
IdentHostPair XLineManager::IdentSplit |
( |
const std::string & |
ident_and_host | ) |
|
Split an ident and host into two seperate strings. This allows for faster matching.
◆ InvokeStats()
void XLineManager::InvokeStats |
( |
const std::string & |
type, |
|
|
int |
numeric, |
|
|
User * |
user, |
|
|
string_list & |
results |
|
) |
| |
Handle /STATS for a given type. NOTE: Any items in the list for this particular line type which have expired will be expired and removed before the list is displayed.
- Parameters
-
type | The type of stats to show |
numeric | The numeric to give to each result line |
user | The username making the query |
results | The string_list to receive the results |
◆ MatchesLine() [1/2]
XLine * XLineManager::MatchesLine |
( |
const std::string & |
type, |
|
|
const std::string & |
pattern |
|
) |
| |
Check if a pattern matches an XLine
- Parameters
-
type | The type of line to look up |
pattern | A pattern string specific to the xline type |
- Returns
- The matching XLine if there is a match, or NULL if there is no match
◆ MatchesLine() [2/2]
XLine * XLineManager::MatchesLine |
( |
const std::string & |
type, |
|
|
User * |
user |
|
) |
| |
Check if a user matches an XLine
- Parameters
-
type | The type of line to look up |
user | The user to match against (what is checked is specific to the xline type) |
- Returns
- The reason for the line if there is a match, or NULL if there is no match
◆ RegisterFactory()
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 glines 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.
- Parameters
-
◆ UnregisterFactory()
Unregisters an xline factory. You must do this when your module unloads.
- Parameters
-
◆ line_factory
XLineFactMap XLineManager::line_factory |
|
protected |
◆ lookup_lines
XLineContainer XLineManager::lookup_lines |
|
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.
◆ pending_lines
std::vector<XLine *> XLineManager::pending_lines |
|
protected |
Used to hold XLines which have not yet been applied.
The documentation for this class was generated from the following files: