+ /** Destructor
+ */
+ ~XLineManager();
+
+ /** Split an ident and host into two separate strings.
+ * This allows for faster matching.
+ */
+ IdentHostPair IdentSplit(const std::string &ident_and_host);
+
+ /** Checks what users match E-lines and sets their ban exempt flag accordingly.
+ */
+ void CheckELines();
+
+ /** Get all lines of a certain type to an XLineLookup (std::map<std::string, XLine*>).
+ * NOTE: When this function runs any expired items are removed from the list before it
+ * is returned to the caller.
+ * @param type The type to look up
+ * @return A list of all XLines of the given type.
+ */
+ XLineLookup* GetAll(const std::string &type);
+
+ /** Remove all lines of a certain type.
+ */
+ void DelAll(const std::string &type);
+
+ /** Return all known types of line currently stored by the XLineManager.
+ * @return A vector containing all known line types currently stored in the main list.
+ */
+ std::vector<std::string> GetAllTypes();
+
+ /** Add a new XLine
+ * @param line The line to be added
+ * @param user The user adding the line or NULL for the local server
+ * @return True if the line was added successfully
+ */
+ bool AddLine(XLine* line, User* user);
+
+ /** Delete an XLine
+ * @param hostmask The xline-specific string identifying the line, e.g. "*@foo"
+ * @param type The type of xline
+ * @param reason The xline reason, if it is being removed successfully
+ * @param user The user removing the line or NULL if its the local server
+ * @param simulate If this is true, don't actually remove the line, just return
+ * @return True if the line was deleted successfully
+ */
+ bool DelLine(const char* hostmask, const std::string& type, std::string& reason, User* user, bool simulate = false);
+
+ /** Registers an xline factory.
+ * An xline factory is a class which when given a particular xline type,
+ * will generate a new XLine specialized to that type. For example if you
+ * pass the XLineFactory that handles G-lines some data it will return a
+ * pointer to a GLine, polymorphically represented as XLine. This is used where
+ * you do not know the full details of the item you wish to create, e.g. in a
+ * server protocol module like m_spanningtree, when you receive xlines from other
+ * servers.
+ * @param xlf XLineFactory pointer to register
+ */
+ bool RegisterFactory(XLineFactory* xlf);
+
+ /** Unregisters an xline factory.
+ * You must do this when your module unloads.
+ * @param xlf XLineFactory pointer to unregister
+ */
+ bool UnregisterFactory(XLineFactory* xlf);
+
+ /** Get the XLineFactory for a specific type.
+ * Returns NULL if there is no known handler for this xline type.
+ * @param type The type of XLine you require the XLineFactory for
+ */
+ XLineFactory* GetFactory(const std::string &type);
+
+ /** Check if a user matches an XLine
+ * @param type The type of line to look up
+ * @param user The user to match against (what is checked is specific to the xline type)
+ * @return The reason for the line if there is a match, or NULL if there is no match
+ */
+ XLine* MatchesLine(const std::string &type, User* user);
+
+ /** Check if a pattern matches an XLine
+ * @param type The type of line to look up
+ * @param pattern A pattern string specific to the xline type
+ * @return The matching XLine if there is a match, or NULL if there is no match
+ */
+ XLine* MatchesLine(const std::string &type, const std::string &pattern);
+
+ /** Expire a line given two iterators which identify it in the main map.
+ * @param container Iterator to the first level of entries the map
+ * @param item Iterator to the second level of entries in the map
+ * @param silent If true, doesn't send an expiry SNOTICE.
+ */
+ void ExpireLine(ContainerIter container, LookupIter item, bool silent = false);
+
+ /** Apply any new lines that are pending to be applied.
+ * This will only apply lines in the pending_lines list, to save on
+ * CPU time.
+ */
+ void ApplyLines();
+
+ /** DEPRECATED: use the `bool InvokeStats(const std::string&, Stats::Context&)` overload instead. */
+ DEPRECATED_METHOD(void InvokeStats(const std::string& type, unsigned int numeric, Stats::Context& stats));
+
+ /** Generates a /STATS response for the given X-line type.
+ * @param type The type of X-line to look up.
+ * @param context The stats context to respond with.
+ * @return True if a response was sent; otherwise, false.
+ */
+ bool InvokeStats(const std::string& type, Stats::Context& context);
+
+ /** Expire X-lines which were added by the server configuration and have been removed. */
+ void ExpireRemovedConfigLines(const std::string& type, const insp::flat_set<std::string>& configlines);
+};