diff --git a/lib/base/scriptfunction.cpp b/lib/base/scriptfunction.cpp index dff3903c1..3a8f5fafa 100644 --- a/lib/base/scriptfunction.cpp +++ b/lib/base/scriptfunction.cpp @@ -21,6 +21,9 @@ using namespace icinga; +boost::signal ScriptFunction::OnRegistered; +boost::signal ScriptFunction::OnUnregistered; + ScriptFunction::ScriptFunction(const Callback& function) : m_Callback(function) { } @@ -28,11 +31,13 @@ ScriptFunction::ScriptFunction(const Callback& function) void ScriptFunction::Register(const String& name, const ScriptFunction::Ptr& function) { GetFunctions()[name] = function; + Application::GetEQ().Post(boost::bind(boost::ref(OnRegistered), name, function)); } void ScriptFunction::Unregister(const String& name) { GetFunctions().erase(name); + Application::GetEQ().Post(boost::bind(boost::ref(OnUnregistered), name)); } ScriptFunction::Ptr ScriptFunction::GetByName(const String& name) diff --git a/lib/base/scriptfunction.h b/lib/base/scriptfunction.h index bc9fff7bd..4597acde6 100644 --- a/lib/base/scriptfunction.h +++ b/lib/base/scriptfunction.h @@ -48,6 +48,9 @@ public: static map& GetFunctions(void); + static boost::signal OnRegistered; + static boost::signal OnUnregistered; + private: Callback m_Callback; };