diff options
-rw-r--r-- | common/Unit.cpp | 6 | ||||
-rw-r--r-- | common/Unit.hpp | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/common/Unit.cpp b/common/Unit.cpp index 174331197b..50f9d60e3a 100644 --- a/common/Unit.cpp +++ b/common/Unit.cpp @@ -25,6 +25,7 @@ #include "Util.hpp" #include <common/SigUtil.hpp> +#include <common/Message.hpp> UnitBase *UnitBase::Global = nullptr; UnitKit *GlobalKit = nullptr; @@ -209,6 +210,11 @@ UnitBase::~UnitBase() _socketPoll->joinThread(); } +bool UnitBase::filterLOKitMessage(const std::shared_ptr<Message>& message) +{ + return onFilterLOKitMessage(message); +} + bool UnitBase::filterSendWebSocketMessage(const char* data, const std::size_t len, const WSOpCode code, const bool flush, int& unitReturn) { diff --git a/common/Unit.hpp b/common/Unit.hpp index ecfaa1f4ce..967c811730 100644 --- a/common/Unit.hpp +++ b/common/Unit.hpp @@ -27,6 +27,7 @@ class UnitTimeout; class WebSocketHandler; class ClientSession; +class Message; // Forward declaration to avoid pulling the world here. namespace Poco @@ -151,6 +152,11 @@ public: return false; } + /// Message that LOKit sent (typically upon receipt in DocBroker). + /// To override, handle onFilterLOKitMessage. + /// Returns true to stop processing the message further. + bool filterLOKitMessage(const std::shared_ptr<Message>& message); + /// Message that is about to be sent via the websocket. /// To override, handle onFilterSendWebSocketMessage or any of the onDocument...() handlers. /// Returns true to stop processing the message further. @@ -248,6 +254,9 @@ private: } static UnitBase *linkAndCreateUnit(UnitType type, const std::string& unitLibPath); + /// Handles messages from LOKit. + virtual bool onFilterLOKitMessage(const std::shared_ptr<Message>& /*message*/) { return false; } + /// Handles messages sent via WebSocket. virtual bool onFilterSendWebSocketMessage(const char* /*data*/, const std::size_t /*len*/, const WSOpCode /* code */, const bool /* flush */, |