match: Support for both merging and replacing proplist updates.
authorTanu Kaskinen <tanu.kaskinen@digia.com>
Fri, 29 Apr 2011 10:45:29 +0000 (13:45 +0300)
committerColin Guthrie <colin@mageia.org>
Fri, 29 Apr 2011 11:37:58 +0000 (12:37 +0100)
commit2ee398fd94fd9bbfaff61d0743c945f0a3411fa8
tree1508ea6b0d1b80374fdeda31f8272628d2076cdb
parent495c1ed2361f7bab5eaa6978d2fda624a2944bb9
match: Support for both merging and replacing proplist updates.

This patch adds a new update mode specifier that can be optionally
given in match rules after the regexp. Property list updates triggered
by the rule will honour the given mode. The two allowed modes are 'merge'
and 'replace', corresponding to PA_UPDATE_MERGE and PA_UPDATE_REPLACE
respectively. If omitted, the mode defaults to PA_UPDATE_MERGE, ie. to
the original behavior.

For example, to force 'media.role' to be overwritten with 'bar' for
streams matching foo you can use an entry like this:

foo replace "bar"

This will really overwrite media.role to bar even if it has already been
set to something else by the application.

Thanks to Krisztian Litkey for the original patch and the description
above. In addition to implementing the new feature, this patch fixes
a number of bugs in the parsing code.
src/modules/module-match.c