From 17544d7b54b8b995ebba5fe72a80dff1709c8270 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 15 Aug 2016 17:26:01 +0200 Subject: [PATCH] Fix: ClusterEvents::NotificationSentAllUsersAPIHandler() does not set notified_users fixes #12444 --- lib/icinga/clusterevents.cpp | 11 ++++------- lib/icinga/clusterevents.hpp | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/icinga/clusterevents.cpp b/lib/icinga/clusterevents.cpp index 5f3892706..0e5c9d179 100644 --- a/lib/icinga/clusterevents.cpp +++ b/lib/icinga/clusterevents.cpp @@ -63,7 +63,7 @@ void ClusterEvents::StaticInitialize(void) Checkable::OnForceNextNotificationChanged.connect(&ClusterEvents::ForceNextNotificationChangedHandler); Checkable::OnNotificationsRequested.connect(&ClusterEvents::SendNotificationsHandler); Checkable::OnNotificationSentToUser.connect(&ClusterEvents::NotificationSentUserHandler); - Checkable::OnNotificationSentToAllUsers.connect(&ClusterEvents::NotificationSentAllUsersHandler); + Checkable::OnNotificationSentToAllUsers.connect(&ClusterEvents::NotificationSentToAllUsersHandler); Checkable::OnAcknowledgementSet.connect(&ClusterEvents::AcknowledgementSetHandler); Checkable::OnAcknowledgementCleared.connect(&ClusterEvents::AcknowledgementClearedHandler); @@ -939,7 +939,7 @@ Value ClusterEvents::NotificationSentUserAPIHandler(const MessageOrigin::Ptr& or return Empty; } -void ClusterEvents::NotificationSentAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set& users, +void ClusterEvents::NotificationSentToAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set& users, NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const MessageOrigin::Ptr& origin) { ApiListener::Ptr listener = ApiListener::GetInstance(); @@ -957,11 +957,7 @@ void ClusterEvents::NotificationSentAllUsersHandler(const Notification::Ptr& not params->Set("service", service->GetShortName()); params->Set("notification", notification->GetName()); - Array::Ptr ausers = new Array(); - BOOST_FOREACH(const User::Ptr& user, users) { - ausers->Add(user->GetName()); - } - params->Set("users", ausers); + params->Set("users", Array::FromSet(users)); params->Set("type", notificationType); params->Set("cr", Serialize(cr)); @@ -1055,6 +1051,7 @@ Value ClusterEvents::NotificationSentAllUsersAPIHandler(const MessageOrigin::Ptr notification->SetNextNotification(params->Get("next_notification")); notification->SetNotificationNumber(params->Get("notification_number")); notification->SetLastProblemNotification(params->Get("last_problem_notification")); + notification->SetNotifiedUsers(Array::FromSet(users)); Checkable::OnNotificationSentToAllUsers(notification, checkable, users, type, cr, author, text, origin); diff --git a/lib/icinga/clusterevents.hpp b/lib/icinga/clusterevents.hpp index 3b9b7c4be..8df2ab819 100644 --- a/lib/icinga/clusterevents.hpp +++ b/lib/icinga/clusterevents.hpp @@ -75,7 +75,7 @@ public: NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const String& command, const MessageOrigin::Ptr& origin); static Value NotificationSentUserAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params); - static void NotificationSentAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set& users, + static void NotificationSentToAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set& users, NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const MessageOrigin::Ptr& origin); static Value NotificationSentAllUsersAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params); }; -- 2.40.0