|
|||
|
|||
|
#include <xline.h>
Inheritance diagram for XLineManager:


Public Member Functions | |
| XLineManager (InspIRCd *Instance) | |
| Constructor. | |
| ~XLineManager () | |
| Destructor. | |
| IdentHostPair | IdentSplit (const std::string &ident_and_host) |
| Split an ident and host into two seperate strings. | |
| void | CheckELines () |
| Checks what users match e:lines and sets their ban exempt flag accordingly. | |
| XLineLookup * | GetAll (const std::string &type) |
| Get all lines of a certain type to an XLineLookup (std::map<std::string, XLine*>). | |
| void | DelAll (const std::string &type) |
| Remove all lines of a certain type. | |
| std::vector< std::string > | GetAllTypes () |
| Return all known types of line currently stored by the XLineManager. | |
| bool | AddLine (XLine *line, User *user) |
| Add a new XLine. | |
| bool | DelLine (const char *hostmask, const std::string &type, User *user, bool simulate=false) |
| Delete an XLine. | |
| bool | RegisterFactory (XLineFactory *xlf) |
| Registers an xline factory. | |
| bool | UnregisterFactory (XLineFactory *xlf) |
| Unregisters an xline factory. | |
| XLineFactory * | GetFactory (const std::string &type) |
| Get the XLineFactory for a specific type. | |
| XLine * | MatchesLine (const std::string &type, User *user) |
| Check if a user matches an XLine. | |
| XLine * | MatchesLine (const std::string &type, const std::string &pattern) |
| Check if a pattern matches an XLine. | |
| void | ExpireLine (ContainerIter container, LookupIter item) |
| Expire a line given two iterators which identify it in the main map. | |
| void | ApplyLines () |
| Apply any new lines that are pending to be applied. | |
| void | InvokeStats (const std::string &type, int numeric, User *user, string_list &results) |
| Handle /STATS for a given type. | |
Protected Attributes | |
| InspIRCd * | ServerInstance |
| The owner/creator of this class. | |
| std::vector< XLine * > | pending_lines |
| Used to hold XLines which have not yet been applied. | |
| XLineFactMap | line_factory |
| Current xline factories. | |
| GLineFactory * | GFact |
| Core xline factories for G/E/K/Q/Z lines (These generate GLine, ELine, KLine, QLine and ZLine respectively). | |
| ELineFactory * | EFact |
| KLineFactory * | KFact |
| QLineFactory * | QFact |
| ZLineFactory * | ZFact |
| XLineContainer | lookup_lines |
| 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. | |
It also manages XLineFactory classes which can generate a specialized XLine for use by another module.
Definition at line 460 of file xline.h.
|
|
Constructor.
Definition at line 390 of file xline.cpp. References EFact, GFact, KFact, QFact, RegisterFactory(), and ZFact. |
|
|
Destructor.
Definition at line 405 of file xline.cpp. References EFact, GFact, KFact, lookup_lines, QFact, UnregisterFactory(), and ZFact. |
|
||||||||||||
|
Add a new XLine.
Definition at line 166 of file xline.cpp. References XLineFactory::AutoApplyToUserList(), InspIRCd::BanCache, XLine::Displayable(), ExpireLine(), FOREACH_MOD, GetFactory(), I_OnAddLine, lookup_lines, pending_lines, BanCacheManager::RemoveEntries(), ServerInstance, InspIRCd::Time(), and XLine::type. Referenced by TreeSocket::AddLine(), DoELine(), DoKLine(), DoQLine(), DoZLine(), CommandSvshold::Handle(), cmd_shun::Handle(), CommandRLine::Handle(), CommandCBan::Handle(), DNSBLResolver::OnLookupComplete(), FilterBase::OnPreCommand(), ModuleAntiBear::OnPreCommand(), ModuleConnectBan::OnUserConnect(), FilterBase::OnUserPreNotice(), and ModuleXLineDB::ReadDatabase(). |
|
|
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. Definition at line 342 of file xline.cpp. References XLine::Apply(), UserManager::local_users, XLine::Matches(), pending_lines, ServerInstance, and InspIRCd::Users. Referenced by TreeSocket::AddLine(), TreeServer::FinishBurst(), CommandSvshold::Handle(), cmd_shun::Handle(), CommandRLine::Handle(), CommandCBan::Handle(), InspIRCd::InspIRCd(), DNSBLResolver::OnLookupComplete(), FilterBase::OnPreCommand(), ModuleAntiBear::OnPreCommand(), ModuleConnectBan::OnUserConnect(), FilterBase::OnUserPreNotice(), and InspIRCd::Run(). |
|
|
Checks what users match e:lines and sets their ban exempt flag accordingly.
Definition at line 60 of file xline.cpp. References User::exempt, UserManager::local_users, lookup_lines, XLine::Matches(), ServerInstance, and InspIRCd::Users. Referenced by DoneELine(), InspIRCd::InspIRCd(), InspIRCd::Run(), and ELine::Unset(). |
|
|
Remove all lines of a certain type.
Definition at line 118 of file xline.cpp. References ExpireLine(), and lookup_lines. Referenced by ModuleRLine::OnRehash(), ModuleCBan::~ModuleCBan(), ModuleRLine::~ModuleRLine(), ModuleShun::~ModuleShun(), and ModuleSVSHold::~ModuleSVSHold(). |
|
||||||||||||||||||||
|
Delete an XLine.
Definition at line 202 of file xline.cpp. References InspIRCd::BanCache, FOREACH_MOD, I_OnDelLine, lookup_lines, pending_lines, BanCacheManager::RemoveEntries(), and ServerInstance. Referenced by TreeSocket::DelLine(), CommandSvshold::Handle(), cmd_shun::Handle(), CommandRLine::Handle(), and CommandCBan::Handle(). |
|
||||||||||||
|
Expire a line given two iterators which identify it in the main map.
Definition at line 321 of file xline.cpp. References FOREACH_MOD, I_OnExpireLine, and pending_lines. Referenced by AddLine(), DelAll(), GetAll(), InvokeStats(), and MatchesLine(). |
|
|
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.
Definition at line 93 of file xline.cpp. References ExpireLine(), lookup_lines, ServerInstance, and InspIRCd::Time(). Referenced by TreeSocket::SendXLines(). |
|
|
Return all known types of line currently stored by the XLineManager.
Definition at line 134 of file xline.cpp. References lookup_lines. Referenced by TreeSocket::SendXLines(). |
|
|
Get the XLineFactory for a specific type. Returns NULL if there is no known handler for this xline type.
Definition at line 678 of file xline.cpp. References line_factory. Referenced by AddLine(), TreeSocket::AddLine(), and ModuleXLineDB::ReadDatabase(). |
|
|
Split an ident and host into two seperate strings. This allows for faster matching. Definition at line 142 of file xline.cpp. Referenced by DoELine(), DoKLine(), KLineFactory::Generate(), ELineFactory::Generate(), and GLineFactory::Generate(). |
|
||||||||||||||||||||
|
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.
Definition at line 359 of file xline.cpp. References InspIRCd::Config, ConvToStr(), ExpireLine(), lookup_lines, User::nick, ServerInstance, ServerConfig::ServerName, and InspIRCd::Time(). Referenced by ModuleSVSHold::OnStats(), ModuleShun::OnStats(), ModuleRLine::OnStats(), and ModuleCBan::OnStats(). |
|
||||||||||||
|
Check if a pattern matches an XLine.
Definition at line 285 of file xline.cpp. References ExpireLine(), lookup_lines, ServerInstance, and InspIRCd::Time(). |
|
||||||||||||
|
Check if a user matches an XLine.
Definition at line 248 of file xline.cpp. References ExpireLine(), lookup_lines, ServerInstance, and InspIRCd::Time(). Referenced by UserManager::AddUser(), User::CheckLines(), ModuleShun::OnPreCommand(), ModuleShun::OnUserConnect(), ModuleRLine::OnUserConnect(), ModuleRLine::OnUserPostNick(), ModuleCBan::OnUserPreJoin(), and ModuleSVSHold::OnUserPreNick(). |
|
|
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.
Definition at line 654 of file xline.cpp. References XLineFactory::GetType(), and line_factory. Referenced by ModuleCBan::ModuleCBan(), ModuleRLine::ModuleRLine(), ModuleShun::ModuleShun(), ModuleSVSHold::ModuleSVSHold(), and XLineManager(). |
|
|
Unregisters an xline factory. You must do this when your module unloads.
Definition at line 666 of file xline.cpp. References XLineFactory::GetType(), and line_factory. Referenced by ModuleCBan::~ModuleCBan(), ModuleRLine::~ModuleRLine(), ModuleShun::~ModuleShun(), ModuleSVSHold::~ModuleSVSHold(), and ~XLineManager(). |
|
|
Definition at line 480 of file xline.h. Referenced by XLineManager(), and ~XLineManager(). |
|
|
Core xline factories for G/E/K/Q/Z lines (These generate GLine, ELine, KLine, QLine and ZLine respectively).
Definition at line 479 of file xline.h. Referenced by XLineManager(), and ~XLineManager(). |
|
|
Definition at line 481 of file xline.h. Referenced by XLineManager(), and ~XLineManager(). |
|
|
Current xline factories.
Definition at line 473 of file xline.h. Referenced by GetFactory(), RegisterFactory(), and UnregisterFactory(). |
|
|
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.
Definition at line 490 of file xline.h. Referenced by AddLine(), CheckELines(), DelAll(), DelLine(), GetAll(), GetAllTypes(), InvokeStats(), MatchesLine(), and ~XLineManager(). |
|
|
Used to hold XLines which have not yet been applied.
Definition at line 469 of file xline.h. Referenced by AddLine(), ApplyLines(), DelLine(), and ExpireLine(). |
|
|
Definition at line 482 of file xline.h. Referenced by XLineManager(), and ~XLineManager(). |
|
|
The owner/creator of this class.
Definition at line 465 of file xline.h. Referenced by AddLine(), ApplyLines(), CheckELines(), DelLine(), GetAll(), InvokeStats(), and MatchesLine(). |
|
|
Definition at line 483 of file xline.h. Referenced by XLineManager(), and ~XLineManager(). |