1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
6 #include "icinga/i2-icinga.hpp"
7 #include "icinga/comment-ti.hpp"
8 #include "icinga/checkable-ti.hpp"
9 #include "remote/messageorigin.hpp"
19 class Comment final : public ObjectImpl<Comment>
22 DECLARE_OBJECT(Comment);
23 DECLARE_OBJECTNAME(Comment);
25 static boost::signals2::signal<void (const Comment::Ptr&)> OnCommentAdded;
26 static boost::signals2::signal<void (const Comment::Ptr&)> OnCommentRemoved;
28 intrusive_ptr<Checkable> GetCheckable() const;
30 bool IsExpired() const;
32 static int GetNextCommentID();
34 static String AddComment(const intrusive_ptr<Checkable>& checkable, CommentType entryType,
35 const String& author, const String& text, bool persistent, double expireTime,
36 const String& id = String(), const MessageOrigin::Ptr& origin = nullptr);
38 static void RemoveComment(const String& id, const MessageOrigin::Ptr& origin = nullptr);
40 static String GetCommentIDFromLegacyID(int id);
43 void OnAllConfigLoaded() override;
44 void Start(bool runtimeCreated) override;
45 void Stop(bool runtimeRemoved) override;
48 ObjectImpl<Checkable>::Ptr m_Checkable;
50 static void CommentsExpireTimerHandler();
55 #endif /* COMMENT_H */