summaryrefslogtreecommitdiff
path: root/include/xline.h
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-31 19:26:26 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-31 19:26:26 +0000
commit31eaefa6a6244bc1226bacf9b3d9e527f49f035f (patch)
treeb26a353635e60b820c0b8ce57bd7bbcf1fb1d048 /include/xline.h
parentdcd26f6b564ade8fa51f1adb972c4e1fb5f234c7 (diff)
Add factories for eline and gline as tests
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8438 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include/xline.h')
-rw-r--r--include/xline.h46
1 files changed, 40 insertions, 6 deletions
diff --git a/include/xline.h b/include/xline.h
index a94161738..edde8d91a 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -343,16 +343,21 @@ class CoreExport QLine : public XLine
char* nick;
};
-class XLineFactory
+/** Contains an ident and host split into two strings
+ */
+typedef std::pair<std::string, std::string> IdentHostPair;
+
+
+class CoreExport XLineFactory
{
protected:
- const char type;
InspIRCd* ServerInstance;
+ const char type;
public:
- XLineFactory(const char t) : type(t) { }
+ XLineFactory(InspIRCd* Instance, const char t) : ServerInstance(Instance), type(t) { }
virtual const char GetType() { return type; }
@@ -366,9 +371,8 @@ class XLineFactory
class ServerConfig;
class InspIRCd;
-/** Contains an ident and host split into two strings
- */
-typedef std::pair<std::string, std::string> IdentHostPair;
+class GLineFactory;
+class ELineFactory;
/** XLineManager is a class used to manage glines, klines, elines, zlines and qlines.
*/
@@ -391,6 +395,9 @@ class CoreExport XLineManager
std::map<char, XLineFactory*> line_factory;
+ GLineFactory* GFact;
+ ELineFactory* EFact;
+
public:
std::map<char, std::map<std::string, XLine *> > lookup_lines;
@@ -400,6 +407,8 @@ class CoreExport XLineManager
*/
XLineManager(InspIRCd* Instance);
+ ~XLineManager();
+
/** Split an ident and host into two seperate strings.
* This allows for faster matching.
*/
@@ -540,5 +549,30 @@ class CoreExport XLineManager
void eline_set_creation_time(const char* host, time_t create_time);
};
+class CoreExport GLineFactory : public XLineFactory
+{
+ public:
+ GLineFactory(InspIRCd* Instance) : XLineFactory(Instance, 'G') { }
+
+ XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ {
+ IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask);
+ return new GLine(ServerInstance, set_time, duration, source, reason, ih.first.c_str(), ih.second.c_str());
+ }
+};
+
+class CoreExport ELineFactory : public XLineFactory
+{
+ public:
+ ELineFactory(InspIRCd* Instance) : XLineFactory(Instance, 'E') { }
+
+ XLine* Generate(time_t set_time, long duration, const char* source, const char* reason, const char* xline_specific_mask)
+ {
+ IdentHostPair ih = ServerInstance->XLines->IdentSplit(xline_specific_mask);
+ return new ELine(ServerInstance, set_time, duration, source, reason, ih.first.c_str(), ih.second.c_str());
+ }
+};
+
+
#endif