Add possibility to create filters for the blacklist

Registered by Jonas Erlandsson

Use case 1: User uses several applications that produce messages via notify-send and wants to block only some of them.
Use case 2: User wants to only get some messages logged from pidgin, like new chats, but not others, like sign on/off.

Implementing the possibility to filter on sending app (like now) and parts of the message.
Since libnotify has title, icon and message fields (at least), filters for these fields would be a natural starting point.
Something like regexp would probably be a good idea as a filter language.

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
None
Direction:
Needs approval
Assignee:
None
Definition:
Discussion
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

Currently, the blacklist is just a dictionary of app_names and messages are discarded if their app_name is in the dictionary. Filters wouldn't be difficult to implement, an additional message filter class could be defined, and the notification monitor could just iterate through the filters when a message is received, and discard any matches.

Two important problems to solve, how should the filters be defined and stored, and how should they integrate with the GUI? As for the first problem, more than just regexp would be needed, since for your use cases, you need to match on app_name AND text in the body. My initial thought is to use a separate config file for each filter and store them in ~/.config/recent-notification/filters/ in a format such as:

app_name = Pidgin
body = some_regexp_here
...

This would allow for expressions such as app_name AND summary AND body AND icon_name ..., although it wouldn't immediately allow OR boolean expressions, however each new message filter would basically be an OR, so it may work for
most of the useful cases.

If you or anyone else wants to code something up, I'll see about integrating it. Otherwise I'll look into it when I get a chance.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.