+ protected:
+
+ /** Default 'apply' action. Quits the user.
+ * @param u User to apply the line against
+ * @param line The line typed, used for display purposes in the quit message
+ * @param bancache If true, the user will be added to the bancache if they match. Else not.
+ */
+ void DefaultApply(User* u, const std::string &line, bool bancache);
+
+ public:
+
+ /** Create an XLine.
+ * @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 t The line type, should be set by the derived class constructor
+ */
+ XLine(time_t s_time, long d, std::string src, std::string re, const std::string &t)
+ : set_time(s_time), duration(d), source(src), reason(re), type(t)
+ {
+ expiry = set_time + duration;
+ }
+
+ /** Destructor
+ */
+ virtual ~XLine()
+ {
+ }
+
+ /** Change creation time of an xline. Updates expiry
+ * to be after the creation time
+ */
+ virtual void SetCreateTime(time_t created)
+ {
+ set_time = created;
+ expiry = created + duration;
+ }
+
+ /** Returns true whether or not the given user is covered by this line.
+ * @param u The user to match against. The mechanics of the match
+ * are defined by the derived class.
+ * @return True if there is a match.
+ */
+ virtual bool Matches(User *u) = 0;
+
+ /** Returns true whether or not the given string is covered by this line.
+ * @param str The string to match against. The details of what must be
+ * in this string and the mechanics of the match are defined by the
+ * derived class.
+ * @return True if there is a match
+ */
+ virtual bool Matches(const std::string &str) = 0;
+
+ /** Apply a line against a user. The mechanics of what occurs when
+ * the line is applied are specific to the derived class.
+ * @param u The user to apply against
+ */
+ virtual void Apply(User* u);
+
+ /** Called when the line is unset either via expiry or
+ * via explicit removal.
+ */
+ virtual void Unset() { }
+
+ /** Called when the expiry message is to be displayed for the
+ * line. Usually a line in the form 'expiring Xline blah, set by...'
+ * see the DisplayExpiry methods of GLine, ELine etc.
+ */
+ virtual void DisplayExpiry() = 0;
+
+ /** Returns the displayable form of the pattern for this xline,
+ * e.g. '*@foo' or '*baz*'. This must always return the full pattern
+ * in a form which can be used to construct an entire derived xline,
+ * even if it is stored differently internally (e.g. GLine stores the
+ * ident and host parts seperately but will still return ident@host
+ * for its Displayable() method)
+ */
+ virtual const char* Displayable() = 0;
+
+ /** Called when the xline has just been added.
+ */
+ virtual void OnAdd() { }