Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes

XLineManager Class Reference

#include <xline.h>

Inherits Service.

Inherited by SGLineManager, SNLineManager, and SQLineManager.

Collaboration diagram for XLineManager:
Collaboration graph
[legend]

Public Member Functions

 XLineManager (Module *creator, const Anope::string &name, char t)
virtual ~XLineManager ()
const char & Type ()
size_t GetCount () const
const std::vector< XLine * > & GetList () const
void AddXLine (XLine *x)
bool DelXLine (XLine *x)
XLineGetEntry (unsigned index)
void Clear ()
bool CanAdd (CommandSource &source, const Anope::string &mask, time_t expires, const Anope::string &reason)
XLineHasEntry (const Anope::string &mask)
XLineCheckAllXLines (User *u)
virtual bool Check (User *u, const XLine *x)=0
virtual void OnMatch (User *u, XLine *x)=0
virtual void OnExpire (const XLine *x)
virtual void Send (User *u, XLine *x)=0
virtual void SendDel (XLine *x)=0

Static Public Member Functions

static void RegisterXLineManager (XLineManager *xlm)
static void UnregisterXLineManager (XLineManager *xlm)
static void CheckAll (User *u)
static Anope::string GenerateUID ()

Static Public Attributes

static std::list< XLineManager * > XLineManagers

Private Attributes

char type
Serialize::Checker
< std::vector< XLine * > > 
xlines

Static Private Attributes

static Serialize::Checker
< std::multimap< Anope::string,
XLine *, ci::less > > 
XLinesByUID

Detailed Description

Definition at line 50 of file xline.h.


Constructor & Destructor Documentation

XLineManager::XLineManager ( Module creator,
const Anope::string name,
char  t 
)

Constructor

Definition at line 253 of file xline.cpp.

XLineManager::~XLineManager (  )  [virtual]

Destructor

Definition at line 257 of file xline.cpp.

References Clear().


Member Function Documentation

void XLineManager::AddXLine ( XLine x  ) 
bool XLineManager::CanAdd ( CommandSource source,
const Anope::string mask,
time_t  expires,
const Anope::string reason 
)

Checks if a mask can/should be added to the XLineManager

Parameters:
source The source adding the mask.
mask The mask
expires When the mask would expire
reason the reason
Returns:
true if the mask can be added

Definition at line 335 of file xline.cpp.

References _, Anope::string::c_str(), DelXLine(), Anope::string::equals_ci(), XLine::expires, GetCount(), GetEntry(), XLine::mask, Anope::Match(), XLine::reason, and CommandSource::Reply().

Referenced by CommandOSSNLine::OnAdd().

virtual bool XLineManager::Check ( User u,
const XLine x 
) [pure virtual]

Check a user against an xline

Parameters:
u The user
x The xline

Implemented in SGLineManager, SQLineManager, and SNLineManager.

Referenced by CheckAllXLines(), CommandOSSQLine::OnAdd(), and CommandOSSNLine::OnAdd().

void XLineManager::CheckAll ( User u  )  [static]

Check a user against all known XLineManagers Wparam u The user

Returns:
A pair of the XLineManager the user was found in and the XLine they matched, both may be NULL for no match

Definition at line 211 of file xline.cpp.

References CheckAllXLines(), OnMatch(), and XLineManagers.

Referenced by OperServCore::OnUserConnect().

XLine * XLineManager::CheckAllXLines ( User u  ) 

Check a user against all of the xlines in this XLineManager

Parameters:
u The user
Returns:
The xline the user marches, if any.

Definition at line 406 of file xline.cpp.

References Check(), Anope::CurTime, DelXLine(), XLine::expires, OnExpire(), OnMatch(), and xlines.

Referenced by CheckAll(), and OperServCore::OnUserNickChange().

void XLineManager::Clear (  ) 

Clear the XLine vector Note: This does not remove the XLines from the IRCd

Definition at line 323 of file xline.cpp.

References Anope::string::empty(), XLine::id, xlines, and XLinesByUID.

Referenced by OperServCore::~OperServCore(), and ~XLineManager().

bool XLineManager::DelXLine ( XLine x  ) 

Delete an entry from this XLineManager

Parameters:
x The entry
Returns:
true if the entry was found and deleted, else false

Definition at line 285 of file xline.cpp.

References Anope::string::empty(), XLine::id, SendDel(), xlines, and XLinesByUID.

Referenced by CanAdd(), CheckAllXLines(), SXLineDelCallback::DoDel(), CommandOSSXLineBase::OnClear(), and XLine::Unserialize().

