To create new wiki account, please join us on #znc at Libera.Chat and ask admins to create a wiki account for you. You can say thanks to spambots for this inconvenience.

Snomask

From ZNC
Revision as of 19:00, 8 September 2017 by Mniip (talk | contribs) (category and external module label)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The snomask module allows filtering server notices depending on the client identifier. One of the use cases includes not receiving a stream of snotices on a mobile client.

The source code can be found on Github. For installation instructions see compiling modules, do not forget to also copy the data/ directory.

Mechanism

The module maintains a list of patterns corresponding to snomask letters. When a server notice is received, it is checked against all available patterns, and if a corresponding snomask letter is found, and if that letter is not found in the snomask associated with the current client identifier, then the notice is dropped. If the client has no identifier, or an unknown one, no notices are dropped. Notice that in order to receive particular notices, the respective snomask letter needs to also be present in your actual server-side snomask, as otherwise even ZNC itself will not receive the notices.

Arguments

This user module takes no arguments.

Read loading modules to learn more about loading modules.

Usage

The module has a webadmin interface, and everything is configurable from there. Other than that the following commands are available via *snomask:

Snomask [letters]

Display or change the set of letters whose respective snotices are allowed under the current client identifier. The syntax is similar to modes, for example -tc+oC-n will remove the cnt letters but add Co.


AddClient [identifier]

Register a given client identifier, or, if omitted, use the current client's identifier. Once this is done, all clients using this identifier will be subject to filtering.


DelClient [identifier]

Delete a client identifier. Clients with this identifier will be no longer subject to filtering.


ListClients

List client identifiers and their snomasks.


You can also edit the snomask definitions via commands, in a fashion similar to perform:

ListDefs

Display all definitions along with their ids.


AddDef <definition>

Append a definition to the list.


DelDef <id>

Delete a definition. This will also shift all subsequent ids down by one.


SwapDefs <id> <id>

Swap 2 definitions.


DefaultDefs

Restore the default definitions.

Definition Syntax

A definition consists of a snomask letter followed by a space followed by a pattern. Both the webadmin and the command interfaces allow comments beginning with #. Patterns can contain * which will match an arbitrary sequence of characters. You can also match an asterisk with \* and a backslash with \\.

For example:

x \*\*\* Notice -- Server * split from *

If we receive a server notice with, e.g, *** Notice -- Server foo.bar split from baz.qux, the above definition will route it to the letter x.