Enable multiple filters
Add support for specifying multiple filters for a given event.
All filters must evaluate true to trigger the associated action.
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Change-Id: I86d3e98e5c9e23b65e2e9733c817b38d2ab59465
diff --git a/manager.cpp b/manager.cpp
index e100cd9..a5cdf89 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -183,16 +183,20 @@
const details::DbusSignal& event,
const EventInfo& info)
{
- auto& filter = *std::get<1>(event);
+ auto& filters = std::get<1>(event);
auto& actions = std::get<1>(info);
- if (filter(msg, *this))
+ for (auto& f : filters)
{
- for (auto& action : actions)
+ if (!(*f)(msg, *this))
{
- (*action)(*this);
+ return;
}
}
+ for (auto& action : actions)
+ {
+ (*action)(*this);
+ }
}
void Manager::destroyObjects(