From af951819bc8834b7340aa1e9a46af670a7bc18d8 Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 19 May 2014 18:17:47 +0200 Subject: [PATCH] Add MessageOrigin to OnVarsChanged. Refs #6187 Refs #5219 --- lib/base/dynamicobject.h | 3 +-- lib/icinga/checkable.cpp | 2 +- lib/icinga/command.cpp | 2 +- lib/icinga/customvarobject.cpp | 8 ++++---- lib/icinga/customvarobject.h | 11 +++++------ lib/icinga/user.cpp | 2 +- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/lib/base/dynamicobject.h b/lib/base/dynamicobject.h index 022a6a5f6..a57518208 100644 --- a/lib/base/dynamicobject.h +++ b/lib/base/dynamicobject.h @@ -34,8 +34,7 @@ namespace icinga class DynamicType; /** - * A dynamic object that can be instantiated from the configuration file - * and that supports attribute replication to remote application instances. + * A dynamic object that can be instantiated from the configuration file. * * @ingroup base */ diff --git a/lib/icinga/checkable.cpp b/lib/icinga/checkable.cpp index 5b1e5e94f..f53f16553 100644 --- a/lib/icinga/checkable.cpp +++ b/lib/icinga/checkable.cpp @@ -255,6 +255,6 @@ void Checkable::SetModifiedAttributes(int flags, const MessageOrigin& origin) if ((flags & ModAttrCustomVariable) == 0) { SetOverrideVars(Empty); - OnVarsChanged(GetSelf()); + OnVarsChanged(GetSelf(), origin); } } diff --git a/lib/icinga/command.cpp b/lib/icinga/command.cpp index a9f92701a..e408dc0f2 100644 --- a/lib/icinga/command.cpp +++ b/lib/icinga/command.cpp @@ -37,6 +37,6 @@ void Command::SetModifiedAttributes(int flags, const MessageOrigin& origin) { if ((flags & ModAttrCustomVariable) == 0) { SetOverrideVars(Empty); - OnVarsChanged(GetSelf()); + OnVarsChanged(GetSelf(), origin); } } diff --git a/lib/icinga/customvarobject.cpp b/lib/icinga/customvarobject.cpp index 8e718ddd1..4b1449b12 100644 --- a/lib/icinga/customvarobject.cpp +++ b/lib/icinga/customvarobject.cpp @@ -24,7 +24,7 @@ using namespace icinga; REGISTER_TYPE(CustomVarObject); -boost::signals2::signal CustomVarObject::OnVarsChanged; +boost::signals2::signal CustomVarObject::OnVarsChanged; Dictionary::Ptr CustomVarObject::GetVars(void) const { @@ -34,13 +34,13 @@ Dictionary::Ptr CustomVarObject::GetVars(void) const return GetVarsRaw(); } -void CustomVarObject::SetVars(const Dictionary::Ptr& vars) +void CustomVarObject::SetVars(const Dictionary::Ptr& vars, const MessageOrigin& origin) { SetOverrideVars(vars); Log(LogDebug, "icinga", "Setting vars for object '" + GetName() + "'"); - OnVarsChanged(GetSelf()); + OnVarsChanged(GetSelf(), origin); } int CustomVarObject::GetModifiedAttributes(void) const @@ -54,7 +54,7 @@ void CustomVarObject::SetModifiedAttributes(int, const MessageOrigin&) /* does nothing by default */ } -bool CustomVarObject::IsVarOverridden(const String& name) +bool CustomVarObject::IsVarOverridden(const String& name) const { Dictionary::Ptr vars_override = GetOverrideVars(); diff --git a/lib/icinga/customvarobject.h b/lib/icinga/customvarobject.h index 25894073c..b472aa521 100644 --- a/lib/icinga/customvarobject.h +++ b/lib/icinga/customvarobject.h @@ -49,25 +49,24 @@ enum ModifiedAttributeType }; /** - * A dynamic object that can be instantiated from the configuration file - * and that supports attribute replication to remote application instances. + * An object with custom variable attribute. * - * @ingroup base + * @ingroup icinga */ class I2_BASE_API CustomVarObject : public ObjectImpl { public: DECLARE_PTR_TYPEDEFS(CustomVarObject); - static boost::signals2::signal OnVarsChanged; + static boost::signals2::signal OnVarsChanged; Dictionary::Ptr GetVars(void) const; - void SetVars(const Dictionary::Ptr& vars); + void SetVars(const Dictionary::Ptr& vars, const MessageOrigin& origin = MessageOrigin()); virtual int GetModifiedAttributes(void) const; virtual void SetModifiedAttributes(int flags, const MessageOrigin& origin = MessageOrigin()); - bool IsVarOverridden(const String& name); + bool IsVarOverridden(const String& name) const; }; } diff --git a/lib/icinga/user.cpp b/lib/icinga/user.cpp index adf19c277..5a96faae9 100644 --- a/lib/icinga/user.cpp +++ b/lib/icinga/user.cpp @@ -121,6 +121,6 @@ void User::SetModifiedAttributes(int flags, const MessageOrigin& origin) { if ((flags & ModAttrCustomVariable) == 0) { SetOverrideVars(Empty); - OnVarsChanged(GetSelf()); + OnVarsChanged(GetSelf(), origin); } } -- 2.40.0