summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-13 12:41:46 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-13 12:41:46 +0000
commitc0f731e19d61a971af5cf26d073ccd25bfc5c91c (patch)
treecb070a261330b5110d30ecbcf4e446e1419886e2 /include
parent58f076212f6330429e027576eb32cfc75bde82ae (diff)
Added Server::AddGLine
Added Server::AddKLine Added Server::AddZLine Added Server::AddQLine Added Server::AddELine Added Server::DelGLine Added Server::DelKLine Added Server::DelZLine Added Server::DelQLine Added Server::DelELine Added Server::Duration git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1071 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'include')
-rw-r--r--include/commands.h4
-rw-r--r--include/modules.h72
-rw-r--r--include/xline.h26
3 files changed, 89 insertions, 13 deletions
diff --git a/include/commands.h b/include/commands.h
index 589168409..076db91ae 100644
--- a/include/commands.h
+++ b/include/commands.h
@@ -116,4 +116,8 @@ void handle_V(char token,char* params,serverrec* source,serverrec* reply, char*
*/
bool is_uline(const char* server);
+/** Other useful functions
+ */
+long duration(const char* str);
+
#endif
diff --git a/include/modules.h b/include/modules.h
index a366ebb73..44c91a47c 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -692,6 +692,78 @@ class Server : public classbase
*/
virtual bool PseudoToUser(userrec* alive,userrec* zombie,std::string message);
+ /** Adds a G-line
+ * The G-line is propogated to all of the servers in the mesh and enforced as soon as it is added.
+ * The duration must be in seconds, however you can use the Server::CalcDuration method to convert
+ * durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used
+ * to indicate who or what sent the data, usually this is the nickname of a person, or a server
+ * name.
+ */
+ virtual void AddGLine(long duration, std::string source, std::string reason, std::string hostmask);
+
+ /** Adds a Q-line
+ * The Q-line is propogated to all of the servers in the mesh and enforced as soon as it is added.
+ * The duration must be in seconds, however you can use the Server::CalcDuration method to convert
+ * durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used
+ * to indicate who or what sent the data, usually this is the nickname of a person, or a server
+ * name.
+ */
+ virtual void AddQLine(long duration, std::string source, std::string reason, std::string nickname);
+
+ /** Adds a Z-line
+ * The Z-line is propogated to all of the servers in the mesh and enforced as soon as it is added.
+ * The duration must be in seconds, however you can use the Server::CalcDuration method to convert
+ * durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used
+ * to indicate who or what sent the data, usually this is the nickname of a person, or a server
+ * name.
+ */
+ virtual void AddZLine(long duration, std::string source, std::string reason, std::string ipaddr);
+
+ /** Adds a K-line
+ * The K-line is enforced as soon as it is added.
+ * The duration must be in seconds, however you can use the Server::CalcDuration method to convert
+ * durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used
+ * to indicate who or what sent the data, usually this is the nickname of a person, or a server
+ * name.
+ */
+ virtual void AddKLine(long duration, std::string source, std::string reason, std::string hostmask);
+
+ /** Adds a E-line
+ * The E-line is enforced as soon as it is added.
+ * The duration must be in seconds, however you can use the Server::CalcDuration method to convert
+ * durations into the 1w2d3h3m6s format used by /GLINE etc. The source is an arbitary string used
+ * to indicate who or what sent the data, usually this is the nickname of a person, or a server
+ * name.
+ */
+ virtual void AddELine(long duration, std::string source, std::string reason, std::string hostmask);
+
+ /** Deletes a G-Line from all servers on the mesh
+ */
+ virtual bool DelGLine(std::string hostmask);
+
+ /** Deletes a Q-Line from all servers on the mesh
+ */
+ virtual bool DelQLine(std::string nickname);
+
+ /** Deletes a Z-Line from all servers on the mesh
+ */
+ virtual bool DelZLine(std::string ipaddr);
+
+ /** Deletes a local K-Line
+ */
+ virtual bool DelKLine(std::string hostmask);
+
+ /** Deletes a local E-Line
+ */
+ virtual bool DelELine(std::string hostmask);
+
+ /** Calculates a duration
+ * This method will take a string containing a formatted duration (e.g. "1w2d") and return its value
+ * as a total number of seconds. This is the same function used internally by /GLINE etc to set
+ * the ban times.
+ */
+ virtual long CalcDuration(std::string duration);
+
};
#define CONF_NOT_A_NUMBER 0x000010
diff --git a/include/xline.h b/include/xline.h
index b5163ee58..5381d525a 100644
--- a/include/xline.h
+++ b/include/xline.h
@@ -120,17 +120,17 @@ class QLine : public XLine
void read_xline_defaults();
-void add_gline(long duration, char* source, char* reason, char* hostmask);
-void add_qline(long duration, char* source, char* reason, char* nickname);
-void add_zline(long duration, char* source, char* reason, char* ipaddr);
-void add_kline(long duration, char* source, char* reason, char* hostmask);
-void add_eline(long duration, char* source, char* reason, char* hostmask);
-
-bool del_gline(char* hostmask);
-bool del_qline(char* nickname);
-bool del_zline(char* ipaddr);
-bool del_kline(char* hostmask);
-bool del_eline(char* hostmask);
+void add_gline(long duration, const char* source, const char* reason, const char* hostmask);
+void add_qline(long duration, const char* source, const char* reason, const char* nickname);
+void add_zline(long duration, const char* source, const char* reason, const char* ipaddr);
+void add_kline(long duration, const char* source, const char* reason, const char* hostmask);
+void 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);
@@ -151,8 +151,8 @@ void gline_set_creation_time(char* host, time_t create_time);
void qline_set_creation_time(char* nick, time_t create_time);
void zline_set_creation_time(char* ip, time_t create_time);
-bool zline_make_global(char* ipaddr);
-bool qline_make_global(char* nickname);
+bool zline_make_global(const char* ipaddr);
+bool qline_make_global(const char* nickname);
void sync_xlines(serverrec* serv, char* tcp_host);