InspIRCd  2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
XLine Class Referenceabstract

#include <xline.h>

Inheritance diagram for XLine:
classbase ELine GLine KLine QLine ZLine

Public Member Functions

 XLine (time_t s_time, long d, std::string src, std::string re, const std::string &t)
 
virtual ~XLine ()
 
virtual void SetCreateTime (time_t created)
 
virtual bool Matches (User *u)=0
 
virtual bool Matches (const std::string &str)=0
 
virtual void Apply (User *u)
 
virtual void Unset ()
 
virtual void DisplayExpiry ()=0
 
virtual const char * Displayable ()=0
 
virtual void OnAdd ()
 
virtual bool IsBurstable ()
 
- Public Member Functions inherited from classbase
virtual CullResult cull ()
 

Public Attributes

time_t set_time
 
long duration
 
std::string source
 
std::string reason
 
time_t expiry
 
const std::string type
 

Protected Member Functions

void DefaultApply (User *u, const std::string &line, bool bancache)
 

Detailed Description

XLine is the base class for ban lines such as G lines and K lines. Modules may derive from this, and their xlines will automatically be handled as expected by any protocol modules (e.g. m_spanningtree will propogate them using AddLine). The process of translating a type+pattern to a known line type is done by means of an XLineFactory object (see below).

Constructor & Destructor Documentation

XLine::XLine ( time_t  s_time,
long  d,
std::string  src,
std::string  re,
const std::string &  t 
)
inline

Create an XLine.

Parameters
s_timeThe set time
dThe duration of the xline
srcThe sender of the xline
reThe reason of the xline
tThe line type, should be set by the derived class constructor
virtual XLine::~XLine ( )
inlinevirtual

Destructor

Member Function Documentation

void XLine::Apply ( User u)
virtual

Apply a line against a user. The mechanics of what occurs when the line is applied are specific to the derived class.

Parameters
uThe user to apply against

Reimplemented in QLine, ZLine, GLine, and KLine.

void XLine::DefaultApply ( User u,
const std::string &  line,
bool  bancache 
)
protected

Default 'apply' action. Quits the user.

Parameters
uUser to apply the line against
lineThe line typed, used for display purposes in the quit message
bancacheIf true, the user will be added to the bancache if they match. Else not.
virtual const char* XLine::Displayable ( )
pure virtual

Returns the displayable form of the pattern for this xline, e.g. '*@foo' or 'baz'. This must always return the full pattern in a form which can be used to construct an entire derived xline, even if it is stored differently internally (e.g. GLine stores the ident and host parts seperately but will still return ident@host for its Displayable() method)

Implemented in QLine, ZLine, ELine, GLine, and KLine.

virtual void XLine::DisplayExpiry ( )
pure virtual

Called when the expiry message is to be displayed for the line. Usually a line in the form 'expiring Xline blah, set by...' see the DisplayExpiry methods of GLine, ELine etc.

Implemented in QLine, ZLine, ELine, GLine, and KLine.

bool XLine::Matches ( User u)
pure virtual

Returns true whether or not the given user is covered by this line.

Parameters
uThe user to match against. The mechanics of the match are defined by the derived class.
Returns
True if there is a match.

Implemented in QLine, ZLine, ELine, GLine, and KLine.

virtual bool XLine::Matches ( const std::string &  str)
pure virtual

Returns true whether or not the given string is covered by this line.

Parameters
strThe string to match against. The details of what must be in this string and the mechanics of the match are defined by the derived class.
Returns
True if there is a match

Implemented in QLine, ZLine, ELine, GLine, and KLine.

virtual void XLine::OnAdd ( )
inlinevirtual

Called when the xline has just been added.

Reimplemented in ELine.

virtual void XLine::SetCreateTime ( time_t  created)
inlinevirtual

Change creation time of an xline. Updates expiry to be after the creation time

virtual void XLine::Unset ( )
inlinevirtual

Called when the line is unset either via expiry or via explicit removal.

Reimplemented in ELine.

Member Data Documentation

long XLine::duration

The duration of the ban, or 0 if permenant

time_t XLine::expiry

Expiry time. Does not contain useful data if the duration is 0.

std::string XLine::reason

Reason for the ban

time_t XLine::set_time

The time the line was added.

std::string XLine::source

Source of the ban. This can be a servername or an oper nickname

const std::string XLine::type

"Q", "K", etc. Set only by derived classes constructor to the type of line this is.


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