summaryrefslogtreecommitdiff
path: root/src/xline.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-21 23:44:27 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-21 23:44:27 +0000
commit355b17f151fe8258a025a3db3240339ab7cea445 (patch)
tree46774e8284ffa297f51196b7954c80d4363ffcaa /src/xline.cpp
parent6ff7e3bae02a466e10006908565dfb606970ede2 (diff)
Update documentation and remove unused classes/functions
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11938 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/xline.cpp')
-rw-r--r--src/xline.cpp106
1 files changed, 93 insertions, 13 deletions
diff --git a/src/xline.cpp b/src/xline.cpp
index 5df0281c9..b101237a3 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -11,12 +11,89 @@
* ---------------------------------------------------
*/
-/* $Core */
-
#include "inspircd.h"
#include "xline.h"
#include "bancache.h"
+/** An XLineFactory specialized to generate GLine* pointers
+ */
+class 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 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 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 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 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);
+ }
+};
+
+
/*
* This is now version 3 of the XLine subsystem, let's see if we can get it as nice and
* efficient as we can this time so we can close this file and never ever touch it again ..
@@ -391,6 +468,13 @@ void XLineManager::InvokeStats(const std::string &type, int numeric, User* user,
XLineManager::XLineManager()
{
+ GLineFactory* GFact;
+ ELineFactory* EFact;
+ KLineFactory* KFact;
+ QLineFactory* QFact;
+ ZLineFactory* ZFact;
+
+
GFact = new GLineFactory;
EFact = new ELineFactory;
KFact = new KLineFactory;
@@ -406,17 +490,13 @@ XLineManager::XLineManager()
XLineManager::~XLineManager()
{
- UnregisterFactory(GFact);
- UnregisterFactory(EFact);
- UnregisterFactory(KFact);
- UnregisterFactory(QFact);
- UnregisterFactory(ZFact);
-
- delete GFact;
- delete EFact;
- delete KFact;
- delete QFact;
- delete ZFact;
+ const char gekqz[] = "GEKQZ";
+ for(unsigned int i=0; i < sizeof(gekqz); i++)
+ {
+ XLineFactory* xlf = GetFactory(std::string(1, gekqz[i]));
+ UnregisterFactory(xlf);
+ delete xlf;
+ }
// Delete all existing XLines
for (XLineContainer::iterator i = lookup_lines.begin(); i != lookup_lines.end(); i++)