+ char* reason;
+
+ /** Expiry time. Does not contain useful data if the duration is 0.
+ */
+ time_t expiry;
+
+ /** "Q", "K", etc. Set only by derived classes constructor to the
+ * type of line this is.
+ */
+ const std::string type;
+
+ virtual bool IsBurstable();
+};
+
+/** KLine class
+ */
+class CoreExport KLine : public XLine
+{
+ public:
+
+ /** Create a K-Line.
+ * @param s_time The set time
+ * @param d The duration of the xline
+ * @param src The sender of the xline
+ * @param re The reason of the xline
+ * @param ident Ident to match
+ * @param host Host to match
+ */
+ KLine(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char* ident, const char* host) : XLine(Instance, s_time, d, src, re, "K")
+ {
+ identmask = strdup(ident);
+ hostmask = strdup(host);
+ matchtext = this->identmask;
+ matchtext.append("@").append(this->hostmask);
+ }
+
+ /** Destructor
+ */
+ ~KLine()
+ {
+ free(identmask);
+ free(hostmask);
+ }
+
+ virtual bool Matches(User *u);
+
+ virtual bool Matches(const std::string &str);
+
+ virtual void Apply(User* u);
+
+ virtual void DisplayExpiry();
+
+ virtual const char* Displayable();
+
+ virtual bool IsBurstable();
+
+ /** Ident mask (ident part only)
+ */
+ char* identmask;
+ /** Host mask (host part only)
+ */
+ char* hostmask;
+
+ std::string matchtext;
+};
+
+/** GLine class
+ */
+class CoreExport GLine : public XLine
+{
+ public:
+ /** Create a G-Line.
+ * @param s_time The set time
+ * @param d The duration of the xline
+ * @param src The sender of the xline
+ * @param re The reason of the xline
+ * @param ident Ident to match
+ * @param host Host to match
+ */
+ GLine(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char* ident, const char* host) : XLine(Instance, s_time, d, src, re, "G")
+ {
+ identmask = strdup(ident);
+ hostmask = strdup(host);
+ matchtext = this->identmask;
+ matchtext.append("@").append(this->hostmask);
+ }
+
+ /** Destructor
+ */
+ ~GLine()
+ {
+ free(identmask);
+ free(hostmask);
+ }
+
+ virtual bool Matches(User *u);
+
+ virtual bool Matches(const std::string &str);
+
+ virtual void Apply(User* u);
+
+ virtual void DisplayExpiry();
+
+ virtual const char* Displayable();
+
+ /** Ident mask (ident part only)
+ */
+ char* identmask;
+ /** Host mask (host part only)
+ */
+ char* hostmask;
+
+ std::string matchtext;
+};
+
+/** ELine class
+ */
+class CoreExport ELine : public XLine
+{
+ public:
+ /** Create an E-Line.
+ * @param s_time The set time
+ * @param d The duration of the xline
+ * @param src The sender of the xline
+ * @param re The reason of the xline
+ * @param ident Ident to match
+ * @param host Host to match
+ */
+ ELine(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char* ident, const char* host) : XLine(Instance, s_time, d, src, re, "E")
+ {
+ identmask = strdup(ident);
+ hostmask = strdup(host);
+ matchtext = this->identmask;
+ matchtext.append("@").append(this->hostmask);
+ }
+
+ ~ELine()
+ {
+ free(identmask);
+ free(hostmask);
+ }
+
+ virtual bool Matches(User *u);
+
+ virtual bool Matches(const std::string &str);
+
+ virtual void Unset();
+
+ virtual void DisplayExpiry();
+
+ virtual void OnAdd();
+
+ virtual const char* Displayable();
+
+ /** Ident mask (ident part only)
+ */
+ char* identmask;
+ /** Host mask (host part only)
+ */
+ char* hostmask;
+
+ std::string matchtext;
+};
+
+/** ZLine class
+ */
+class CoreExport ZLine : public XLine
+{
+ public:
+ /** Create a Z-Line.
+ * @param s_time The set time
+ * @param d The duration of the xline
+ * @param src The sender of the xline
+ * @param re The reason of the xline
+ * @param ip IP to match
+ */
+ ZLine(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char* ip) : XLine(Instance, s_time, d, src, re, "Z")
+ {
+ ipaddr = strdup(ip);
+ }
+
+ /** Destructor
+ */
+ ~ZLine()
+ {
+ free(ipaddr);
+ }
+
+ virtual bool Matches(User *u);
+
+ virtual bool Matches(const std::string &str);
+
+ virtual void Apply(User* u);
+
+ virtual void DisplayExpiry();
+
+ virtual const char* Displayable();
+
+ /** IP mask (no ident part)
+ */
+ char* ipaddr;
+};
+
+/** QLine class
+ */
+class CoreExport QLine : public XLine
+{
+ public:
+ /** Create a G-Line.
+ * @param s_time The set time
+ * @param d The duration of the xline
+ * @param src The sender of the xline
+ * @param re The reason of the xline
+ * @param nickname Nickname to match
+ */
+ QLine(InspIRCd* Instance, time_t s_time, long d, const char* src, const char* re, const char* nickname) : XLine(Instance, s_time, d, src, re, "Q")
+ {
+ nick = strdup(nickname);
+ }
+
+ /** Destructor
+ */
+ ~QLine()
+ {
+ free(nick);
+
+ }
+ virtual bool Matches(User *u);
+
+ virtual bool Matches(const std::string &str);
+
+ virtual void Apply(User* u);
+
+ virtual void DisplayExpiry();
+
+ virtual const char* Displayable();
+
+ /** Nickname mask
+ */
+ char* 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
+ * to create a new XLine when it is inbound on a server link, so that it
+ * 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
+{
+ protected:
+
+ InspIRCd* ServerInstance;
+ std::string type;
+
+ public:
+
+ /** Create an XLine factory
+ * @param Instance creator
+ * @param t Type of XLine this factory generates