* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2010 InspIRCd Development Team
* See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
#ifndef __XLINE_H
#define __XLINE_H
-//#include <string>
-//#include <deque>
-//#include <vector>
-
/** 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
std::string nick;
};
-/** Contains an ident and host split into two strings
- */
-typedef std::pair<std::string, std::string> IdentHostPair;
-
/** XLineFactory is used to generate an XLine pointer, given just the
* pattern, timing information and type of line to create. This is used
* for example in the spanningtree module which will call an XLineFactory
* does not have to know the specifics of the internals of an XLine class
* and/or how to call its constructor.
*/
-class CoreExport XLineFactory : public classbase
+class CoreExport XLineFactory
{
protected:
virtual ~XLineFactory() { }
};
-/* Required forward declarations
- */
-class ServerConfig;
-
-class GLineFactory;
-class ELineFactory;
-class QLineFactory;
-class ZLineFactory;
-class KLineFactory;
-
-/** A map of xline factories
- */
-typedef std::map<std::string, XLineFactory*> XLineFactMap;
-
-/** A map of XLines indexed by string
- */
-typedef std::map<irc::string, XLine *> XLineLookup;
-
-/** A map of XLineLookup maps indexed by string
- */
-typedef std::map<std::string, XLineLookup > XLineContainer;
-
-/** An iterator in an XLineContainer
- */
-typedef XLineContainer::iterator ContainerIter;
-
-/** An interator in an XLineLookup
- */
-typedef XLineLookup::iterator LookupIter;
-
/** XLineManager is a class used to manage glines, klines, elines, zlines and qlines,
* or any other line created by a module. It also manages XLineFactory classes which
* can generate a specialized XLine for use by another module.
*/
-class CoreExport XLineManager : public classbase
+class CoreExport XLineManager
{
protected:
/** Used to hold XLines which have not yet been applied.
*/
XLineFactMap line_factory;
- /** Core xline factories for G/E/K/Q/Z lines
- * (These generate GLine, ELine, KLine, QLine and ZLine
- * respectively)
- */
- GLineFactory* GFact;
- ELineFactory* EFact;
- KLineFactory* KFact;
- QLineFactory* QFact;
- ZLineFactory* ZFact;
-
/** Container of all lines, this is a map of maps which
* allows for fast lookup for add/remove of a line, and
* the shortest possible timed O(n) for checking a user
void InvokeStats(const std::string &type, int numeric, User* user, string_list &results);
};
-/** An XLineFactory specialized to generate GLine* pointers
- */
-class CoreExport GLineFactory : public XLineFactory
-{
- public:
- GLineFactory() : XLineFactory("G") { }
-
- /** Generate a GLine
- */
- XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
- {
- IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask);
- return new GLine(set_time, duration, source, reason, ih.first, ih.second);
- }
-};
-
-/** An XLineFactory specialized to generate ELine* pointers
- */
-class CoreExport ELineFactory : public XLineFactory
-{
- public:
- ELineFactory() : XLineFactory("E") { }
-
- /** Generate an ELine
- */
- XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
- {
- IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask);
- return new ELine(set_time, duration, source, reason, ih.first, ih.second);
- }
-};
-
-/** An XLineFactory specialized to generate KLine* pointers
- */
-class CoreExport KLineFactory : public XLineFactory
-{
- public:
- KLineFactory() : XLineFactory("K") { }
-
- /** Generate a KLine
- */
- XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
- {
- IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask);
- return new KLine(set_time, duration, source, reason, ih.first, ih.second);
- }
-};
-
-/** An XLineFactory specialized to generate QLine* pointers
- */
-class CoreExport QLineFactory : public XLineFactory
-{
- public:
- QLineFactory() : XLineFactory("Q") { }
-
- /** Generate a QLine
- */
- XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
- {
- return new QLine(set_time, duration, source, reason, xline_specific_mask);
- }
-};
-
-/** An XLineFactory specialized to generate ZLine* pointers
- */
-class CoreExport ZLineFactory : public XLineFactory
-{
- public:
- ZLineFactory() : XLineFactory("Z") { }
-
- /** Generate a ZLine
- */
- XLine* Generate(time_t set_time, long duration, std::string source, std::string reason, std::string xline_specific_mask)
- {
- return new ZLine(set_time, duration, source, reason, xline_specific_mask);
- }
-};
-
#endif