Anope::string XLineManager::GenerateUID (  )  [static]
size_t XLineManager::GetCount (  )  const

Get the number of XLines in this XLineManager

Returns:
The number of XLines

Definition at line 267 of file xline.cpp.

References xlines.

Referenced by CanAdd(), and DBPlain::OnSaveDatabase().

XLine * XLineManager::GetEntry ( unsigned  index  ) 

Gets an entry by index

Parameters:
index The index
Returns:
The XLine, or NULL if the index is out of bounds

Definition at line 313 of file xline.cpp.

References Serializable::QueueUpdate(), and xlines.

Referenced by CanAdd(), SXLineDelCallback::HandleNumber(), CommandOSSXLineBase::OnClear(), DBPlain::OnSaveDatabase(), and CommandOSSXLineBase::ProcessList().

const std::vector< XLine * > & XLineManager::GetList (  )  const

Get the XLine vector

Returns:
The vector

Definition at line 272 of file xline.cpp.

References xlines.

Referenced by SQLineManager::CheckChannel().

XLine * XLineManager::HasEntry ( const Anope::string mask  ) 

Checks if this list has an entry

Parameters:
mask The mask
Returns:
The XLine the user matches, or NULL

Definition at line 382 of file xline.cpp.

References Anope::string::equals_ci(), XLine::mask, Serializable::QueueUpdate(), xlines, and XLinesByUID.

Referenced by CommandOSSXLineBase::OnDel(), UnrealIRCdProto::SendAkill(), InspIRCd12Proto::SendAkill(), InspIRCdProto::SendAkill(), HybridProto::SendAkill(), and BahamutIRCdProto::SendAkill().

void XLineManager::OnExpire ( const XLine x  )  [virtual]

Called when an XLine expires

Parameters:
x The xline

Reimplemented in SGLineManager, SQLineManager, and SNLineManager.

Definition at line 429 of file xline.cpp.

Referenced by CheckAllXLines().

virtual void XLineManager::OnMatch ( User u,
XLine x 
) [pure virtual]

Called when a user matches a xline in this XLineManager

Parameters:
u The user
x The XLine they match

Implemented in SGLineManager, SQLineManager, and SNLineManager.

Referenced by CheckAll(), and CheckAllXLines().

void XLineManager::RegisterXLineManager ( XLineManager xlm  )  [static]

Register a XLineManager, places it in XLineManagers for use in XLineManager::CheckAll It is important XLineManagers are registered in the proper order. Eg, if you had one akilling clients and one handing them free olines, you would want the akilling one first. This way if a client matches an entry on both of the XLineManagers, they would be akilled.

Parameters:
xlm THe XLineManager

Definition at line 198 of file xline.cpp.

References XLineManagers.

Referenced by OperServCore::OperServCore().

virtual void XLineManager::Send ( User u,
XLine x 
) [pure virtual]

Called to send an XLine to the IRCd

Parameters:
u The user, if we know it
x The xline

Implemented in SGLineManager, SQLineManager, and SNLineManager.

Referenced by CommandOSSQLine::OnAdd(), and CommandOSSNLine::OnAdd().

virtual void XLineManager::SendDel ( XLine x  )  [pure virtual]

Called to remove an XLine from the IRCd

Parameters:
x The XLine

Implemented in SGLineManager, SQLineManager, and SNLineManager.

Referenced by DelXLine().

const char & XLineManager::Type (  ) 

The type of xline provided by this service

Returns:
The type

Definition at line 262 of file xline.cpp.

References type.

Referenced by LoadOper(), LoadOperInfo(), and DBPlain::OnSaveDatabase().

void XLineManager::UnregisterXLineManager ( XLineManager xlm  )  [static]

Unregister a XLineManager

Parameters:
xlm The XLineManager

Definition at line 203 of file xline.cpp.

References XLineManagers.

Referenced by OperServCore::~OperServCore().


Field Documentation

char XLineManager::type [private]

Reimplemented from Service.

Definition at line 52 of file xline.h.

Referenced by Type().

std::list< XLineManager * > XLineManager::XLineManagers [static]
Serialize::Checker<std::vector<XLine *> > XLineManager::xlines [private]

Definition at line 54 of file xline.h.

Referenced by AddXLine(), CheckAllXLines(), Clear(), DelXLine(), GetCount(), GetEntry(), GetList(), and HasEntry().

Serialize::Checker< std::multimap< Anope::string, XLine *, ci::less > > XLineManager::XLinesByUID [static, private]

Definition at line 56 of file xline.h.

Referenced by AddXLine(), Clear(), DelXLine(), GenerateUID(), and HasEntry().


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