Dunst
Lightweight notification daemon
Loading...
Searching...
No Matches
rules.c File Reference
#include "rules.h"
#include <fnmatch.h>
#include <glib.h>
#include <stddef.h>
#include <regex.h>
#include "dunst.h"
#include "utils.h"
#include "settings_data.h"
#include "log.h"
+ Include dependency graph for rules.c:

Go to the source code of this file.

Macros

#define RULE_APPLY2(nprop, rprop, defval)
 
#define RULE_APPLY(prop, defval)
 

Functions

void rule_apply (struct rule *r, struct notification *n, bool save)
 
void rule_print (const struct rule *r)
 
void rule_apply_all (struct notification *n)
 
bool rule_apply_special_filters (struct rule *r, const char *name)
 
struct rulerule_new (const char *name)
 Allocate a new rule with given name.
 
void rule_free (struct rule *r)
 
static bool rule_field_matches_string (const char *value, const char *pattern)
 
bool rule_matches_notification (struct rule *r, struct notification *n)
 
struct ruleget_rule (const char *name)
 Check if a rule exists with that name.
 
bool rule_offset_is_modifying (const size_t offset)
 see rules.h
 
bool rule_offset_is_filter (const size_t offset)
 see rules.h
 

Variables

GSList * rules = NULL
 

Detailed Description

License
BSD-3-Clause

Definition in file rules.c.

Macro Definition Documentation

◆ RULE_APPLY

#define RULE_APPLY ( prop,
defval )
Value:
RULE_APPLY2(prop, prop, defval)

Definition at line 32 of file rules.c.

◆ RULE_APPLY2

#define RULE_APPLY2 ( nprop,
rprop,
defval )
Value:
if (r->rprop != (defval)) { \
if (save && n->original->rprop == (defval)) \
n->original->rprop = n->nprop; \
n->nprop = r->rprop; \
}

Definition at line 25 of file rules.c.

Function Documentation

◆ get_rule()

struct rule * get_rule ( const char * name)

Check if a rule exists with that name.

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_apply_special_filters()

bool rule_apply_special_filters ( struct rule * r,
const char * name )

Definition at line 213 of file rules.c.

◆ rule_field_matches_string()

static bool rule_field_matches_string ( const char * value,
const char * pattern )
inlinestatic

Definition at line 280 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)

see rules.h

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)

see rules.h

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 = NULL

Definition at line 21 of file rules.c.