summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 11:06:40 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-11 11:06:40 +0000
commit312d49abb008dccf9871b663decaa1bacf18c20a (patch)
tree5160e2aef34cfdfffa5d22eefc02c6921fc30ad3 /include
parentfe66a14a06c5542a8b127e2f1e0a51e4dc2946dc (diff)
Move all of the xline stuff into class XLineManager, make an instance of it in class InspIRCd and use it
(eliminates another extern) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4878 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/configreader.h2
-rw-r--r--include/inspircd.h2
-rw-r--r--include/xline.h95
3 files changed, 66 insertions, 33 deletions
diff --git a/include/configreader.h b/include/configreader.h
index b95cdede5..a63e31d71 100644
--- a/include/configreader.h
+++ b/include/configreader.h
@@ -84,6 +84,8 @@ class ServerConfig : public Extensible
bool CheckOnce(char* tag, bool bail, userrec* user);
public:
+
+ InspIRCd* GetInstance();
/** This holds all the information in the config file,
* it's indexed by tag name to a vector of key/values.
diff --git a/include/inspircd.h b/include/inspircd.h
index 7808ad4e6..699d910dc 100644
--- a/include/inspircd.h
+++ b/include/inspircd.h
@@ -77,6 +77,7 @@ class serverstats : public classbase
}
};
+class XLineManager;
class InspIRCd : public classbase
{
@@ -132,6 +133,7 @@ class InspIRCd : public classbase
DNS* Res;
TimerManager* Timers;
command_table cmdlist;
+ XLineManager* XLines;
ModuleList modules;
FactoryList factory;
diff --git a/include/xline.h b/include/xline.h
index b04d2224d..f393abc76 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -124,6 +124,7 @@ class QLine : public XLine
};
class ServerConfig;
+class InspIRCd;
bool InitXLine(ServerConfig* conf, const char* tag);
bool DoneXLine(ServerConfig* conf, const char* tag);
@@ -133,39 +134,67 @@ bool DoQLine(ServerConfig* conf, const char* tag, char** entries, void** values,
bool DoKLine(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
bool DoELine(ServerConfig* conf, const char* tag, char** entries, void** values, int* types);
-bool add_gline(long duration, const char* source, const char* reason, const char* hostmask);
-bool add_qline(long duration, const char* source, const char* reason, const char* nickname);
-bool add_zline(long duration, const char* source, const char* reason, const char* ipaddr);
-bool add_kline(long duration, const char* source, const char* reason, const char* hostmask);
-bool add_eline(long duration, const char* source, const char* reason, const char* hostmask);
-
-bool del_gline(const char* hostmask);
-bool del_qline(const char* nickname);
-bool del_zline(const char* ipaddr);
-bool del_kline(const char* hostmask);
-bool del_eline(const char* hostmask);
-
-char* matches_qline(const char* nick);
-char* matches_gline(const char* host);
-char* matches_zline(const char* ipaddr);
-char* matches_kline(const char* host);
-char* matches_exception(const char* host);
-
-void expire_lines();
-void apply_lines(const int What);
-
-void stats_k(userrec* user, string_list &results);
-void stats_g(userrec* user, string_list &results);
-void stats_q(userrec* user, string_list &results);
-void stats_z(userrec* user, string_list &results);
-void stats_e(userrec* user, string_list &results);
-
-void gline_set_creation_time(const char* host, time_t create_time);
-void qline_set_creation_time(const char* nick, time_t create_time);
-void zline_set_creation_time(const char* ip, time_t create_time);
-void eline_set_creation_time(const char* host, time_t create_time);
+class XLineManager
+{
+ protected:
+ InspIRCd* ServerInstance;
+
+ static bool XLineManager::GSortComparison ( const GLine one, const GLine two );
+ static bool XLineManager::ESortComparison ( const ELine one, const ELine two );
+ static bool XLineManager::ZSortComparison ( const ZLine one, const ZLine two );
+ static bool XLineManager::KSortComparison ( const KLine one, const KLine two );
+ static bool XLineManager::QSortComparison ( const QLine one, const QLine two );
+ public:
+ /* Lists for temporary lines with an expiry time */
+ std::vector<KLine> klines;
+ std::vector<GLine> glines;
+ std::vector<ZLine> zlines;
+ std::vector<QLine> qlines;
+ std::vector<ELine> elines;
+
+ /* Seperate lists for perm XLines that isnt checked by expiry functions */
+ std::vector<KLine> pklines;
+ std::vector<GLine> pglines;
+ std::vector<ZLine> pzlines;
+ std::vector<QLine> pqlines;
+ std::vector<ELine> pelines;
+
+ XLineManager(InspIRCd* Instance);
+
+ bool add_gline(long duration, const char* source, const char* reason, const char* hostmask);
+ bool add_qline(long duration, const char* source, const char* reason, const char* nickname);
+ bool add_zline(long duration, const char* source, const char* reason, const char* ipaddr);
+ bool add_kline(long duration, const char* source, const char* reason, const char* hostmask);
+ bool add_eline(long duration, const char* source, const char* reason, const char* hostmask);
+
+ bool del_gline(const char* hostmask);
+ bool del_qline(const char* nickname);
+ bool del_zline(const char* ipaddr);
+ bool del_kline(const char* hostmask);
+ bool del_eline(const char* hostmask);
+
+ char* matches_qline(const char* nick);
+ char* matches_gline(const char* host);
+ char* matches_zline(const char* ipaddr);
+ char* matches_kline(const char* host);
+ char* matches_exception(const char* host);
+
+ void expire_lines();
+ void apply_lines(const int What);
+
+ void stats_k(userrec* user, string_list &results);
+ void stats_g(userrec* user, string_list &results);
+ void stats_q(userrec* user, string_list &results);
+ void stats_z(userrec* user, string_list &results);
+ void stats_e(userrec* user, string_list &results);
+
+ void gline_set_creation_time(const char* host, time_t create_time);
+ void qline_set_creation_time(const char* nick, time_t create_time);
+ void zline_set_creation_time(const char* ip, time_t create_time);
+ void eline_set_creation_time(const char* host, time_t create_time);
-bool zline_make_global(const char* ipaddr);
-bool qline_make_global(const char* nickname);
+ bool zline_make_global(const char* ipaddr);
+ bool qline_make_global(const char* nickname);
+};
#endif