Anope IRC Services  Version 2.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | Static Private Attributes
XLineManager Class Referenceabstract

#include <xline.h>

Inheritance diagram for XLineManager:
Inheritance graph
[legend]
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
 
- Public Member Functions inherited from Service
 Service (Module *o, const Anope::string &t, const Anope::string &n)
 
virtual ~Service ()
 
void Register ()
 
void Unregister ()
 
- Public Member Functions inherited from Base
 Base ()
 
virtual ~Base ()
 
void AddReference (ReferenceBase *r)
 
void DelReference (ReferenceBase *r)
 

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 Member Functions inherited from Service
static ServiceFindService (const Anope::string &t, const Anope::string &n)
 
static std::vector< Anope::stringGetServiceKeys (const Anope::string &t)
 
static void AddAlias (const Anope::string &t, const Anope::string &n, const Anope::string &v)
 
static void DelAlias (const Anope::string &t, const Anope::string &n)
 

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
 

Additional Inherited Members

- Data Fields inherited from Service
Moduleowner
 
Anope::string type
 
Anope::string name
 

Detailed Description

Definition at line 53 of file xline.h.

Constructor & Destructor Documentation

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

Constructor

Definition at line 262 of file xline.cpp.

XLineManager::~XLineManager ( )
virtual

Destructor

Definition at line 266 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
sourceThe source adding the mask.
maskThe mask
expiresWhen the mask would expire
reasonthe reason
Returns
true if the mask can be added

Definition at line 344 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().

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

Check a user against an xline

Parameters
uThe user
xThe xline

Implemented in SNLineManager, SQLineManager, and SGLineManager.

Referenced by CheckAllXLines(), CommandOSSNLine::OnAdd(), and CommandOSSQLine::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 223 of file xline.cpp.

References CheckAllXLines(), and XLineManagers.

Referenced by OperServCore::OnUserConnect().

XLine * XLineManager::CheckAllXLines ( User u)

Check a user against all of the xlines in this XLineManager

Parameters
uThe user
Returns
The xline the user marches, if any.

Definition at line 415 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 332 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
xThe entry
Returns
true if the entry was found and deleted, else false

Definition at line 294 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 276 of file xline.cpp.

References xlines.

Referenced by CanAdd().

XLine * XLineManager::GetEntry ( unsigned  index)

Gets an entry by index

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

Definition at line 322 of file xline.cpp.

References Serializable::QueueUpdate(), and xlines.

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

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

Get the XLine vector

Returns
The vector

Definition at line 281 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
maskThe mask
Returns
The XLine the user matches, or NULL

Definition at line 391 of file xline.cpp.

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

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

void XLineManager::OnExpire ( const XLine x)
virtual

Called when an XLine expires

Parameters
xThe xline

Reimplemented in SNLineManager, SQLineManager, and SGLineManager.

Definition at line 438 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
uThe user
xThe XLine they match

Implemented in SNLineManager, SQLineManager, and SGLineManager.

Referenced by 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
xlmTHe XLineManager

Definition at line 210 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
uThe user, if we know it
xThe xline

Implemented in SNLineManager, SQLineManager, and SGLineManager.

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

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

Called to remove an XLine from the IRCd

Parameters
xThe XLine

Implemented in SNLineManager, SQLineManager, and SGLineManager.

Referenced by DelXLine().

const char & XLineManager::Type ( )

The type of xline provided by this service

Returns
The type

Definition at line 271 of file xline.cpp.

References type.

Referenced by LoadOper().

void XLineManager::UnregisterXLineManager ( XLineManager xlm)
static

Unregister a XLineManager

Parameters
xlmThe XLineManager

Definition at line 215 of file xline.cpp.

References XLineManagers.

Referenced by OperServCore::~OperServCore().

Field Documentation

char XLineManager::type
private

Definition at line 55 of file xline.h.

Referenced by Type().

std::list< XLineManager * > XLineManager::XLineManagers
static

Definition at line 62 of file xline.h.

Referenced by CheckAll(), LoadOper(), RegisterXLineManager(), and UnregisterXLineManager().

Serialize::Checker<std::vector<XLine *> > XLineManager::xlines
private

Definition at line 57 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
staticprivate

Definition at line 59 of file xline.h.

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


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