Fix default values for notification filters.

Refs #5979
This commit is contained in:
Gunnar Beutner 2014-04-08 23:33:25 +02:00
parent ba2309338e
commit dcf7d07c7a
2 changed files with 9 additions and 17 deletions

View File

@ -78,8 +78,8 @@ void Notification::StaticInitialize(void)
void Notification::OnConfigLoaded(void) void Notification::OnConfigLoaded(void)
{ {
SetNotificationTypeFilter(FilterArrayToInt(GetNotificationTypeFilterRaw(), 0)); SetNotificationTypeFilter(FilterArrayToInt(GetNotificationTypeFilterRaw(), ~0));
SetNotificationStateFilter(FilterArrayToInt(GetNotificationStateFilterRaw(), 0)); SetNotificationStateFilter(FilterArrayToInt(GetNotificationStateFilterRaw(), ~0));
GetCheckable()->AddNotification(GetSelf()); GetCheckable()->AddNotification(GetSelf());
} }
@ -252,13 +252,9 @@ void Notification::BeginExecuteNotification(NotificationType type, const CheckRe
return; return;
} }
Service::Ptr service = dynamic_pointer_cast<Service>(checkable);
Host::Ptr host; Host::Ptr host;
Service::Ptr service;
if (service) tie(host, service) = GetHostService(checkable);
host = service->GetHost();
else
host = static_pointer_cast<Host>(checkable);
unsigned long fstate; unsigned long fstate;
@ -333,13 +329,9 @@ bool Notification::CheckNotificationUserFilters(NotificationType type, const Use
} }
Checkable::Ptr checkable = GetCheckable(); Checkable::Ptr checkable = GetCheckable();
Service::Ptr service = dynamic_pointer_cast<Service>(checkable);
Host::Ptr host; Host::Ptr host;
Service::Ptr service;
if (service) tie(host, service) = GetHostService(checkable);
host = service->GetHost();
else
host = static_pointer_cast<Host>(checkable);
unsigned long fstate; unsigned long fstate;
@ -422,7 +414,7 @@ int icinga::FilterArrayToInt(const Array::Ptr& typeFilters, int defaultValue)
{ {
Value resultTypeFilter; Value resultTypeFilter;
if (!typeFilters || typeFilters->GetLength() == 0) if (!typeFilters)
return defaultValue; return defaultValue;
resultTypeFilter = 0; resultTypeFilter = 0;

View File

@ -33,8 +33,8 @@ REGISTER_SCRIPTFUNCTION(ValidateUserFilters, &User::ValidateFilters);
void User::OnConfigLoaded(void) void User::OnConfigLoaded(void)
{ {
SetNotificationTypeFilter(FilterArrayToInt(GetNotificationTypeFilterRaw(), 0)); SetNotificationTypeFilter(FilterArrayToInt(GetNotificationTypeFilterRaw(), ~0));
SetNotificationStateFilter(FilterArrayToInt(GetNotificationStateFilterRaw(), 0)); SetNotificationStateFilter(FilterArrayToInt(GetNotificationStateFilterRaw(), ~0));
Array::Ptr groups = GetGroups(); Array::Ptr groups = GetGroups();