From the makers of InspIRCd.
(Redirected from Modules/filter)
Jump to: navigation, search

filter module (2.0 version)

Current Future
2.0 Documentation 3.0 Documentation
Return to the 2.0 Module List
Allows filtering of text from private and channel messages and notices, part messages and quit messages, for abuse prevention and realtime blocking of viruses and worms.
Configuration Tags
To use this module you should add the following tags to your Configuration file:
<filteropts engine="glob">
<include file="filter.conf">
  • <filteropts:engine> - This variable is to define what matching engine filter will use. The available options are:
  1. glob - wildcard matching with glob patterns (* and ?)
  2. pcre - regular expression matching with the perl compatible regular expression engine. Requires libpcre.
  3. posix - regular expression matching with the posix regular expression engine. This regex engine does not work on Windows, but has no additional dependencies on other operating systems.
  4. tre - regular expression matching with the tre regular expression engine. This is the same regular expression engine UnrealIRCd uses so you may want to use it if you're used to that. Requires libtre.

You should then create a filter.conf file, which contains filter entries. The filter.conf is a standard styled config file, containing tags formatted like the one below:

<keyword pattern="*qwerty*" reason="You qwertied!" action="gline" duration="1h6s" flags="pn">

The patterns used are standard glob patterns which match against any PRIVMSG, PART, QUIT or NOTICE command. The action variable can be one of three values:

  • kill - Disconnects the user if they match the pattern, giving the value of 'reason' as the quit reason. When the 'kill' action is matched in a QUIT message, this acts identically to 'block', as there is little point in sending a KILL for a user who is quitting anyway.
  • block - Blocks the whole line and informs all opers with +s that the line was blocked, and who sent it, along with the reason text. In the case of PART and QUIT messages, a reason matching a block is replaced with 'Reason filtered', as it is not possible to block the whole line without desynching clients.
  • none - Do nothing except log the match. This is the default if the action variable is omitted from the tag.
  • gline - Set a gline on the user's IP address, lasting for 'duration' minutes, or permenant if the duration is omitted from the tag.
  • silent - This blocks the line only, and informs the user their message was blocked, but does not notify opers.

See below for a definition of valid flags for the flags field.

NOTE: You don't have to seperate out your filter definitions into a seperate file like this, although it keeps things tidy and is still recommended.

This module does not implement any extra user or channel modes.
Extended Bans (Extbans)
This module implements no extended bans.
/FILTER <filter-definition> [<action> <flags> [<gline-duration>] :<reason>]

This command will add a filter when more than one parameter is given, using the specified filter definition, action, gline duration (when the action is 'gline') and reason. When only one parameter is provided (the filter pattern) the provided filter will be removed. Note that if you remove a configuration-defined filter, it will re-appear at next rehash unless it is also removed from the config file.


The flags field is used to indicate what the filter affects:

  • p - Block private and channel messages
  • n - Block private and channel notices
  • P - Block part messages
  • q - Block quit messages
  • o - Don't match against opers
  • * - Represents all of the above flags
  • - - Does nothing, a non-op for when you do not want to specify any flags

Listing Filters

The following command will generate a list of all filters set on the server specified(optional)

/stats s [servername]
Special Notes
Please note that while glob patterns are faster to match than regular expressions (such a those used in unrealircd, etc) a large number of them can still impede performance (e.g. a hundred or more), and the more users you have, the less patterns you will be able to have without crippling your irc server. Filtering is always done locally, so if you have over 2000 users per server, consider other alternatives where possible.

The regex_glob or the regex_pcre or the regex_posix or the regex_tre modules.