wiki:Filters

[Much of this documentation is cloned from doc/advanced.txt in the owl repository]

BarnOwl supports an expressive filter language that can be used to describe sets of messages. This language is used both for coloring messages and for selectively viewing subsets of your messages.

The following command will create a filter called 'mail' that maches any messages sent to the zephyr class 'mail':

filter mail class ^mail$

The first argument after the filter command specifies the name of the filter to be created. The text after that indicates that matching messages must have the zephyr class "mail". For help understanding the ^ and $ characters, consult a reference on POSIX regular expressions, such as man 7 regex or an online version. Note that all pattern matching in Barnowl is case-insensitive.

The message fields that can be used in a filter command include:

sender
message sender
recipient
message recipient
class
zephyr class name
instance
zephyr instance name
opcode
zephyr opcode
realm
zephyr realm
body
message body
type
message type ('zephyr', 'aim', 'admin', ...)
direction
either 'in' 'out' or 'none'\n"
login
either 'login' 'logout' or 'none'\n"

The info command (bound to i by default) includes a list of “Owl Message Attributes”; Any attribute listed in this area can also be matched on by a filter.

A filter can refer to other filters using the filter command:

filter somefilt filter foo or filter bar

Would match anything in either the foo or bar filters. Recursive filters are explicitly disallowed.

You can also use the operators 'and' 'or' and 'not' as well as the values 'true' and 'false'. Parentheses can be used to group expressions, though there must be spaces present before and after all parenthesis. For example:

filter myfilt ( class ^foo$ ) or ( class ^quux$ and instance ^bar$ )

If you define a filter using a filter name that already exists, it will overwrite the existing filter. This can be a useful way to override the built-in filters.

Colors

Every filter can have a color associated with it. Messages matching the filter will then be displayed in that color if your terminal supports it. The color for a filter can be set by using the '-c' option to the filter command. For example:

filter personal -c white

This cause all messages in the 'personal' filter to be displayed in white. Colors can also be set when defining a new filter:

filter mail -c red class ^mail$

Barnowl can also set the background color of zephyr messages, independently of the color of the text. To set the background color for a filter, just use the '-b' option to the filter command. You can produce a list of the colors available to Owl with the command:

show colors

If a message matches more than one filter it will be displayed in the color specified in the last filter listed in the 'show filters' command.

Built-in special filters

all
Matches all messages
none
Matches no messages
personal
“personal” messages, messages sent privately to you.
login
Login/Logout notifications
auto
Messages generated by automated programs
out
Messages sent from you to another user
aim
AIM messages
zephyr
Zephyr messages
twitter
Twitter messages
jabber
Jabber messages
irc
IRC messages
trash
"Trash" messages
ping
Zephyr pings
reply-lockout
Messages for which the reply commands should not work

The trash filter is used for the delete trash command (bound to T). That command will mark as deleted (but not expunge) all messages in the trash filter. By default, this filter matches messages on -c mail, admin messages, pings, and login notifications.

The reply-lockout filter can be used to prevent you from accidentally replying to classes you do not want to ever send to. By default it includes class mail and class noc, both of which are used for automatic notifications but which users generally never send to themselves.

Last modified 11 years ago Last modified on Jan 19, 2013, 1:55:27 PM