| Tip of the day: The antirandom module can be a useful tool to block clients with random looking nicks. |
JSON-RPC:Spamfilter
JSON Methods
- rpc:
set_issuer,info,add_timer,del_timer - stats:
get - log:
send,list,subscribe,unsubscribe - user:
list,get,set_nick,set_username,set_realname,set_vhost,set_mode,set_snomask,set_oper - whowas:
get - server:
list,get,rehash,connect,disconnect - channel:
list,get,set_mode,set_topic,kick - server_ban:
list,get,add,del - server_ban_exception:
list,get,add,del - spamfilter:
list,get,add,del - name_ban:
list,get,add,del
JSON Basics
The spamfilter.* JSON RPC calls can add, remove and list spamfilters.
Structure of a spamfilter
The following object is used in both request and responses. This is a server ban, such as a GLINE or Spamfilter. It is also used for ban exceptions (ELINE).
| Variable | Description | Example value |
|---|---|---|
| type | Type of the server ban. One of: gline, kline, gzline, zline, spamfilter, qline, except, shun, local-qline, local-exception, local-spamfilter. |
gline
|
| type_string | Type of the server ban in a more friendly user printable string. Possibly prefixed with "Soft" eg "Soft G-Line". |
G-Line
|
| name | The target of the ban or except. For Spamfilter this is the regex/matcher. | *@*.badisp.example.net
|
| set_by | Name of the person or server who set the ban | Syzop
|
| set_at | Date/Time when the server ban was added | 2022-05-23T11:02:06.000Z
|
| set_at_string | Date/Time when the server ban was added in a more human printable string. | Mon May 23 11:02:06 2022
|
| expire_at | Date/Time when the server ban will expire. NULL means: never. | 2023-05-23T10:00:00.000Z
|
| expire_at_string | Date/Time when the server ban will expire in a more human printable string. Uses "Never" for never. |
Tue May 23 10:00:00 2023
|
| duration_string | How long the ban will last from this point in time (human printable). Uses "permanent" for forever. |
permanent
|
| set_at_delta | How many seconds ago the ban was placed. | 1800
|
| reason | The reason of the ban | Lots of abuse from this ISP
|
| exception_types | Only for ban exceptions! Specifies the exception types (letters). See HELPOP ELINE for a list of those letters.
|
kGzZsF
|
| match_type | Only for spamfilters! The matching type. One of: simple, regex | regex
|
| ban_action | Only for spamfilters! The action to take on spamfilter hit. | gline
|
| spamfilter_targets | Only for spamfilters! Which targets the spamfilter must filter on. | cpnN
|
NOTE: Only spamfilters are changed through the spamfilter* API. For server bans, see server_ban.*.
API Calls
spamfilter.list
List spamfilters.
Request arguments
No mandatory arguments
Example
{"jsonrpc": "2.0", "method": "spamfilter.list", "params": {}, "id": 123}
spamfilter.get
Retrieve all details of a single spamfilter.
Request arguments
Mandatory arguments (see structure of a spamfilter for an explanation of the fields):
- name
- match_type
- spamfilter_targets
- ban_action
Example
{"jsonrpc": "2.0", "method": "spamfilter.get", "params": {"name":"regex123","match_type": "regex","ban_action": "gline","spamfilter_targets": "cpnNPq"}, "id": 123}
spamfilter.add
Add a spamfilter.
Request arguments
Mandatory arguments (see structure of a spamfilter for an explanation of the fields):
- name
- match_type
- spamfilter_targets
- ban_action
- reason
- ban_duration
Optional arguments:
- set_by: who set the entry
Example request
{"jsonrpc": "2.0", "method": "spamfilter.add", "params": {"name":"regex123","match_type": "regex","ban_action": "gline","ban_duration": 30,"spamfilter_targets": "cpnNPq","reason": "RPC test"}, "id": 123}
spamfilter.del
Delete a spamfilter.
Request arguments
Mandatory arguments (see structure of a spamfilter for an explanation of the fields):
- name
- match_type
- spamfilter_targets
- ban_action
Optional arguments:
- set_by: who unset the entry
Example
{"jsonrpc": "2.0", "method": "spamfilter.del", "params": {"name":"regex123","match_type": "regex","ban_action": "gline","spamfilter_targets": "cpnNPq"}, "id": 123}