Tip of the day: Check out Special users on how to give trusted users/bots more rights without making them IRCOp.


From UnrealIRCd documentation wiki
Jump to navigation Jump to search

Since UnrealIRCd 6.1.2 we support spamfilter::rule, security-group::rule and mask::rule. They allow you to filter in a C like if-style, eg: rule "reputation()>20";.


  • You can call functions which may have 0, 1 or more arguments. Eg reputation()
  • Supported comparison operators are: xx>yy, xx<yy and x==y
  • You can use && (AND) and || (OR) expressions to combine multiple checks
  • You can use ( and ) to group items
  • You can use ! to represent negation, eg !has_user_mode('x')


The following functions are supported:

  • online_time(): number of seconds the user is online
  • reputation(): the Reputation score of the user
  • tag('TAGNAME'): read the value of a tag set on the user with name TAGNAME. Tags are set by set in Actions (e.g. by spamfilter).
  • cap_version(): returns the CAP protocol used by the client, such as 300.
  • cap_set('capname'): returns true if the the client has requested the capname capability via CAP REQ.
  • is_away(): returns true if the client is currently away. Requires UnrealIRCd 6.1.5+
  • has_user_mode('x'): returns true if all the specified user modes are set on the client. Requires UnrealIRCd 6.1.5+
  • has_channel_mode('x'): for a spamfilter, the destination channel for a message: return true if this channel contains all the specified channel modes. Requires UnrealIRCd 6.1.5+
  • destination('#channel'): for a spamfilter, allows you to check the destination of the message (which can be a channel or a nick), wildcards are supported.
  • inchannel('#channel'): returns true if user is a member of this channel. It is IMPORTANT not to confuse this with destination() in spamfilters! Optionally channel member flags are supported, eg inchannel('@#has_ops_here'). In UnrealIRCd 6.1.6+ this is called in_channel (with the underscore), but the old name works as well.
  • is_tls(): returns true if the user is using SSL/TLS. Requires UnrealIRCd 6.1.6+
  • in_security_group('known-users'): returns true if the user is in specified Security group. Requires UnrealIRCd 6.1.6+
  • match_mask('*@*.example.org'): returns true if the user matches mask (as usual you can also use match_mask('*.example.org') if you don't care about the username/ident). Requires UnrealIRCd 6.1.6+
  • match_ip('192.168.*'): returns true if the user matches the IP address (CIDR is supported too, like match_ip(''). Requires UnrealIRCd 6.1.6+
  • match_realname('*xyz*'): returns true if the real name (gecos) contains the word 'xyz' somewhere. Requires UnrealIRCd 6.1.6+
  • match_account('xyz'): returns true if the Services account is 'xyz'. Requires UnrealIRCd 6.1.6+
  • match_country('NL'): returns true if GeoIP determined the country to be 'NL'. Requires UnrealIRCd 6.1.6+
  • match_asn(64496): returns true if GeoIP determined the Autonomous system number to be '64496'. Requires UnrealIRCd 6.1.7+
  • match_certfp('abc'): returns true if the Certificate fingerprint of the user is 'abc'. Requires UnrealIRCd 6.1.6+
  • is_identified(): returns true if the user is identified to a services account. Requires UnrealIRCd 6.1.6+
  • is_websocket(): returns true if the user is connecting via WebSocket Requires UnrealIRCd 6.1.6+
  • is_webirc(): returns true if the user is connecting via WebIRC Requires UnrealIRCd 6.1.6+


Simple comparison

This rule will match if the Reputation score of the user is more than 20:

rule "reputation()>20";


You can combine things with an AND operator and OR, and group them:

rule "!inchannel('#main') && (online_time()<180 || reputation()<50)";

This rule will match when:

  • User is not in the channel #main, AND
  • Either the online time is less than 180 seconds OR the Reputation score is less than 50