The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

XLine Class Reference

XLine is the base class for ban lines such as G lines and K lines. More...

#include <xline.h>

Inheritance diagram for XLine:

Inheritance graph
[legend]
Collaboration diagram for XLine:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 XLine (InspIRCd *Instance, time_t s_time, long d, const char *src, const char *re, const std::string &t)
 Create an XLine.
virtual ~XLine ()
 Destructor.
virtual void SetCreateTime (time_t created)
 Change creation time of an xline.
virtual bool Matches (User *u)=0
 Returns true whether or not the given user is covered by this line.
virtual bool Matches (const std::string &str)=0
 Returns true whether or not the given string is covered by this line.
virtual void Apply (User *u)
 Apply a line against a user.
virtual void Unset ()
 Called when the line is unset either via expiry or via explicit removal.
virtual void DisplayExpiry ()=0
 Called when the expiry message is to be displayed for the line.
virtual const char * Displayable ()=0
 Returns the displayable form of the pattern for this xline, e.g.
virtual void OnAdd ()
 Called when the xline has just been added.
virtual bool IsBurstable ()

Public Attributes

time_t set_time
 The time the line was added.
long duration
 The duration of the ban, or 0 if permenant.
char * source
 Source of the ban.
char * reason
 Reason for the ban.
time_t expiry
 Expiry time.
const std::string type
 "Q", "K", etc.

Protected Member Functions

void DefaultApply (User *u, const std::string &line, bool bancache)
 Default 'apply' action.

Protected Attributes

InspIRCdServerInstance
 Creator.

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).

Definition at line 28 of file xline.h.


Constructor & Destructor Documentation

XLine::XLine InspIRCd Instance,
time_t  s_time,
long  d,
const char *  src,
const char *  re,
const std::string t
[inline]
 

Create an XLine.

Parameters:
s_time The set time
d The duration of the xline
src The sender of the xline
re The reason of the xline
t The line type, should be set by the derived class constructor

Definition at line 51 of file xline.h.

virtual XLine::~XLine  )  [inline, virtual]
 

Destructor.

Definition at line 61 of file xline.h.


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:
u The user to apply against

Reimplemented in RLine, Shun, KLine, GLine, ZLine, and QLine.

Definition at line 432 of file xline.cpp.

Referenced by UserManager::AddUser(), XLineManager::ApplyLines(), User::CheckLines(), ModuleShun::OnUserConnect(), ModuleRLine::OnUserConnect(), and ModuleRLine::OnUserPostNick().

void XLine::DefaultApply User u,
const std::string line,
bool  bancache
[protected]
 

Default 'apply' action.

Quits the user.

Parameters:
u User to apply the line against
line The line typed, used for display purposes in the quit message
bancache If true, the user will be added to the bancache if they match. Else not.

Definition at line 441 of file xline.cpp.

References BanCacheManager::AddHit(), InspIRCd::BanCache, InspIRCd::Config, DEBUG, duration, User::GetIPString(), ServerConfig::HideBans, LogManager::Log(), InspIRCd::Logs, MAXBUF, ServerConfig::MoronBanner, User::nick, UserManager::QuitUser(), reason, ServerInstance, type, InspIRCd::Users, and User::WriteServ().

Referenced by ZLine::Apply(), GLine::Apply(), KLine::Apply(), and RLine::Apply().

virtual const char* XLine::Displayable  )  [pure virtual]
 

Returns the displayable form of the pattern for this xline, e.g.

'*' 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 for its Displayable() method)

Implemented in CBan, RLine, Shun, SVSHold, KLine, GLine, ELine, ZLine, and QLine.

Referenced by XLineManager::AddLine(), ModuleSpanningTree::OnAddLine(), ModuleSpanningTree::OnDelLine(), and ModuleXLineDB::WriteDatabase().

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 CBan, RLine, Shun, SVSHold, KLine, GLine, ELine, ZLine, and QLine.

bool XLine::IsBurstable  )  [virtual]
 

Reimplemented in KLine.

Definition at line 436 of file xline.cpp.

Referenced by ModuleSpanningTree::OnAddLine().

virtual bool XLine::Matches const std::string str  )  [pure virtual]
 

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

Parameters:
str The 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 CBan, RLine, Shun, SVSHold, KLine, GLine, ELine, ZLine, and QLine.

bool XLine::Matches User u  )  [pure virtual]
 

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

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

Implemented in CBan, RLine, Shun, SVSHold, KLine, GLine, ELine, ZLine, and QLine.

Definition at line 52 of file xline.cpp.

Referenced by XLineManager::ApplyLines(), and XLineManager::CheckELines().

virtual void XLine::OnAdd  )  [inline, virtual]
 

Called when the xline has just been added.

Reimplemented in ELine.

Definition at line 119 of file xline.h.

virtual void XLine::SetCreateTime time_t  created  )  [inline, virtual]
 

Change creation time of an xline.

Updates expiry to be after the creation time

Definition at line 70 of file xline.h.

Referenced by TreeSocket::AddLine(), and ModuleXLineDB::ReadDatabase().

virtual void XLine::Unset  )  [inline, virtual]
 

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

Reimplemented in ELine.

Definition at line 100 of file xline.h.


Member Data Documentation

long XLine::duration
 

The duration of the ban, or 0 if permenant.

Definition at line 127 of file xline.h.

Referenced by TreeSocket::AddLine(), DefaultApply(), SVSHold::DisplayExpiry(), Shun::DisplayExpiry(), RLine::DisplayExpiry(), CBan::DisplayExpiry(), ModuleSpanningTree::OnAddLine(), and ModuleXLineDB::WriteDatabase().

time_t XLine::expiry
 

Expiry time.

Does not contain useful data if the duration is 0.

Definition at line 139 of file xline.h.

Referenced by TreeSocket::AddLine().

char* XLine::reason
 

Reason for the ban.

Definition at line 135 of file xline.h.

Referenced by DefaultApply(), ModuleSpanningTree::OnAddLine(), ModuleCBan::OnUserPreJoin(), ModuleSVSHold::OnUserPreNick(), and ModuleXLineDB::WriteDatabase().

InspIRCd* XLine::ServerInstance [protected]
 

Creator.

Definition at line 33 of file xline.h.

Referenced by DefaultApply(), GLine::DisplayExpiry(), KLine::DisplayExpiry(), ZLine::DisplayExpiry(), QLine::DisplayExpiry(), ELine::DisplayExpiry(), SVSHold::DisplayExpiry(), Shun::DisplayExpiry(), RLine::DisplayExpiry(), CBan::DisplayExpiry(), ELine::OnAdd(), RLine::RLine(), and ELine::Unset().

time_t XLine::set_time
 

The time the line was added.

Definition at line 123 of file xline.h.

Referenced by ModuleSpanningTree::OnAddLine(), and ModuleXLineDB::WriteDatabase().

char* XLine::source
 

Source of the ban.

This can be a servername or an oper nickname

Definition at line 131 of file xline.h.

Referenced by SVSHold::DisplayExpiry(), Shun::DisplayExpiry(), RLine::DisplayExpiry(), and CBan::DisplayExpiry().

const std::string XLine::type
 

"Q", "K", etc.

Set only by derived classes constructor to the type of line this is.

Definition at line 144 of file xline.h.

Referenced by XLineManager::AddLine(), DefaultApply(), ModuleSpanningTree::OnAddLine(), ModuleSpanningTree::OnDelLine(), and ModuleXLineDB::WriteDatabase().


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