summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2022-06-18 10:32:49 -0400
committerthebearon <19438782+thebearon@users.noreply.github.com>2022-08-05 06:49:12 +0200
commit48b35c79c9fa6c4c77335e1b04b8c5e1cfec282d (patch)
tree684ddbfda1443a7c6a271b2a2a9bb55b7d9a1484
parentwsd: Message supports new find and contains operations (diff)
downloadonline-48b35c79c9fa6c4c77335e1b04b8c5e1cfec282d.tar.gz
online-48b35c79c9fa6c4c77335e1b04b8c5e1cfec282d.zip
wsd: test: support filtering Kit messages
Change-Id: Ic747f805689ad9d639857f0ea8af1529433b5f11 Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk> (cherry picked from commit 71ce1a4f5475327fca2b4297695fdc0393afaccd)
-rw-r--r--common/Unit.cpp6
-rw-r--r--common/Unit.hpp9
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 */,