conf: implement match rules with conf_section_for_each

This commit is contained in:
Wim Taymans 2022-02-01 16:35:16 +01:00
parent 0ac87a14cd
commit 432f464297
2 changed files with 26 additions and 15 deletions

View file

@ -170,15 +170,19 @@ static int client_rule_matched(void *data, const char *action, const char *val,
return 0;
}
static int apply_pulse_rules(void *data, const char *location, const char *section,
const char *str, size_t len)
{
struct client *client = data;
pw_conf_match_rules(str, len, &client->props->dict,
client_rule_matched, client);
return 0;
}
int client_update_quirks(struct client *client)
{
struct impl *impl = client->impl;
struct pw_context *context = impl->context;
const char *rules;
if ((rules = pw_context_get_conf_section(context, "pulse.rules")) == NULL)
return 0;
return pw_conf_match_rules(rules, strlen(rules), &client->props->dict,
client_rule_matched, client);
return pw_context_conf_section_for_each(context, "pulse.rules",
apply_pulse_rules, client);
}