From dd7f2e593ee2be2dbef2a091e863188c30e61f80 Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Mon, 8 Mar 2021 17:32:06 -0500 Subject: [PATCH] Automatically add new line char in MQTT frames --- src/MQTT/Client.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MQTT/Client.cpp b/src/MQTT/Client.cpp index 7d3e75f5..9d698acf 100644 --- a/src/MQTT/Client.cpp +++ b/src/MQTT/Client.cpp @@ -547,6 +547,10 @@ void Client::onMessageReceived(const QMQTT::Message &message) if (topic() != mtopic) return; - // Let IO manager process incoming data + // Add EOL character + if (!mpayld.endsWith('\n')) + mpayld.append('\n'); + + // Let IO manager process incoming data IO::Manager::getInstance()->processPayload(mpayld); }