InspIRCd  2.0
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::XLine ( time_t  s_time,
long  d,
std::string  src,
std::string  re,
const std::string &  t 

Create an XLine.

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

◆ ~XLine()

virtual XLine::~XLine ( )


Member Function Documentation

◆ Apply()

void XLine::Apply ( User u)

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

uThe user to apply against

Reimplemented in QLine, ZLine, GLine, and KLine.

◆ DefaultApply()

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

Default 'apply' action. Quits the user.

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.

◆ Displayable()

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 [email protected] for its Displayable() method)

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

◆ DisplayExpiry()

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.

◆ Matches() [1/2]

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

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

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.
True if there is a match

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

◆ Matches() [2/2]

bool XLine::Matches ( User u)
pure virtual

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

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

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

◆ OnAdd()

virtual void XLine::OnAdd ( )

Called when the xline has just been added.

Reimplemented in ELine.

◆ SetCreateTime()

virtual void XLine::SetCreateTime ( time_t  created)

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

◆ Unset()

virtual void XLine::Unset ( )

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

Reimplemented in ELine.

Member Data Documentation

◆ duration

long XLine::duration

The duration of the ban, or 0 if permenant

◆ expiry

time_t XLine::expiry

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

◆ reason

std::string XLine::reason

Reason for the ban

◆ set_time

time_t XLine::set_time

The time the line was added.

◆ source

std::string XLine::source

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

◆ type

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: