Dunst
Lightweight notification daemon
Loading...
Searching...
No Matches
rules.h File Reference

Rules managment and helpers. More...

#include <glib.h>
#include <stdbool.h>
#include "notification.h"
#include "settings.h"
+ Include dependency graph for rules.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rule
 

Functions

struct rulerule_new (const char *name)
 Allocate a new rule with given name.
 
void rule_free (struct rule *r)
 
void rule_print (const struct rule *r)
 
void rule_apply (struct rule *r, struct notification *n, bool save)
 
void rule_apply_all (struct notification *n)
 
bool rule_matches_notification (struct rule *r, struct notification *n)
 
struct ruleget_rule (const char *name)
 Get rule with this name from rules.
 
bool rule_offset_is_modifying (const size_t offset)
 Check if a rule is an action.
 
bool rule_offset_is_filter (const size_t offset)
 Check if a rule is an filter.
 

Variables

GSList * rules
 

Detailed Description

Rules managment and helpers.

License
BSD-3-Clause

Definition in file rules.h.

Function Documentation

◆ get_rule()

struct rule * get_rule ( const char * name)

Get rule with this name from rules.

Returns
the rule that matches. Null if no rule matches

Get rule with this name from rules.

Definition at line 336 of file rules.c.

◆ rule_apply()

void rule_apply ( struct rule * r,
struct notification * n,
bool save )

Definition at line 38 of file rules.c.

◆ rule_apply_all()

void rule_apply_all ( struct notification * n)

Definition at line 203 of file rules.c.

◆ rule_free()

void rule_free ( struct rule * r)

Definition at line 252 of file rules.c.

◆ rule_matches_notification()

bool rule_matches_notification ( struct rule * r,
struct notification * n )

Definition at line 318 of file rules.c.

◆ rule_new()

struct rule * rule_new ( const char * name)

Allocate a new rule with given name.

The rule is fully initialised. If the name is one of a special section (see settings_data.h), the rule is initialized with some filters, and you should not add any filters after that.

Parameters
nameName of the rule.
Returns
A new initialised rule.

Definition at line 237 of file rules.c.

◆ rule_offset_is_filter()

bool rule_offset_is_filter ( const size_t offset)

Check if a rule is an filter.

Returns
a boolean if the rule is an filter

Check if a rule is an filter.

Definition at line 357 of file rules.c.

◆ rule_offset_is_modifying()

bool rule_offset_is_modifying ( const size_t offset)

Check if a rule is an action.

Returns
a boolean if the rule is an action

Check if a rule is an action.

Definition at line 348 of file rules.c.

◆ rule_print()

void rule_print ( const struct rule * r)

Definition at line 144 of file rules.c.

Variable Documentation

◆ rules

GSList* rules
extern

Definition at line 21 of file rules.c.