static void roar_configure(struct roar * self, const struct config_param *param) { self->host = config_dup_block_string(param, "server", NULL); self->name = config_dup_block_string(param, "name", "MPD"); char *role = config_dup_block_string(param, "role", "music"); if (role != NULL) { self->role = roar_str2role(role); g_free(role); } else self->role = ROAR_ROLE_MUSIC; }
static int _set_role(void) { int roleid = ROAR_ROLE_UNKNOWN; if (role == NULL) return 0; roleid = roar_str2role(role); if (roleid == ROAR_ROLE_UNKNOWN) { // TODO: warn if role is invalid. return 0; } if (roar_vs_role(vss, roleid, &err) == -1) { return -OP_ERROR_ERRNO; } return 0; }